From 03772dec1b40bd0a970f58528c4b920b76f7cc9e Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 21 Nov 2016 14:49:39 -0800 Subject: [PATCH 01/47] Update flake8 from 3.2.0 to 3.2.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1052e217..369520cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ cookiecutter==1.4.0 -flake8==3.2.0 # pyup: != 2.6.0 +flake8==3.2.1 # pyup: != 2.6.0 sh==1.11 binaryornot==0.4.0 From 0c203241669277411df4bccf9d4bc9708c77affb Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 21 Nov 2016 14:49:40 -0800 Subject: [PATCH 02/47] Update flake8 from 3.2.0 to 3.2.1 --- {{cookiecutter.project_slug}}/requirements/test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/test.txt b/{{cookiecutter.project_slug}}/requirements/test.txt index 2dc42bd4..704a508c 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -8,7 +8,7 @@ psycopg2==2.6.2 {%- endif %} coverage==4.2 -flake8==3.2.0 # pyup: != 2.6.0 +flake8==3.2.1 # pyup: != 2.6.0 django-test-plus==1.0.16 factory_boy==2.7.0 From c76b3066d63efd45f62d4d9db43a19f4bd98c441 Mon Sep 17 00:00:00 2001 From: Denis Savran Date: Thu, 28 Nov 2019 23:16:06 +0300 Subject: [PATCH 03/47] Upgrade to Traefik v2 --- CONTRIBUTORS.rst | 2 + .../compose/production/traefik/Dockerfile | 4 +- .../compose/production/traefik/traefik.toml | 41 ------------ .../compose/production/traefik/traefik.yml | 67 +++++++++++++++++++ 4 files changed, 71 insertions(+), 43 deletions(-) delete mode 100644 {{cookiecutter.project_slug}}/compose/production/traefik/traefik.toml create mode 100644 {{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 53edb28e..46afc393 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -102,6 +102,7 @@ Listed in alphabetical order. Demetris Stavrou `@demestav`_ Denis Bobrov `@delneg`_ Denis Orehovsky `@apirobot`_ + Denis Savran `@blaxpy`_ Diane Chen `@purplediane`_ @purplediane88 Dónal Adams `@epileptic-fish`_ Dong Huynh `@trungdong`_ @@ -226,6 +227,7 @@ Listed in alphabetical order. .. _@arruda: https://github.com/arruda .. _@bertdemiranda: https://github.com/bertdemiranda .. _@bittner: https://github.com/bittner +.. _@blaxpy: https://github.com/blaxpy .. _@bloodpet: https://github.com/bloodpet .. _@blopker: https://github.com/blopker .. _@bogdal: https://github.com/bogdal diff --git a/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile index d7363a1a..746aa2b4 100644 --- a/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/traefik/Dockerfile @@ -1,5 +1,5 @@ -FROM traefik:1.7-alpine +FROM traefik:v2.0 RUN mkdir -p /etc/traefik/acme RUN touch /etc/traefik/acme/acme.json RUN chmod 600 /etc/traefik/acme/acme.json -COPY ./compose/production/traefik/traefik.toml /etc/traefik +COPY ./compose/production/traefik/traefik.yml /etc/traefik diff --git a/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.toml b/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.toml deleted file mode 100644 index 0f2abe8a..00000000 --- a/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.toml +++ /dev/null @@ -1,41 +0,0 @@ -logLevel = "INFO" -defaultEntryPoints = ["http", "https"] - -# Entrypoints, http and https -[entryPoints] - # http should be redirected to https - [entryPoints.http] - address = ":80" - [entryPoints.http.redirect] - entryPoint = "https" - # https is the default - [entryPoints.https] - address = ":443" - [entryPoints.https.tls] - -# Enable ACME (Let's Encrypt): automatic SSL -[acme] -# Email address used for registration -email = "{{ cookiecutter.email }}" -storage = "/etc/traefik/acme/acme.json" -entryPoint = "https" -onDemand = false -OnHostRule = true - # Use a HTTP-01 acme challenge rather than TLS-SNI-01 challenge - [acme.httpChallenge] - entryPoint = "http" - -[file] -[backends] - [backends.django] - [backends.django.servers.server1] - url = "http://django:5000" - -[frontends] - [frontends.django] - backend = "django" - passHostHeader = true - [frontends.django.headers] - HostsProxyHeaders = ['X-CSRFToken'] - [frontends.django.routes.dr1] - rule = "Host:{{ cookiecutter.domain_name }}" diff --git a/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml b/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml new file mode 100644 index 00000000..324c62af --- /dev/null +++ b/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml @@ -0,0 +1,67 @@ +log: + level: INFO + +entryPoints: + web: + # http + address: ":80" + + web-secure: + # https + address: ":443" + +certificatesResolvers: + letsencrypt: + # https://docs.traefik.io/master/https/acme/#lets-encrypt + acme: + email: "{{ cookiecutter.email }}" + storage: /etc/traefik/acme/acme.json + # https://docs.traefik.io/master/https/acme/#httpchallenge + httpChallenge: + entryPoint: web + +http: + routers: + web-router: + rule: "Host(`{{ cookiecutter.domain_name }}`)" + entryPoints: + - web + middlewares: + - redirect + - csrf + service: django + + web-secure-router: + rule: "Host(`{{ cookiecutter.domain_name }}`)" + entryPoints: + - web-secure + middlewares: + - csrf + service: django + tls: + # https://docs.traefik.io/master/routing/routers/#certresolver + certResolver: letsencrypt + + middlewares: + redirect: + # https://docs.traefik.io/master/middlewares/redirectscheme/ + redirectScheme: + scheme: https + permanent: true + csrf: + # https://docs.traefik.io/master/middlewares/headers/#hostsproxyheaders + # https://docs.djangoproject.com/en/dev/ref/csrf/#ajax + headers: + hostsProxyHeaders: ['X-CSRFToken'] + + services: + django: + loadBalancer: + servers: + - url: http://django:5000 + +providers: + # https://docs.traefik.io/master/providers/file/ + file: + filename: /etc/traefik/traefik.yml + watch: true From 113ce88d9cc9b7af133d114d551af93a509e7774 Mon Sep 17 00:00:00 2001 From: Ivan Khomutov Date: Fri, 6 Dec 2019 10:55:00 +0300 Subject: [PATCH 04/47] Add option to choose CI tool --- cookiecutter.json | 6 +++- docs/project-generation-options.rst | 11 +++++-- hooks/post_gen_project.py | 11 +++++-- tests/test_cookiecutter_generation.py | 20 +++++++++++- {{cookiecutter.project_slug}}/.gitlab-ci.yml | 33 ++++++++++++++++++++ 5 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/.gitlab-ci.yml diff --git a/cookiecutter.json b/cookiecutter.json index d6d217ca..6d030be0 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -40,7 +40,11 @@ "use_sentry": "n", "use_whitenoise": "n", "use_heroku": "n", - "use_travisci": "n", + "ci_tool": [ + "None", + "Travis", + "Gitlab" + ], "keep_local_envs_in_vcs": "y", "debug": "n" diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index afa9b8af..ae47b097 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -94,8 +94,12 @@ use_heroku: Indicates whether the project should be configured so as to be deployable to Heroku_. -use_travisci: - Indicates whether the project should be configured to use `Travis CI`_. +ci_tool: + Select a CI tool for running tests. The choices are: + + 1. None + 2. Travis_ + 3. Gitlab_ keep_local_envs_in_vcs: Indicates whether the project's ``.envs/.local/`` should be kept in VCS @@ -138,3 +142,6 @@ debug: .. _Heroku: https://github.com/heroku/heroku-buildpack-python .. _Travis CI: https://travis-ci.org/ + +.. _GitLab CI: https://docs.gitlab.com/ee/ci/ + diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 0544f14b..79c32f9b 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -70,7 +70,7 @@ def remove_heroku_files(): for file_name in file_names: if ( file_name == "requirements.txt" - and "{{ cookiecutter.use_travisci }}".lower() == "y" + and "{{ cookiecutter.ci_tool }}".lower() == "travis" ): # don't remove the file if we are using travisci but not using heroku continue @@ -105,6 +105,10 @@ def remove_dottravisyml_file(): os.remove(".travis.yml") +def remove_dotgitlabciyml_file(): + os.remove(".gitlab-ci.yml") + + def append_to_project_gitignore(path): gitignore_file_path = ".gitignore" with open(gitignore_file_path, "a") as gitignore_file: @@ -349,9 +353,12 @@ def main(): if "{{ cookiecutter.use_docker }}".lower() == "y": remove_celery_compose_dirs() - if "{{ cookiecutter.use_travisci }}".lower() == "n": + if "{{ cookiecutter.ci_tool }}".lower() != "travis": remove_dottravisyml_file() + if "{{ cookiecutter.ci_tool }}".lower() != "gitlab": + remove_dotgitlabciyml_file() + print(SUCCESS + "Project initialized, keep up the good work!" + TERMINATOR) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index f931bce0..8c2f71fe 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -140,7 +140,7 @@ def test_black_passes(cookies, context_combination): def test_travis_invokes_pytest(cookies, context): - context.update({"use_travisci": "y"}) + context.update({"ci_tool": "Travis"}) result = cookies.bake(extra_context=context) assert result.exit_code == 0 @@ -155,6 +155,24 @@ def test_travis_invokes_pytest(cookies, context): pytest.fail(e) +def test_gitlab_invokes_flake8_and_pytest(cookies, context): + context.update({"ci_tool": "Gitlab"}) + result = cookies.bake(extra_context=context) + + assert result.exit_code == 0 + assert result.exception is None + assert result.project.basename == context["project_slug"] + assert result.project.isdir() + + with open(f"{result.project}/.gitlab-ci.yml", "r") as gitlab_yml: + try: + gitlab_config = yaml.load(gitlab_yml) + assert gitlab_config["flake8"]["script"] == ["flake8"] + assert gitlab_config["pytest"]["script"] == ["pytest"] + except yaml.YAMLError as e: + pytest.fail(e) + + @pytest.mark.parametrize("slug", ["project slug", "Project_Slug"]) def test_invalid_slug(cookies, context, slug): """Invalid slug should failed pre-generation hook.""" diff --git a/{{cookiecutter.project_slug}}/.gitlab-ci.yml b/{{cookiecutter.project_slug}}/.gitlab-ci.yml new file mode 100644 index 00000000..15ff73b1 --- /dev/null +++ b/{{cookiecutter.project_slug}}/.gitlab-ci.yml @@ -0,0 +1,33 @@ +stages: + - lint + - test + +variables: + POSTGRES_USER: '{{ cookiecutter.project_slug }}' + POSTGRES_PASSWORD: '' + POSTGRES_DB: 'test_{{ cookiecutter.project_slug }}' + +flake8: + stage: lint + image: python:3.7-alpine + before_script: + - pip install -q flake8 + script: + - flake8 + +pytest: + stage: test + image: python:3.7 + tags: + - docker + services: + - postgres:11 + variables: + DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB + + before_script: + - pip install -r requirements/local.txt + + script: + - pytest + From a88b6b04b6c13b2d9f7f7f794680326786632a3b Mon Sep 17 00:00:00 2001 From: Yuchen Xie <4576282+mapx@users.noreply.github.com> Date: Mon, 9 Dec 2019 09:55:37 +0800 Subject: [PATCH 05/47] Speed up django image build process, and reduce its size --- .../compose/production/django/Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index b0861d60..e63241f4 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -57,13 +57,11 @@ RUN chmod +x /start-flower {%- endif %} {%- if cookiecutter.js_task_runner == 'Gulp' %} -COPY --from=client-builder /app /app +COPY --from=client-builder --chown=django:django /app /app {% else %} -COPY . /app +COPY --chown=django:django . /app {%- endif %} -RUN chown -R django /app - USER django WORKDIR /app From 1dd8608142e7deadb943f4805dd13f9399a8330d Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Tue, 10 Dec 2019 12:46:52 +0100 Subject: [PATCH 06/47] Add django.middleware.common.BrokenLinkEmailsMiddleware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://docs.djangoproject.com/en/2.2/howto/error-reporting/#errors > If those conditions are met, Django will email the users listed in the > MANAGERS setting whenever your code raises a 404 and the request has a > referer. It doesn’t bother to email for 404s that don’t have a referer – > those are usually just people typing in broken URLs or broken Web bots. > It also ignores 404s when the referer is equal to the requested URL, > since this behavior is from broken Web bots too. --- {{cookiecutter.project_slug}}/config/settings/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 935a0d12..ecfeed7a 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -140,6 +140,7 @@ MIDDLEWARE = [ "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.common.BrokenLinkEmailsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", ] From c7027526a3d295fce9e8b12f5b6e8b1017d789f4 Mon Sep 17 00:00:00 2001 From: David D Date: Sun, 22 Dec 2019 12:52:22 +0100 Subject: [PATCH 07/47] Add Debian 10 (buster) OS dependencies --- .../utility/requirements-buster.apt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/utility/requirements-buster.apt diff --git a/{{cookiecutter.project_slug}}/utility/requirements-buster.apt b/{{cookiecutter.project_slug}}/utility/requirements-buster.apt new file mode 100644 index 00000000..75957f40 --- /dev/null +++ b/{{cookiecutter.project_slug}}/utility/requirements-buster.apt @@ -0,0 +1,23 @@ +##basic build dependencies of various Django apps for Debian Jessie 10.x +#build-essential metapackage install: make, gcc, g++, +build-essential +#required to translate +gettext +python3-dev + +##shared dependencies of: +##Pillow, pylibmc +zlib1g-dev + +##Postgresql and psycopg2 dependencies +libpq-dev + +##Pillow dependencies +libtiff5-dev +libjpeg62-turbo-dev +libfreetype6-dev +liblcms2-dev +libwebp-dev + +##django-extensions +libgraphviz-dev From afc7235d577f312de923bc8019d2906d7babb349 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Sun, 22 Dec 2019 19:37:15 -0800 Subject: [PATCH 08/47] Update cookiecutter from 1.6.0 to 1.7.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eccb2d9d..8f836006 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -cookiecutter==1.6.0 +cookiecutter==1.7.0 sh==1.12.14 binaryornot==0.4.4 From 66991d9e958791f6cbb0946b2e67694286d2b3ab Mon Sep 17 00:00:00 2001 From: browniebroke Date: Mon, 23 Dec 2019 08:00:31 -0300 Subject: [PATCH 09/47] Update sphinx from 2.3.0 to 2.3.1 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 070a0b2d..89d10373 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -2,7 +2,7 @@ Werkzeug==0.16.0 # https://github.com/pallets/werkzeug ipdb==0.12.3 # https://github.com/gotcha/ipdb -Sphinx==2.3.0 # https://github.com/sphinx-doc/sphinx +Sphinx==2.3.1 # https://github.com/sphinx-doc/sphinx {%- if cookiecutter.use_docker == 'y' %} psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- else %} From 028728351acebb1935be021d73ba528e7a5f5250 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Sat, 28 Dec 2019 08:00:31 -0300 Subject: [PATCH 10/47] Update tox from 3.14.2 to 3.14.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eccb2d9d..2ab19a9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ flake8==3.7.9 # Testing # ------------------------------------------------------------------------------ -tox==3.14.2 +tox==3.14.3 pytest==5.3.2 pytest_cases==1.12.0 pytest-cookies==0.4.0 From aa48a03c1ff86c06491a8997a2bbb62757cc0281 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 31 Dec 2019 08:00:30 -0300 Subject: [PATCH 11/47] Update django-compressor from 2.3 to 2.4 --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index c31481a3..7c8c7b2f 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -25,7 +25,7 @@ django-model-utils==4.0.0 # https://github.com/jazzband/django-model-utils django-allauth==0.41.0 # https://github.com/pennersr/django-allauth django-crispy-forms==1.8.1 # https://github.com/django-crispy-forms/django-crispy-forms {%- if cookiecutter.use_compressor == "y" %} -django-compressor==2.3 # https://github.com/django-compressor/django-compressor +django-compressor==2.4 # https://github.com/django-compressor/django-compressor {%- endif %} django-redis==4.11.0 # https://github.com/niwinz/django-redis From e33e90fb69a056d3f0f490659a9c826a0df42584 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Thu, 2 Jan 2020 08:00:30 -0300 Subject: [PATCH 12/47] Update pillow from 6.2.1 to 7.0.0 --- {{cookiecutter.project_slug}}/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index c31481a3..2d107178 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,6 +1,6 @@ pytz==2019.3 # https://github.com/stub42/pytz python-slugify==4.0.0 # https://github.com/un33k/python-slugify -Pillow==6.2.1 # https://github.com/python-pillow/Pillow +Pillow==7.0.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.use_compressor == "y" %} rcssmin==1.0.6{% if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin {%- endif %} From 41d514e6cfe4563974b6d1d893fa5de5dbb9e6bf Mon Sep 17 00:00:00 2001 From: browniebroke Date: Fri, 3 Jan 2020 08:00:31 -0300 Subject: [PATCH 13/47] Update pre-commit from 1.20.0 to 1.21.0 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 070a0b2d..8dd68ea4 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -24,7 +24,7 @@ pylint-django==2.0.13 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery {%- endif %} -pre-commit==1.20.0 # https://github.com/pre-commit/pre-commit +pre-commit==1.21.0 # https://github.com/pre-commit/pre-commit # Django # ------------------------------------------------------------------------------ From bfe094963582b7b1ccda377709067fb2ca7923c6 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Mon, 6 Jan 2020 11:00:33 +0000 Subject: [PATCH 14/47] Update coverage from 5.0 to 5.0.2 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 070a0b2d..0acd5ec1 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -18,7 +18,7 @@ pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar # Code quality # ------------------------------------------------------------------------------ flake8==3.7.9 # https://github.com/PyCQA/flake8 -coverage==5.0 # https://github.com/nedbat/coveragepy +coverage==5.0.2 # https://github.com/nedbat/coveragepy black==19.10b0 # https://github.com/ambv/black pylint-django==2.0.13 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} From a0359d9d6a48e1cae6de3a5898e7a9a2258de9b2 Mon Sep 17 00:00:00 2001 From: Hunterx7 Date: Mon, 6 Jan 2020 13:57:19 +0100 Subject: [PATCH 15/47] Bumped runtime for heroku. --- {{cookiecutter.project_slug}}/runtime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/runtime.txt b/{{cookiecutter.project_slug}}/runtime.txt index 42731f2f..6919bf9e 100644 --- a/{{cookiecutter.project_slug}}/runtime.txt +++ b/{{cookiecutter.project_slug}}/runtime.txt @@ -1 +1 @@ -python-3.7.4 +python-3.7.6 From f0e06a2a17746575825c33ee3535a7cfdbbad08b Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 7 Jan 2020 11:00:32 +0000 Subject: [PATCH 16/47] Update pyyaml from 5.2 to 5.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eccb2d9d..8ecf7328 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,4 @@ pytest==5.3.2 pytest_cases==1.12.0 pytest-cookies==0.4.0 pytest-xdist==1.31.0 -pyyaml==5.2 +pyyaml==5.3 From b22045bcd4ebf563ccdcf226fb389a6bb71e2654 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 7 Jan 2020 11:06:31 +0000 Subject: [PATCH 17/47] Replaced base Docker image with debian:buster-slim (#2373) Using system Python 3 distribution (3.7.3) in order to allow the use of Debian packages for numpy, scipy, etc. without the need of building them or installing build dependencies. Changed `#!/bin/sh` in shell scripts to `#!/bin/bash` to make `set -o pipefail` work. --- .../compose/local/django/Dockerfile | 24 +++++++++-------- .../compose/local/django/celery/beat/start | 2 +- .../compose/local/django/celery/flower/start | 2 +- .../compose/local/django/celery/worker/start | 2 +- .../compose/local/django/start | 2 +- .../compose/production/django/Dockerfile | 26 ++++++++++++------- .../production/django/celery/beat/start | 2 +- .../production/django/celery/flower/start | 2 +- .../production/django/celery/worker/start | 2 +- .../compose/production/django/entrypoint | 2 +- .../compose/production/django/start | 2 +- 11 files changed, 38 insertions(+), 30 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index a98547bd..6747322a 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -1,19 +1,21 @@ -FROM python:3.7-alpine +FROM debian:buster-slim ENV PYTHONUNBUFFERED 1 -RUN apk update \ +RUN apt-get update \ + # dependencies for building Python packages + && apt-get install -y build-essential python3-dev python3-pip \ + # link the system python3 as just python for convenience + && ln -s `which python3` /usr/local/bin/python \ + # update pip et al + && pip3 install -U pip setuptools wheel \ # psycopg2 dependencies - && apk add --virtual build-deps gcc python3-dev musl-dev \ - && apk add postgresql-dev \ - # Pillow dependencies - && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \ - # CFFI dependencies - && apk add libffi-dev py-cffi \ + && apt-get install -y libpq-dev \ # Translations dependencies - && apk add gettext \ - # https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell - && apk add postgresql-client + && apt-get install -y gettext \ + # cleaning up unused files + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* # Requirements are installed here to ensure they will be cached. COPY ./requirements /requirements diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start index 389e2baf..c04a7365 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start index be67050d..5bcaa816 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start index 072c6ae6..acd6f157 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/local/django/start b/{{cookiecutter.project_slug}}/compose/local/django/start index 921604dc..f076ee51 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index b0861d60..ddc46f7b 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -9,21 +9,27 @@ RUN npm run build # Python build stage {%- endif %} -FROM python:3.7-alpine +FROM debian:buster-slim ENV PYTHONUNBUFFERED 1 -RUN apk update \ +RUN apt-get update \ + # dependencies for building Python packages + && apt-get install -y build-essential python3-dev python3-pip \ + # link the system python3 as just python for convenience + && ln -s `which python3` /usr/local/bin/python \ + # update pip et al + && pip3 install -U pip setuptools wheel \ # psycopg2 dependencies - && apk add --virtual build-deps gcc python3-dev musl-dev \ - && apk add postgresql-dev \ - # Pillow dependencies - && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \ - # CFFI dependencies - && apk add libffi-dev py-cffi + && apt-get install -y libpq-dev \ + # Translations dependencies + && apt-get install -y gettext \ + # cleaning up unused files + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* -RUN addgroup -S django \ - && adduser -S -G django django +RUN addgroup --system django \ + && adduser --system --ingroup django django # Requirements are installed here to ensure they will be cached. COPY ./requirements /requirements diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start index 0e793e38..20b93123 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start index be67050d..5bcaa816 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start index 4e519c3f..38fb77f3 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint index 0a76b310..95ab8297 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/start b/{{cookiecutter.project_slug}}/compose/production/django/start index 0ad39dfa..709c1dd0 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail From 4a71b0b9360b2ecea9518b4531a30f25c5735fff Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 7 Jan 2020 13:54:15 +0000 Subject: [PATCH 18/47] Using the python:3.7-slim-buster image for later Python version - 3.7.6 (instead of debian:buster-slim, shipped with Python 3.7.3) --- .../compose/local/django/Dockerfile | 8 ++------ .../compose/production/django/Dockerfile | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index 6747322a..94c79952 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -1,14 +1,10 @@ -FROM debian:buster-slim +FROM python:3.7-slim-buster ENV PYTHONUNBUFFERED 1 RUN apt-get update \ # dependencies for building Python packages - && apt-get install -y build-essential python3-dev python3-pip \ - # link the system python3 as just python for convenience - && ln -s `which python3` /usr/local/bin/python \ - # update pip et al - && pip3 install -U pip setuptools wheel \ + && apt-get install -y build-essential \ # psycopg2 dependencies && apt-get install -y libpq-dev \ # Translations dependencies diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index ddc46f7b..9d4dc5fc 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -9,17 +9,13 @@ RUN npm run build # Python build stage {%- endif %} -FROM debian:buster-slim +FROM python:3.7-slim-buster ENV PYTHONUNBUFFERED 1 RUN apt-get update \ # dependencies for building Python packages - && apt-get install -y build-essential python3-dev python3-pip \ - # link the system python3 as just python for convenience - && ln -s `which python3` /usr/local/bin/python \ - # update pip et al - && pip3 install -U pip setuptools wheel \ + && apt-get install -y build-essential \ # psycopg2 dependencies && apt-get install -y libpq-dev \ # Translations dependencies From c94c6acfc453489c952e9bce85c27ef543e5bd6e Mon Sep 17 00:00:00 2001 From: browniebroke Date: Wed, 8 Jan 2020 11:00:33 +0000 Subject: [PATCH 19/47] Update sentry-sdk from 0.13.5 to 0.14.0 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 438ccca6..db3d5e0a 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 Collectfast==1.3.1 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==0.13.5 # https://github.com/getsentry/sentry-python +sentry-sdk==0.14.0 # https://github.com/getsentry/sentry-python {%- endif %} # Django From 3814fc7a3f8a513e0bc46ba6a20ad4ce3b1c31ea Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 11 Jan 2020 13:45:37 +0000 Subject: [PATCH 20/47] Update contributors list --- CONTRIBUTORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 53edb28e..71ba3d34 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -122,6 +122,7 @@ Listed in alphabetical order. Henrique G. G. Pereira `@ikkebr`_ Ian Lee `@IanLee1521`_ Irfan Ahmad `@erfaan`_ @erfaan + Isaac12x `@Isaac12x`_ Jan Van Bruggen `@jvanbrug`_ Jelmer Draaijer `@foarsitter`_ Jens Nilsson `@phiberjenz`_ @@ -282,6 +283,7 @@ Listed in alphabetical order. .. _@hjwp: https://github.com/hjwp .. _@IanLee1521: https://github.com/IanLee1521 .. _@ikkebr: https://github.com/ikkebr +.. _@Isaac12x: https://github.com/Isaac12x .. _@iynaix: https://github.com/iynaix .. _@jangeador: https://github.com/jangeador .. _@jazztpt: https://github.com/jazztpt From d9d6eb82c64ea0ba04f9017fd096be6442f11f19 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 11 Jan 2020 13:52:47 +0000 Subject: [PATCH 21/47] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7d9220..f526bddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2020-01-11] +### Changed +- Speed up & reduce size for production Django image +- Bumped runtime version for Heroku +- Added Debian 10 (Buster) OS dependencies + ## [2019-10-06] ### Changed - Default Python version is now 3.7 (@nicolas471) From 5e1bec2744eef38a909645b85fc1442b7172c59e Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 11 Jan 2020 14:19:11 +0000 Subject: [PATCH 22/47] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f526bddb..58026739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Speed up & reduce size for production Django image - Bumped runtime version for Heroku - Added Debian 10 (Buster) OS dependencies +- Update Traefik to v2 ## [2019-10-06] ### Changed From 9bd9891541966a38311f7952a30e229c56e773b9 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 11 Jan 2020 16:10:14 +0000 Subject: [PATCH 23/47] Align psycopg2 versions --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index f4c22870..37305f4b 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -4,7 +4,7 @@ Werkzeug==0.16.0 # https://github.com/pallets/werkzeug ipdb==0.12.3 # https://github.com/gotcha/ipdb Sphinx==2.3.1 # https://github.com/sphinx-doc/sphinx {%- if cookiecutter.use_docker == 'y' %} -psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 +psycopg2==2.8.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- else %} psycopg2-binary==2.8.4 # https://github.com/psycopg/psycopg2 {%- endif %} diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index db3d5e0a..9e87b18c 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -3,7 +3,7 @@ -r ./base.txt gunicorn==20.0.4 # https://github.com/benoitc/gunicorn -psycopg2==2.8.3 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 +psycopg2==2.8.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- if cookiecutter.use_whitenoise == 'n' %} Collectfast==1.3.1 # https://github.com/antonagestam/collectfast {%- endif %} From 30f8000869b75ebe3e0a312b8a105c121541fca1 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 11 Jan 2020 16:47:44 +0000 Subject: [PATCH 24/47] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58026739..10ee2d03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Bumped runtime version for Heroku - Added Debian 10 (Buster) OS dependencies - Update Traefik to v2 +- Switched from Alpine based image to Debian based image ## [2019-10-06] ### Changed From 88ff9c1846b84a8feb552ddad8c70fec3b8594c0 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 11 Jan 2020 16:48:16 +0000 Subject: [PATCH 25/47] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ee2d03..7a2af7c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Bumped runtime version for Heroku - Added Debian 10 (Buster) OS dependencies - Update Traefik to v2 -- Switched from Alpine based image to Debian based image +- Switched Docker images from Alpine based to Debian based ## [2019-10-06] ### Changed From 08729822451f5149fae49b2fbaab47ebf4c02483 Mon Sep 17 00:00:00 2001 From: Daniel Hillier Date: Mon, 13 Jan 2020 00:28:37 +1100 Subject: [PATCH 26/47] Fix failing mypy tests in users app with django-stubs (#2395) Adds django-stubs as a requirement for local virtualenv. This is required now that the User Model type is being resolved properly. --- .../config/settings/production.py | 2 +- .../config/settings/test.py | 2 +- .../requirements/local.txt | 1 + {{cookiecutter.project_slug}}/setup.cfg | 1 + .../{{cookiecutter.project_slug}}/conftest.py | 4 ++-- .../users/tests/test_models.py | 5 +++-- .../users/tests/test_urls.py | 5 +++-- .../users/tests/test_views.py | 14 ++++---------- 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 22a2acae..39dbc7cd 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -154,7 +154,7 @@ MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/" # TEMPLATES # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#templates -TEMPLATES[0]["OPTIONS"]["loaders"] = [ # noqa F405 +TEMPLATES[0]["OPTIONS"]["loaders"] = [ # type: ignore[index] # noqa F405 ( "django.template.loaders.cached.Loader", [ diff --git a/{{cookiecutter.project_slug}}/config/settings/test.py b/{{cookiecutter.project_slug}}/config/settings/test.py index fad41afd..d31b2864 100644 --- a/{{cookiecutter.project_slug}}/config/settings/test.py +++ b/{{cookiecutter.project_slug}}/config/settings/test.py @@ -32,7 +32,7 @@ PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] # TEMPLATES # ------------------------------------------------------------------------------ -TEMPLATES[0]["OPTIONS"]["loaders"] = [ # noqa F405 +TEMPLATES[0]["OPTIONS"]["loaders"] = [ # type: ignore[index] # noqa F405 ( "django.template.loaders.cached.Loader", [ diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 37305f4b..c46444ef 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -12,6 +12,7 @@ psycopg2-binary==2.8.4 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ mypy==0.761 # https://github.com/python/mypy +django-stubs==1.3.1 # https://github.com/typeddjango/django-stubs pytest==5.3.1 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg index f7cd01cb..5f7d9b65 100644 --- a/{{cookiecutter.project_slug}}/setup.cfg +++ b/{{cookiecutter.project_slug}}/setup.cfg @@ -13,6 +13,7 @@ ignore_missing_imports = True warn_unused_ignores = True warn_redundant_casts = True warn_unused_configs = True +plugins = mypy_django_plugin.main [mypy.plugins.django-stubs] django_settings_module = config.settings.test diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py index aae11d26..8cd51d7f 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/conftest.py @@ -1,7 +1,7 @@ import pytest -from django.conf import settings from django.test import RequestFactory +from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory @@ -11,7 +11,7 @@ def media_storage(settings, tmpdir): @pytest.fixture -def user() -> settings.AUTH_USER_MODEL: +def user() -> User: return UserFactory() diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py index 54863632..3194be1f 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_models.py @@ -1,8 +1,9 @@ import pytest -from django.conf import settings + +from {{ cookiecutter.project_slug }}.users.models import User pytestmark = pytest.mark.django_db -def test_user_get_absolute_url(user: settings.AUTH_USER_MODEL): +def test_user_get_absolute_url(user: User): assert user.get_absolute_url() == f"/users/{user.username}/" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py index c6361920..933396ba 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py @@ -1,11 +1,12 @@ import pytest -from django.conf import settings from django.urls import reverse, resolve +from {{ cookiecutter.project_slug }}.users.models import User + pytestmark = pytest.mark.django_db -def test_detail(user: settings.AUTH_USER_MODEL): +def test_detail(user: User): assert ( reverse("users:detail", kwargs={"username": user.username}) == f"/users/{user.username}/" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py index 76cb80aa..9e868899 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py @@ -1,7 +1,7 @@ import pytest -from django.conf import settings from django.test import RequestFactory +from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.views import UserRedirectView, UserUpdateView pytestmark = pytest.mark.django_db @@ -16,9 +16,7 @@ class TestUserUpdateView: https://github.com/pytest-dev/pytest-django/pull/258 """ - def test_get_success_url( - self, user: settings.AUTH_USER_MODEL, request_factory: RequestFactory - ): + def test_get_success_url(self, user: User, request_factory: RequestFactory): view = UserUpdateView() request = request_factory.get("/fake-url/") request.user = user @@ -27,9 +25,7 @@ class TestUserUpdateView: assert view.get_success_url() == f"/users/{user.username}/" - def test_get_object( - self, user: settings.AUTH_USER_MODEL, request_factory: RequestFactory - ): + def test_get_object(self, user: User, request_factory: RequestFactory): view = UserUpdateView() request = request_factory.get("/fake-url/") request.user = user @@ -40,9 +36,7 @@ class TestUserUpdateView: class TestUserRedirectView: - def test_get_redirect_url( - self, user: settings.AUTH_USER_MODEL, request_factory: RequestFactory - ): + def test_get_redirect_url(self, user: User, request_factory: RequestFactory): view = UserRedirectView() request = request_factory.get("/fake-url") request.user = user From 9d1d5e47ff18682a1190fa4ef2b916044daf34ab Mon Sep 17 00:00:00 2001 From: browniebroke Date: Mon, 13 Jan 2020 11:00:33 +0000 Subject: [PATCH 27/47] Update coverage from 5.0.2 to 5.0.3 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 37305f4b..01394c15 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -18,7 +18,7 @@ pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar # Code quality # ------------------------------------------------------------------------------ flake8==3.7.9 # https://github.com/PyCQA/flake8 -coverage==5.0.2 # https://github.com/nedbat/coveragepy +coverage==5.0.3 # https://github.com/nedbat/coveragepy black==19.10b0 # https://github.com/ambv/black pylint-django==2.0.13 # https://github.com/PyCQA/pylint-django {%- if cookiecutter.use_celery == 'y' %} From 60bf49a10cc840d551d15c99ab9ec962f1d34ebf Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 13 Jan 2020 12:40:32 +0000 Subject: [PATCH 28/47] Update CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 87c8b4bd..3e1f1cfe 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -94,6 +94,7 @@ Listed in alphabetical order. Dan Shultz `@shultz`_ Dani Hodovic `@danihodovic`_ Daniel Hepper `@dhepper`_ @danielhepper + Daniel Hillier `@danifus`_ Daniele Tricoli `@eriol`_ David Díaz `@ddiazpinto`_ @DavidDiazPinto Davit Tovmasyan `@davitovmasyan`_ @@ -255,6 +256,7 @@ Listed in alphabetical order. .. _@curtisstpierre: https://github.com/curtisstpierre .. _@dadokkio: https://github.com/dadokkio .. _@danihodovic: https://github.com/danihodovic +.. _@danifus: https://github.com/danifus .. _@davitovmasyan: https://github.com/davitovmasyan .. _@ddiazpinto: https://github.com/ddiazpinto .. _@delneg: https://github.com/delneg From 463c1f83e6896284b6c77b868b42797425a99c38 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 13 Jan 2020 17:51:50 +0000 Subject: [PATCH 29/47] Update CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 3e1f1cfe..14394dde 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -125,6 +125,7 @@ Listed in alphabetical order. Ian Lee `@IanLee1521`_ Irfan Ahmad `@erfaan`_ @erfaan Isaac12x `@Isaac12x`_ + Ivan Khomutov `@ikhomutov`_ Jan Van Bruggen `@jvanbrug`_ Jelmer Draaijer `@foarsitter`_ Jens Nilsson `@phiberjenz`_ @@ -286,6 +287,7 @@ Listed in alphabetical order. .. _@hendrikschneider: https://github.com/hendrikschneider .. _@hjwp: https://github.com/hjwp .. _@IanLee1521: https://github.com/IanLee1521 +.. _@ikhomutov: https://github.com/ikhomutov .. _@ikkebr: https://github.com/ikkebr .. _@Isaac12x: https://github.com/Isaac12x .. _@iynaix: https://github.com/iynaix From d9d80751dd44d40c9b7da5a56b71e1e92d350c7d Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 13 Jan 2020 22:42:35 +0000 Subject: [PATCH 30/47] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a2af7c0..b12ce03e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2020-01-12] +### Changed +- Fix mypy setup and added django-stubs +- Add Gitlab CI as option + ## [2020-01-11] ### Changed - Speed up & reduce size for production Django image From 6d4128b487f83e1083b9249d5709558c24feec2b Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 14 Jan 2020 11:00:32 +0000 Subject: [PATCH 31/47] Update django-stubs from 1.3.1 to 1.4.0 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 600ef4f5..ebaad16e 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -12,7 +12,7 @@ psycopg2-binary==2.8.4 # https://github.com/psycopg/psycopg2 # Testing # ------------------------------------------------------------------------------ mypy==0.761 # https://github.com/python/mypy -django-stubs==1.3.1 # https://github.com/typeddjango/django-stubs +django-stubs==1.4.0 # https://github.com/typeddjango/django-stubs pytest==5.3.1 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar From 82c483bad52871498bf9f2d5d65f956124df3589 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 14 Jan 2020 11:00:37 +0000 Subject: [PATCH 32/47] Update pytest-django from 3.7.0 to 3.8.0 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 600ef4f5..95c57d7c 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -34,4 +34,4 @@ factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==2.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.2.5 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin -pytest-django==3.7.0 # https://github.com/pytest-dev/pytest-django +pytest-django==3.8.0 # https://github.com/pytest-dev/pytest-django From 43601d805ab3a10ccb42496e26f0ea851e57794e Mon Sep 17 00:00:00 2001 From: Bo Date: Tue, 14 Jan 2020 08:49:33 -0600 Subject: [PATCH 33/47] Update CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 14394dde..e4ef3181 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -71,6 +71,7 @@ Listed in alphabetical order. Benjamin Abel Bert de Miranda `@bertdemiranda`_ Bo Lopker `@blopker`_ + Bo Peng `@BoPeng`_ Bouke Haarsma Brent Payne `@brentpayne`_ @brentpayne Bruce Olivier `@bolivierjr`_ @@ -235,6 +236,7 @@ Listed in alphabetical order. .. _@blopker: https://github.com/blopker .. _@bogdal: https://github.com/bogdal .. _@bolivierjr: https://github.com/bolivierjr +.. _@BoPeng: https://github.com/BoPeng .. _@brentpayne: https://github.com/brentpayne .. _@btknu: https://github.com/btknu .. _@burhan: https://github.com/burhan From 15fc92ace134386adfced5b94504117eec8e954b Mon Sep 17 00:00:00 2001 From: Bo Date: Tue, 14 Jan 2020 08:50:38 -0600 Subject: [PATCH 34/47] Assuming DTL to be the last instead of first template engine --- {{cookiecutter.project_slug}}/config/settings/production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 39dbc7cd..36667b33 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -154,7 +154,7 @@ MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/" # TEMPLATES # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#templates -TEMPLATES[0]["OPTIONS"]["loaders"] = [ # type: ignore[index] # noqa F405 +TEMPLATES[-1]["OPTIONS"]["loaders"] = [ # type: ignore[index] # noqa F405 ( "django.template.loaders.cached.Loader", [ From 1609d4410edc51a43a2487e55b6c013d1ce1c3ac Mon Sep 17 00:00:00 2001 From: Bo Date: Tue, 14 Jan 2020 21:19:44 -0600 Subject: [PATCH 35/47] Fix loaders option in test environment as well --- {{cookiecutter.project_slug}}/config/settings/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/test.py b/{{cookiecutter.project_slug}}/config/settings/test.py index d31b2864..667bb20d 100644 --- a/{{cookiecutter.project_slug}}/config/settings/test.py +++ b/{{cookiecutter.project_slug}}/config/settings/test.py @@ -32,7 +32,7 @@ PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] # TEMPLATES # ------------------------------------------------------------------------------ -TEMPLATES[0]["OPTIONS"]["loaders"] = [ # type: ignore[index] # noqa F405 +TEMPLATES[-1]["OPTIONS"]["loaders"] = [ # type: ignore[index] # noqa F405 ( "django.template.loaders.cached.Loader", [ From d1a46b5d4ded1342459aba839963a92ceaccccd3 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 17 Jan 2020 10:53:54 +0000 Subject: [PATCH 36/47] Update badge from Gitter to Slack --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 2fba0979..337a8845 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ Cookiecutter Django :target: https://pyup.io/repos/github/pydanny/cookiecutter-django/ :alt: Updates -.. image:: https://badges.gitter.im/Join Chat.svg - :target: https://gitter.im/pydanny/cookiecutter-django?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge +.. image:: https://img.shields.io/badge/cookiecutter-Join%20on%20Slack-green?style=flat&logo=slack + :target: https://join.slack.com/t/cookie-cutter/shared_invite/enQtNzI0Mzg5NjE5Nzk5LTRlYWI2YTZhYmQ4YmU1Y2Q2NmE1ZjkwOGM0NDQyNTIwY2M4ZTgyNDVkNjMxMDdhZGI5ZGE5YmJjM2M3ODJlY2U?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge .. image:: https://www.codetriage.com/pydanny/cookiecutter-django/badges/users.svg :target: https://www.codetriage.com/pydanny/cookiecutter-django From cb95128b178b7948cc4a6c72784952d86c756b36 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 17 Jan 2020 10:56:11 +0000 Subject: [PATCH 37/47] Change link from Gitter to Slack --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 337a8845..6e534b0f 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Cookiecutter Django :alt: Updates .. image:: https://img.shields.io/badge/cookiecutter-Join%20on%20Slack-green?style=flat&logo=slack - :target: https://join.slack.com/t/cookie-cutter/shared_invite/enQtNzI0Mzg5NjE5Nzk5LTRlYWI2YTZhYmQ4YmU1Y2Q2NmE1ZjkwOGM0NDQyNTIwY2M4ZTgyNDVkNjMxMDdhZGI5ZGE5YmJjM2M3ODJlY2U?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge + :target: https://join.slack.com/t/cookie-cutter/shared_invite/enQtNzI0Mzg5NjE5Nzk5LTRlYWI2YTZhYmQ4YmU1Y2Q2NmE1ZjkwOGM0NDQyNTIwY2M4ZTgyNDVkNjMxMDdhZGI5ZGE5YmJjM2M3ODJlY2U .. image:: https://www.codetriage.com/pydanny/cookiecutter-django/badges/users.svg :target: https://www.codetriage.com/pydanny/cookiecutter-django @@ -226,11 +226,11 @@ Community * Have questions? **Before you ask questions anywhere else**, please post your question on `Stack Overflow`_ under the *cookiecutter-django* tag. We check there periodically for questions. * If you think you found a bug or want to request a feature, please open an issue_. -* For anything else, you can chat with us on `Gitter`_. +* For anything else, you can chat with us on `Slack`_. .. _`Stack Overflow`: http://stackoverflow.com/questions/tagged/cookiecutter-django .. _`issue`: https://github.com/pydanny/cookiecutter-django/issues -.. _`Gitter`: https://gitter.im/pydanny/cookiecutter-django?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge +.. _`Slack`: https://join.slack.com/t/cookie-cutter/shared_invite/enQtNzI0Mzg5NjE5Nzk5LTRlYWI2YTZhYmQ4YmU1Y2Q2NmE1ZjkwOGM0NDQyNTIwY2M4ZTgyNDVkNjMxMDdhZGI5ZGE5YmJjM2M3ODJlY2U For Readers of Two Scoops of Django -------------------------------------------- From c02587300ea6f879b220637d6d5406a78fcd26b3 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Fri, 17 Jan 2020 11:00:36 +0000 Subject: [PATCH 38/47] Update django-extensions from 2.2.5 to 2.2.6 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index d0f8ef22..544930ad 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -32,6 +32,6 @@ pre-commit==1.21.0 # https://github.com/pre-commit/pre-commit factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==2.1 # https://github.com/jazzband/django-debug-toolbar -django-extensions==2.2.5 # https://github.com/django-extensions/django-extensions +django-extensions==2.2.6 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin pytest-django==3.8.0 # https://github.com/pytest-dev/pytest-django From 70f43c77160bc786f5a965ee8e3ea67e28175022 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Fri, 17 Jan 2020 11:00:40 +0000 Subject: [PATCH 39/47] Update django-coverage-plugin from 1.6.0 to 1.7.0 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index d0f8ef22..4abefa7e 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -33,5 +33,5 @@ factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==2.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.2.5 # https://github.com/django-extensions/django-extensions -django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin +django-coverage-plugin==1.7.0 # https://github.com/nedbat/django_coverage_plugin pytest-django==3.8.0 # https://github.com/pytest-dev/pytest-django From 546168c64ba47219e8d3cddc4322bb97c6c9efc6 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Sat, 18 Jan 2020 11:00:33 +0000 Subject: [PATCH 40/47] Update pytest from 5.3.2 to 5.3.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2f7772b2..b4be7b5d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ flake8==3.7.9 # Testing # ------------------------------------------------------------------------------ tox==3.14.3 -pytest==5.3.2 +pytest==5.3.3 pytest_cases==1.12.0 pytest-cookies==0.4.0 pytest-xdist==1.31.0 From a69bf2e778ff4d0bc12857c45e5187e1074a829d Mon Sep 17 00:00:00 2001 From: browniebroke Date: Sat, 18 Jan 2020 11:00:34 +0000 Subject: [PATCH 41/47] Update pytest from 5.3.1 to 5.3.3 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 544930ad..345193b5 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -13,7 +13,7 @@ psycopg2-binary==2.8.4 # https://github.com/psycopg/psycopg2 # ------------------------------------------------------------------------------ mypy==0.761 # https://github.com/python/mypy django-stubs==1.4.0 # https://github.com/typeddjango/django-stubs -pytest==5.3.1 # https://github.com/pytest-dev/pytest +pytest==5.3.3 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar # Code quality From 3f6562c7fe79b961952014285c887d958e102906 Mon Sep 17 00:00:00 2001 From: Bo Peng <47236991+bioworkflows@users.noreply.github.com> Date: Sun, 19 Jan 2020 16:21:27 -0600 Subject: [PATCH 42/47] Honor passed password for UserFactory --- .../{{cookiecutter.project_slug}}/users/tests/factories.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py index b5371366..290f7b41 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py @@ -12,7 +12,7 @@ class UserFactory(DjangoModelFactory): @post_generation def password(self, create: bool, extracted: Sequence[Any], **kwargs): - password = Faker( + password = extracted if extracted else Faker( "password", length=42, special_chars=True, From a0fff1d0859699a430d69ad05c158477e6ea8710 Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 21 Jan 2020 11:00:33 +0000 Subject: [PATCH 43/47] Update pytest from 5.3.3 to 5.3.4 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b4be7b5d..8d9b1685 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ flake8==3.7.9 # Testing # ------------------------------------------------------------------------------ tox==3.14.3 -pytest==5.3.3 +pytest==5.3.4 pytest_cases==1.12.0 pytest-cookies==0.4.0 pytest-xdist==1.31.0 From 8ceaa3e1c72e13ea5b29c7581fa09b61bf45a12b Mon Sep 17 00:00:00 2001 From: browniebroke Date: Tue, 21 Jan 2020 11:00:34 +0000 Subject: [PATCH 44/47] Update pytest from 5.3.3 to 5.3.4 --- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 6fd88bc7..4acb1d9d 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -13,7 +13,7 @@ psycopg2-binary==2.8.4 # https://github.com/psycopg/psycopg2 # ------------------------------------------------------------------------------ mypy==0.761 # https://github.com/python/mypy django-stubs==1.4.0 # https://github.com/typeddjango/django-stubs -pytest==5.3.3 # https://github.com/pytest-dev/pytest +pytest==5.3.4 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar # Code quality From bc00a343ea6c93cc078e8f55f033fef1d9af1a88 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 22 Jan 2020 10:52:31 +0000 Subject: [PATCH 45/47] Fix broken links in doc fixes #2408 --- docs/testing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/testing.rst b/docs/testing.rst index 63cb9e18..9aaa2455 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -49,8 +49,8 @@ Once the tests are complete, in order to see the code coverage, run the followin Since this is a fresh install, and there are no tests built using the Python `unittest`_ library yet, you should get feedback that says there were no tests carried out. .. _Pytest: https://docs.pytest.org/en/latest/example/simple.html -.. _develop locally: ../developing-locally.rst -.. _develop locally with docker: ..../developing-locally-docker.rst +.. _develop locally: ./developing-locally.html +.. _develop locally with docker: ./developing-locally-docker.html .. _customize: https://docs.pytest.org/en/latest/customize.html .. _unittest: https://docs.python.org/3/library/unittest.html#module-unittest -.. _configuring: https://coverage.readthedocs.io/en/v4.5.x/config.html \ No newline at end of file +.. _configuring: https://coverage.readthedocs.io/en/v4.5.x/config.html From 9bf6ee16b215648c4014f4ef6fbe351fb0f0d5bc Mon Sep 17 00:00:00 2001 From: browniebroke Date: Wed, 22 Jan 2020 11:00:32 +0000 Subject: [PATCH 46/47] Update sentry-sdk from 0.14.0 to 0.14.1 --- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 9e87b18c..38420a38 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,7 +8,7 @@ psycopg2==2.8.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 Collectfast==1.3.1 # https://github.com/antonagestam/collectfast {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==0.14.0 # https://github.com/getsentry/sentry-python +sentry-sdk==0.14.1 # https://github.com/getsentry/sentry-python {%- endif %} # Django From fd43059e289e15296015b7a2eff9db9b8b1ff5e1 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 23 Jan 2020 17:52:17 +0000 Subject: [PATCH 47/47] Update formatting --- .../users/tests/factories.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py index 290f7b41..8917c5ae 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py @@ -12,14 +12,18 @@ class UserFactory(DjangoModelFactory): @post_generation def password(self, create: bool, extracted: Sequence[Any], **kwargs): - password = extracted if extracted else Faker( - "password", - length=42, - special_chars=True, - digits=True, - upper_case=True, - lower_case=True, - ).generate(extra_kwargs={}) + password = ( + extracted + if extracted + else Faker( + "password", + length=42, + special_chars=True, + digits=True, + upper_case=True, + lower_case=True, + ).generate(extra_kwargs={}) + ) self.set_password(password) class Meta: