diff --git a/.github/contributors.json b/.github/contributors.json index ad6f162d2c..62b93da928 100644 --- a/.github/contributors.json +++ b/.github/contributors.json @@ -1603,5 +1603,10 @@ "name": "Ali Shamakhi", "github_login": "ali-shamakhi", "twitter_username": "" + }, + { + "name": "Filipe Nascimento", + "github_login": "FilipeNas", + "twitter_username": "" } ] \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index acf7676ec3..d8d601e926 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,14 +26,14 @@ repos: args: ["--tab-width", "2"] - repo: https://github.com/asottile/pyupgrade - rev: v3.16.0 + rev: v3.17.0 hooks: - id: pyupgrade args: [--py312-plus] exclude: hooks/ - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 24.8.0 hooks: - id: black @@ -43,7 +43,7 @@ repos: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 7.1.0 + rev: 7.1.1 hooks: - id: flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index df51251bbc..5210aa0412 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,129 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2024.08.04 + + +### Updated + +- Update uvicorn to 0.30.5 ([#5272](https://github.com/cookiecutter/cookiecutter-django/pull/5272)) + +- Update ruff to 0.5.6 ([#5273](https://github.com/cookiecutter/cookiecutter-django/pull/5273)) + +- Auto-update pre-commit hooks ([#5274](https://github.com/cookiecutter/cookiecutter-django/pull/5274)) + +## 2024.07.31 + + +### Updated + +- Update uvicorn to 0.30.4 ([#5271](https://github.com/cookiecutter/cookiecutter-django/pull/5271)) + +- Update mypy to 1.11.1 ([#5270](https://github.com/cookiecutter/cookiecutter-django/pull/5270)) + +- Update pre-commit to 3.8.0 ([#5257](https://github.com/cookiecutter/cookiecutter-django/pull/5257)) + +- Update pyupgrade pre-commit hook to v3.17.0 ([#5258](https://github.com/cookiecutter/cookiecutter-django/pull/5258)) + +- Update redis to 5.0.8 ([#5265](https://github.com/cookiecutter/cookiecutter-django/pull/5265)) + +- Update django-stubs to 5.0.4 ([#5256](https://github.com/cookiecutter/cookiecutter-django/pull/5256)) + +- Update mypy to 1.11.0 ([#5231](https://github.com/cookiecutter/cookiecutter-django/pull/5231)) + +- Update django-allauth to 64.0.0 ([#5269](https://github.com/cookiecutter/cookiecutter-django/pull/5269)) + +- Update sentry-sdk to 2.12.0 ([#5268](https://github.com/cookiecutter/cookiecutter-django/pull/5268)) + +## 2024.07.26 + + +### Updated + +- Update ruff to 0.5.5 ([#5250](https://github.com/cookiecutter/cookiecutter-django/pull/5250)) + +## 2024.07.25 + + +### Changed + +- Upgrade to Django 5.0 ([#5199](https://github.com/cookiecutter/cookiecutter-django/pull/5199)) + +### Updated + +- Update pytest to 8.3.2 ([#5249](https://github.com/cookiecutter/cookiecutter-django/pull/5249)) + +- Update sentry-sdk to 2.11.0 ([#5247](https://github.com/cookiecutter/cookiecutter-django/pull/5247)) + +## 2024.07.24 + + +### Changed + +- fix non existent of two scoops of django image ([#5248](https://github.com/cookiecutter/cookiecutter-django/pull/5248)) + +## 2024.07.23 + + +### Changed + +- Ensure that awscli service has a CMD to fix #5241 ([#5245](https://github.com/cookiecutter/cookiecutter-django/pull/5245)) + +### Fixed + +- Downgrade watchfiles ([#5243](https://github.com/cookiecutter/cookiecutter-django/pull/5243)) + +## 2024.07.22 + + +### Updated + +- Update django-compressor to 4.5.1 ([#5240](https://github.com/cookiecutter/cookiecutter-django/pull/5240)) + +## 2024.07.21 + + +### Updated + +- Update ruff to 0.5.4 ([#5237](https://github.com/cookiecutter/cookiecutter-django/pull/5237)) + +- Update pytest to 8.3.1 ([#5236](https://github.com/cookiecutter/cookiecutter-django/pull/5236)) + +- Update sphinx to 7.4.7 ([#5235](https://github.com/cookiecutter/cookiecutter-django/pull/5235)) + +## 2024.07.20 + + +### Updated + +- Update hiredis to 3.0.0 ([#5228](https://github.com/cookiecutter/cookiecutter-django/pull/5228)) + +- Update uvicorn to 0.30.3 ([#5234](https://github.com/cookiecutter/cookiecutter-django/pull/5234)) + +- Update django-crispy-forms to 2.3 ([#5229](https://github.com/cookiecutter/cookiecutter-django/pull/5229)) + +- Auto-update pre-commit hooks ([#5232](https://github.com/cookiecutter/cookiecutter-django/pull/5232)) + +## 2024.07.19 + + +### Changed + +- Use "ENV key=value" instead of "ENV key value" in Dockerfiles ([#5225](https://github.com/cookiecutter/cookiecutter-django/pull/5225)) + +### Updated + +- Update django-upgrade to 1.20.0 ([#5227](https://github.com/cookiecutter/cookiecutter-django/pull/5227)) + +- Update ruff to 0.5.3 ([#5224](https://github.com/cookiecutter/cookiecutter-django/pull/5224)) + +## 2024.07.18 + + +### Updated + +- Update sphinx to 7.4.6 ([#5223](https://github.com/cookiecutter/cookiecutter-django/pull/5223)) + ## 2024.07.17 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fac85d9e41..03f86e76c6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -852,6 +852,13 @@ Listed in alphabetical order. + + Filipe Nascimento + + FilipeNas + + + Florian Idelberger diff --git a/README.md b/README.md index b73ecef9ed..879b2b2cf7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ production-ready Django projects quickly. ## Features -- For Django 4.2 +- For Django 5.0 - Works with Python 3.12 - Renders Django projects with 100% starting test coverage - Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5 @@ -67,7 +67,7 @@ Projects that provide financial support to the maintainers: ### Two Scoops of Django -[![Cover of the book "Two Scoops of Django 3.x"](https://www.feldroy.com/static/book-TSD3-800.jpg)](https://www.feldroy.com/two-scoops-press#two-scoops-of-django) +[![Cover of the book "Two Scoops of Django 3.x"](https://f004.backblazeb2.com/file/feldroycom/images/book-TSD3-800.jpg)](https://www.feldroy.com/two-scoops-press#two-scoops-of-django) Two Scoops of Django 3.x is the best ice cream-themed Django reference in the universe! @@ -244,6 +244,7 @@ experience better. ## Articles +- [Why cookiecutter-django is Essential for Your Next Django Project](https://medium.com/@millsks/why-cookiecutter-django-is-essential-for-your-next-django-project-7d3c00cdce51) - Aug. 4, 2024 - [How to Make Your Own Django Cookiecutter Template!](https://medium.com/@FatemeFouladkar/how-to-make-your-own-django-cookiecutter-template-a753d4cbb8c2) - Aug. 10, 2023 - [Cookiecutter Django With Amazon RDS](https://haseeburrehman.com/posts/cookiecutter-django-with-amazon-rds/) - Apr, 2, 2021 - [Complete Walkthrough: Blue/Green Deployment to AWS ECS using GitHub actions](https://github.com/Andrew-Chen-Wang/cookiecutter-django-ecs-github) - June 10, 2020 diff --git a/docs/requirements.txt b/docs/requirements.txt index d4b0420dee..f3b1537217 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -sphinx==7.4.5 +sphinx==7.4.7 sphinx-rtd-theme==2.0.0 -myst-parser==3.0.1 +myst-parser==4.0.0 diff --git a/requirements.txt b/requirements.txt index 000d1cf36b..8139fb9f4d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,15 +4,15 @@ binaryornot==0.4.4 # Code quality # ------------------------------------------------------------------------------ -ruff==0.5.2 -django-upgrade==1.19.0 +ruff==0.5.6 +django-upgrade==1.20.0 djlint==1.34.1 -pre-commit==3.7.1 +pre-commit==3.8.0 # Testing # ------------------------------------------------------------------------------ tox==4.16.0 -pytest==8.2.2 +pytest==8.3.2 pytest-xdist==3.6.1 pytest-cookies==0.7.0 pytest-instafail==0.5.0 diff --git a/setup.py b/setup.py index 312da1c83e..9aaaa02db8 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from distutils.core import setup # We use calendar versioning -version = "2024.07.17" +version = "2024.08.04" with open("README.md") as readme_file: long_description = readme_file.read() @@ -24,7 +24,7 @@ classifiers=[ "Development Status :: 4 - Beta", "Environment :: Console", - "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", "Intended Audience :: Developers", "Natural Language :: English", "License :: OSI Approved :: BSD License", diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 5a0bca383d..9669d78bab 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -230,7 +230,7 @@ def test_django_upgrade_passes(cookies, context_override): try: sh.django_upgrade( "--target-version", - "4.2", + "5.0", *python_files, _cwd=str(result.project_path), ) diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 956ca8d004..ffe38a7ac0 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -28,14 +28,14 @@ repos: exclude: '{{cookiecutter.project_slug}}/templates/' - repo: https://github.com/adamchainz/django-upgrade - rev: '1.19.0' + rev: '1.20.0' hooks: - id: django-upgrade - args: ['--target-version', '4.2'] + args: ['--target-version', '5.0'] # Run the Ruff linter. - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.2 + rev: v0.5.6 hooks: # Linter - id: ruff diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index 26a21c9386..1183ae9848 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -27,9 +27,9 @@ FROM python AS python-run-stage ARG BUILD_ENVIRONMENT=local ARG APP_HOME=/app -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 -ENV BUILD_ENV ${BUILD_ENVIRONMENT} +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV BUILD_ENV=${BUILD_ENVIRONMENT} WORKDIR ${APP_HOME} diff --git a/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile index 54e209886b..cdc002fe0c 100644 --- a/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/docs/Dockerfile @@ -5,7 +5,7 @@ FROM docker.io/python:3.12.4-slim-bookworm AS python # Python build stage FROM python AS python-build-stage -ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONDONTWRITEBYTECODE=1 RUN apt-get update && apt-get install --no-install-recommends -y \ # dependencies for building Python packages @@ -29,8 +29,8 @@ RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels \ FROM python AS python-run-stage ARG BUILD_ENVIRONMENT -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 RUN apt-get update && apt-get install --no-install-recommends -y \ # To run the Makefile diff --git a/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile index 0848ecaf81..438e3fa085 100644 --- a/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile @@ -6,4 +6,4 @@ COPY ./package.json /app RUN npm install && npm cache clean --force -ENV PATH ./node_modules/.bin/:$PATH +ENV PATH=./node_modules/.bin/:$PATH diff --git a/{{cookiecutter.project_slug}}/compose/production/aws/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/aws/Dockerfile index 9c7b8a69a5..80c9a5cc98 100644 --- a/{{cookiecutter.project_slug}}/compose/production/aws/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/aws/Dockerfile @@ -2,6 +2,7 @@ FROM docker.io/amazon/aws-cli:2.17.0 # Clear entrypoint from the base image, otherwise it's always calling the aws CLI ENTRYPOINT [] +CMD ["/bin/bash"] COPY ./compose/production/aws/maintenance /usr/local/bin/maintenance COPY ./compose/production/postgres/maintenance/_sourced /usr/local/bin/maintenance/_sourced diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index ee3b9994a5..6279908a95 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -53,9 +53,9 @@ FROM python AS python-run-stage ARG BUILD_ENVIRONMENT=production ARG APP_HOME=/app -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 -ENV BUILD_ENV ${BUILD_ENVIRONMENT} +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV BUILD_ENV=${BUILD_ENVIRONMENT} WORKDIR ${APP_HOME} diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 65b49facca..03cc2b8356 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -11,9 +11,9 @@ argon2-cffi==23.1.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} whitenoise==6.7.0 # https://github.com/evansd/whitenoise {%- endif %} -redis==5.0.7 # https://github.com/redis/redis-py +redis==5.0.8 # https://github.com/redis/redis-py {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} -hiredis==2.3.2 # https://github.com/redis/hiredis-py +hiredis==3.0.0 # https://github.com/redis/hiredis-py {%- endif %} {%- if cookiecutter.use_celery == "y" %} celery==5.4.0 # pyup: < 6.0 # https://github.com/celery/celery @@ -23,20 +23,20 @@ flower==2.0.1 # https://github.com/mher/flower {%- endif %} {%- endif %} {%- if cookiecutter.use_async == 'y' %} -uvicorn[standard]==0.30.1 # https://github.com/encode/uvicorn +uvicorn[standard]==0.30.5 # https://github.com/encode/uvicorn uvicorn-worker==0.2.0 # https://github.com/Kludex/uvicorn-worker {%- endif %} # Django # ------------------------------------------------------------------------------ -django==4.2.14 # pyup: < 5.0 # https://www.djangoproject.com/ +django==5.0.7 # pyup: < 5.1 # https://www.djangoproject.com/ django-environ==0.11.2 # https://github.com/joke2k/django-environ django-model-utils==4.5.1 # https://github.com/jazzband/django-model-utils -django-allauth[mfa]==0.63.6 # https://github.com/pennersr/django-allauth -django-crispy-forms==2.2 # https://github.com/django-crispy-forms/django-crispy-forms +django-allauth[mfa]==64.0.0 # https://github.com/pennersr/django-allauth +django-crispy-forms==2.3 # https://github.com/django-crispy-forms/django-crispy-forms crispy-bootstrap5==2024.2 # https://github.com/django-crispy-forms/crispy-bootstrap5 {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} -django-compressor==4.5 # https://github.com/django-compressor/django-compressor +django-compressor==4.5.1 # https://github.com/django-compressor/django-compressor {%- endif %} django-redis==5.4.0 # https://github.com/jazzband/django-redis {%- if cookiecutter.use_drf == 'y' %} diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 6c418272b7..78fec207c0 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -8,30 +8,30 @@ psycopg[c]==3.2.1 # https://github.com/psycopg/psycopg psycopg[binary]==3.2.1 # https://github.com/psycopg/psycopg {%- endif %} {%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %} -watchfiles==0.22.0 # https://github.com/samuelcolvin/watchfiles +watchfiles==0.21.0 # https://github.com/samuelcolvin/watchfiles {%- endif %} # Testing # ------------------------------------------------------------------------------ -mypy==1.10.0 # https://github.com/python/mypy -django-stubs[compatible-mypy]==5.0.2 # https://github.com/typeddjango/django-stubs -pytest==8.2.2 # https://github.com/pytest-dev/pytest +mypy==1.11.1 # https://github.com/python/mypy +django-stubs[compatible-mypy]==5.0.4 # https://github.com/typeddjango/django-stubs +pytest==8.3.2 # https://github.com/pytest-dev/pytest pytest-sugar==1.0.0 # https://github.com/Frozenball/pytest-sugar {%- if cookiecutter.use_drf == "y" %} -djangorestframework-stubs[compatible-mypy]==3.15.0 # https://github.com/typeddjango/djangorestframework-stubs +djangorestframework-stubs==3.15.0 # https://github.com/typeddjango/djangorestframework-stubs {%- endif %} # Documentation # ------------------------------------------------------------------------------ -sphinx==7.4.5 # https://github.com/sphinx-doc/sphinx +sphinx==7.4.7 # https://github.com/sphinx-doc/sphinx sphinx-autobuild==2024.4.16 # https://github.com/GaretJax/sphinx-autobuild # Code quality # ------------------------------------------------------------------------------ -ruff==0.5.2 # https://github.com/astral-sh/ruff -coverage==7.6.0 # https://github.com/nedbat/coveragepy +ruff==0.5.6 # https://github.com/astral-sh/ruff +coverage==7.6.1 # https://github.com/nedbat/coveragepy djlint==1.34.1 # https://github.com/Riverside-Healthcare/djLint -pre-commit==3.7.1 # https://github.com/pre-commit/pre-commit +pre-commit==3.8.0 # https://github.com/pre-commit/pre-commit # Django # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 5fa14841cc..089a26cd4c 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -8,10 +8,10 @@ psycopg[c]==3.2.1 # https://github.com/psycopg/psycopg Collectfasta==3.2.0 # https://github.com/jasongi/collectfasta {%- endif %} {%- if cookiecutter.use_sentry == "y" %} -sentry-sdk==2.10.0 # https://github.com/getsentry/sentry-python +sentry-sdk==2.12.0 # https://github.com/getsentry/sentry-python {%- endif %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} -hiredis==2.3.2 # https://github.com/redis/hiredis-py +hiredis==3.0.0 # https://github.com/redis/hiredis-py {%- endif %} # Django diff --git a/{{cookiecutter.project_slug}}/runtime.txt b/{{cookiecutter.project_slug}}/runtime.txt index 4ddc7cd666..74d315a826 100644 --- a/{{cookiecutter.project_slug}}/runtime.txt +++ b/{{cookiecutter.project_slug}}/runtime.txt @@ -1 +1 @@ -python-3.12.3 +python-3.12.4 diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py index 3f20f2686c..e7655f1234 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py @@ -1,5 +1,6 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.messages.views import SuccessMessageMixin +from django.db.models import QuerySet from django.urls import reverse from django.utils.translation import gettext_lazy as _ from django.views.generic import DetailView @@ -28,12 +29,12 @@ class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView): fields = ["name"] success_message = _("Information successfully updated") - def get_success_url(self): - # for mypy to know that the user is authenticated - assert self.request.user.is_authenticated + def get_success_url(self) -> str: + assert self.request.user.is_authenticated # type guard return self.request.user.get_absolute_url() - def get_object(self): + def get_object(self, queryset: QuerySet | None=None) -> User: + assert self.request.user.is_authenticated # type guard return self.request.user @@ -43,7 +44,7 @@ def get_object(self): class UserRedirectView(LoginRequiredMixin, RedirectView): permanent = False - def get_redirect_url(self): + def get_redirect_url(self) -> str: {%- if cookiecutter.username_type == "email" %} return reverse("users:detail", kwargs={"pk": self.request.user.pk}) {%- else %}