Uograde CC 240905

This commit is contained in:
Alejandro Franco 2024-09-05 16:31:54 -06:00
commit 9258405566
23 changed files with 230 additions and 74 deletions

View File

@ -1613,5 +1613,20 @@
"name": "Kevin Mills",
"github_login": "millsks",
"twitter_username": ""
},
{
"name": "milvagox",
"github_login": "milvagox",
"twitter_username": "milvagox"
},
{
"name": "Johnny Metz",
"github_login": "johnnymetz",
"twitter_username": ""
},
{
"name": "Will",
"github_login": "novucs",
"twitter_username": ""
}
]

View File

@ -110,6 +110,6 @@ jobs:
run: pip install -r requirements.txt
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "22"
- name: Bare Metal ${{ matrix.script.name }}
run: sh tests/test_bare.sh ${{ matrix.script.args }}

View File

@ -37,7 +37,7 @@ jobs:
run: pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update/pre-commit-autoupdate

View File

@ -3,6 +3,145 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER -->
## 2024.09.04
### Updated
- Update django-model-utils to 5.0.0 ([#5343](https://github.com/cookiecutter/cookiecutter-django/pull/5343))
## 2024.09.03
### Fixed
- Pin watchdog to 4.0.2 ([#5335](https://github.com/cookiecutter/cookiecutter-django/pull/5335))
### Updated
- Update django to 5.0.9 ([#5341](https://github.com/cookiecutter/cookiecutter-django/pull/5341))
- Update sphinx-autobuild to 2024.9.3 ([#5340](https://github.com/cookiecutter/cookiecutter-django/pull/5340))
## 2024.09.02
### Updated
- Auto-update pre-commit hooks ([#5334](https://github.com/cookiecutter/cookiecutter-django/pull/5334))
- Update django-allauth to 64.2.0 ([#5337](https://github.com/cookiecutter/cookiecutter-django/pull/5337))
- Update pytest-django to 4.9.0 ([#5338](https://github.com/cookiecutter/cookiecutter-django/pull/5338))
## 2024.08.30
### Updated
- Update django-webpack-loader to 3.1.1 ([#5336](https://github.com/cookiecutter/cookiecutter-django/pull/5336))
## 2024.08.29
### Updated
- Update ruff to 0.6.3 ([#5333](https://github.com/cookiecutter/cookiecutter-django/pull/5333))
- Update djlint to 1.35.2 ([#5332](https://github.com/cookiecutter/cookiecutter-django/pull/5332))
- Update djlint pre-commit hook to v1.34.2 ([#5331](https://github.com/cookiecutter/cookiecutter-django/pull/5331))
## 2024.08.28
### Updated
- Update watchfiles to 0.24.0 ([#5330](https://github.com/cookiecutter/cookiecutter-django/pull/5330))
- Update djlint to 1.34.2 ([#5329](https://github.com/cookiecutter/cookiecutter-django/pull/5329))
## 2024.08.26
### Changed
- Check DB migrations in GitHub CI ([#5322](https://github.com/cookiecutter/cookiecutter-django/pull/5322))
### Updated
- Update mypy to 1.11.2 ([#5320](https://github.com/cookiecutter/cookiecutter-django/pull/5320))
## 2024.08.23
### Updated
- Update werkzeug to 3.0.4 ([#5313](https://github.com/cookiecutter/cookiecutter-django/pull/5313))
- Update ruff to 0.6.2 ([#5316](https://github.com/cookiecutter/cookiecutter-django/pull/5316))
## 2024.08.22
### Updated
- Update django-celery-beat to 2.7.0 ([#5315](https://github.com/cookiecutter/cookiecutter-django/pull/5315))
## 2024.08.21
### Changed
- Add type hint for UserFactory ([#5312](https://github.com/cookiecutter/cookiecutter-django/pull/5312))
## 2024.08.20
### Fixed
- Add missing extra_body block in allauth entrance.html ([#5308](https://github.com/cookiecutter/cookiecutter-django/pull/5308))
### Updated
- Bump sass-loader from 14.2.1 to 16.0.1 ([#5309](https://github.com/cookiecutter/cookiecutter-django/pull/5309))
- Bump node from 20 to 22 ([#5039](https://github.com/cookiecutter/cookiecutter-django/pull/5039))
- Bump webpack-merge from 5.10.0 to 6.0.1 ([#5187](https://github.com/cookiecutter/cookiecutter-django/pull/5187))
- Bump css-loader from 6.11.0 to 7.1.2 ([#5089](https://github.com/cookiecutter/cookiecutter-django/pull/5089))
- Bump traefik from 2.11.2 to 3.1.2 ([#5282](https://github.com/cookiecutter/cookiecutter-django/pull/5282))
## 2024.08.19
### Updated
- Update factory-boy to 3.3.1 ([#5307](https://github.com/cookiecutter/cookiecutter-django/pull/5307))
## 2024.08.17
### Updated
- Update ruff to 0.6.1 ([#5303](https://github.com/cookiecutter/cookiecutter-django/pull/5303))
## 2024.08.16
### Updated
- Update django-allauth to 64.1.0 ([#5302](https://github.com/cookiecutter/cookiecutter-django/pull/5302))
## 2024.08.15
### Updated
- Update ruff to 0.6.0 ([#5300](https://github.com/cookiecutter/cookiecutter-django/pull/5300))
## 2024.08.13

View File

@ -1195,6 +1195,13 @@ Listed in alphabetical order.
</td>
<td>cass_john</td>
</tr>
<tr>
<td>Johnny Metz</td>
<td>
<a href="https://github.com/johnnymetz">johnnymetz</a>
</td>
<td></td>
</tr>
<tr>
<td>Jonathan Thompson</td>
<td>
@ -1608,6 +1615,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>milvagox</td>
<td>
<a href="https://github.com/milvagox">milvagox</a>
</td>
<td>milvagox</td>
</tr>
<tr>
<td>Min ho Kim</td>
<td>
@ -2210,6 +2224,13 @@ Listed in alphabetical order.
</td>
<td>westurner</td>
</tr>
<tr>
<td>Will</td>
<td>
<a href="https://github.com/novucs">novucs</a>
</td>
<td></td>
</tr>
<tr>
<td>Will Farley</td>
<td>

View File

@ -4,9 +4,9 @@ binaryornot==0.4.4
# Code quality
# ------------------------------------------------------------------------------
ruff==0.5.7
django-upgrade==1.20.0
djlint==1.34.1
ruff==0.6.3
django-upgrade==1.21.0
djlint==1.35.2
pre-commit==3.8.0
# Testing
@ -20,7 +20,7 @@ pyyaml==6.0.2
# Scripting
# ------------------------------------------------------------------------------
PyGithub==2.3.0
PyGithub==2.4.0
gitpython==3.1.43
jinja2==3.1.4
requests==2.32.3

View File

@ -5,7 +5,7 @@ except ImportError:
from distutils.core import setup
# We use calendar versioning
version = "2024.08.13"
version = "2024.09.04"
with open("README.md") as readme_file:
long_description = readme_file.read()

View File

@ -24,7 +24,7 @@ docker compose -f docker-compose.local.yml run django mypy my_awesome_project
docker compose -f docker-compose.local.yml run django pytest
# return non-zero status code if there are migrations that have not been created
docker compose -f docker-compose.local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
docker compose -f docker-compose.local.yml run django python manage.py makemigrations --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
# Test support for translations
docker compose -f docker-compose.local.yml run django python manage.py makemessages --all

View File

@ -74,6 +74,9 @@ jobs:
- name: Build the docs
run: docker compose -f docker-compose.docs.yml build docs
- name: Check DB Migrations
run: docker compose -f docker-compose.local.yml run --rm django python manage.py makemigrations --check
- name: Run DB Migrations
run: docker compose -f docker-compose.local.yml run --rm django python manage.py migrate
@ -98,6 +101,12 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements/local.txt
- name: Check DB Migrations
run: python manage.py makemigrations --check
- name: Run DB Migrations
run: python manage.py migrate
- name: Test with pytest
run: pytest
{%- endif %}

View File

@ -39,7 +39,7 @@ repos:
# Run the Ruff linter.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.6.3
hooks:
# Linter
- id: ruff
@ -48,7 +48,7 @@ repos:
- id: ruff-format
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.34.1
rev: v1.35.2
hooks:
- id: djlint-reformat-django
files: "templates"

View File

@ -1,4 +1,4 @@
FROM docker.io/node:20-bookworm-slim
FROM docker.io/node:22-bookworm-slim
WORKDIR /app

View File

@ -1,4 +1,4 @@
FROM docker.io/traefik:2.11.2
FROM docker.io/traefik:3.1.2
RUN mkdir -p /etc/traefik/acme \
&& touch /etc/traefik/acme/acme.json \
&& chmod 600 /etc/traefik/acme/acme.json

View File

@ -9,7 +9,7 @@
"babel-loader": "^9.1.2",
"bootstrap": "^5.2.3",
"browser-sync": "^3.0.2",
"css-loader": "^6.5.1",
"css-loader": "^7.1.2",
"gulp-concat": "^2.6.1",
"concurrently": "^8.0.1",
"cssnano": "^7.0.0",
@ -27,15 +27,15 @@
"postcss-loader": "^8.0.0",
"postcss-preset-env": "^9.0.0",
"sass": "^1.43.4",
"sass-loader": "^14.0.0",
"sass-loader": "^16.0.1",
"webpack": "^5.65.0",
"webpack-bundle-tracker": "^3.0.1",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^5.0.2",
"webpack-merge": "^5.8.0"
"webpack-merge": "^6.0.1"
},
"engines": {
"node": "20"
"node": "22"
},
"browserslist": [
"last 2 versions"

View File

@ -59,31 +59,11 @@ indent_size = 2
indent_size = 2
[tool.ruff]
target-version = "py312"
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
extend-exclude = [
"*/migrations/*.py",
"staticfiles/*"
"staticfiles/*",
]
# Same as Django: https://github.com/cookiecutter/cookiecutter-django/issues/4792.
line-length = 88
@ -145,33 +125,22 @@ select = [
"PERF",
# "FURB",
# "LOG",
"RUF"
"RUF",
]
ignore = [
"S101", # Use of assert detected https://docs.astral.sh/ruff/rules/assert/
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"SIM102", # sometimes it's better to nest
"UP038" # Checks for uses of isinstance/issubclass that take a tuple
"UP038", # Checks for uses of isinstance/issubclass that take a tuple
# of types for comparison.
# Deactivated because it can make the code slow:
# https://github.com/astral-sh/ruff/issues/7871
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# The fixes in extend-unsafe-fixes will require
# provide the `--unsafe-fixes` flag when fixing.
extend-unsafe-fixes = [
"UP038"
"UP038",
]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.ruff.lint.isort]
force-single-line = true

View File

@ -17,7 +17,7 @@ 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
django-celery-beat==2.6.0 # https://github.com/celery/django-celery-beat
django-celery-beat==2.7.0 # https://github.com/celery/django-celery-beat
{%- if cookiecutter.use_docker == 'y' %}
flower==2.0.1 # https://github.com/mher/flower
{%- endif %}
@ -29,10 +29,10 @@ uvicorn-worker==0.2.0 # https://github.com/Kludex/uvicorn-worker
# Django
# ------------------------------------------------------------------------------
django==5.0.8 # pyup: < 5.1 # https://www.djangoproject.com/
django==5.0.9 # 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]==64.0.0 # https://github.com/pennersr/django-allauth
django-model-utils==5.0.0 # https://github.com/jazzband/django-model-utils
django-allauth[mfa]==64.2.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' %}
@ -47,7 +47,7 @@ django-cors-headers==4.4.0 # https://github.com/adamchainz/django-cors-headers
drf-spectacular==0.27.2 # https://github.com/tfranzel/drf-spectacular
{%- endif %}
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
django-webpack-loader==3.1.0 # https://github.com/django-webpack/django-webpack-loader
django-webpack-loader==3.1.1 # https://github.com/django-webpack/django-webpack-loader
{%- endif %}
# Project

View File

@ -1,6 +1,7 @@
-r production.txt
Werkzeug[watchdog]==3.0.3 # https://github.com/pallets/werkzeug
watchdog==4.0.2 # https://github.com/gorakhargosh/watchdog
Werkzeug[watchdog]==3.0.4 # https://github.com/pallets/werkzeug
ipdb==0.13.13 # https://github.com/gotcha/ipdb
{%- if cookiecutter.use_docker == 'y' %}
psycopg[c]==3.2.1 # https://github.com/psycopg/psycopg
@ -8,12 +9,12 @@ 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.21.0 # https://github.com/samuelcolvin/watchfiles
watchfiles==0.24.0 # https://github.com/samuelcolvin/watchfiles
{%- endif %}
# Testing
# ------------------------------------------------------------------------------
mypy==1.11.1 # https://github.com/python/mypy
mypy==1.11.2 # 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
@ -24,21 +25,21 @@ djangorestframework-stubs==3.15.0 # https://github.com/typeddjango/djangorestfr
# Documentation
# ------------------------------------------------------------------------------
sphinx==7.4.7 # https://github.com/sphinx-doc/sphinx
sphinx-autobuild==2024.4.16 # https://github.com/GaretJax/sphinx-autobuild
sphinx-autobuild==2024.9.3 # https://github.com/GaretJax/sphinx-autobuild
sphinx-rtd-theme==2.0.0 # https://pypi.org/project/sphinx-rtd-theme/
# Code quality
# ------------------------------------------------------------------------------
ruff==0.5.7 # https://github.com/astral-sh/ruff
ruff==0.6.3 # 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
djlint==1.35.2 # https://github.com/Riverside-Healthcare/djLint
pre-commit==3.8.0 # https://github.com/pre-commit/pre-commit
# Django
# ------------------------------------------------------------------------------
factory-boy==3.3.0 # https://github.com/FactoryBoy/factory_boy
factory-boy==3.3.1 # https://github.com/FactoryBoy/factory_boy
django-debug-toolbar==4.4.6 # https://github.com/jazzband/django-debug-toolbar
django-extensions==3.2.3 # https://github.com/django-extensions/django-extensions
django-coverage-plugin==3.1.0 # https://github.com/nedbat/django_coverage_plugin
pytest-django==4.8.0 # https://github.com/pytest-dev/pytest-django
pytest-django==4.9.0 # https://github.com/pytest-dev/pytest-django

View File

@ -9,6 +9,6 @@ def _media_storage(settings, tmpdir) -> None:
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture()
@pytest.fixture
def user(db) -> User:
return UserFactory()

View File

@ -24,6 +24,8 @@
{% endif %}
{% block content %}
{% endblock content %}
{% block extra_body %}
{% endblock extra_body %}
</div>
</div>
{% endblock body %}{% endraw %}

View File

@ -7,7 +7,7 @@ from factory import post_generation
from factory.django import DjangoModelFactory
class UserFactory(DjangoModelFactory):
class UserFactory(DjangoModelFactory[User]):
{%- if cookiecutter.username_type == "username" %}
username = Faker("user_name")
{%- endif %}

View File

@ -46,7 +46,7 @@ class TestUserAdmin:
response = admin_client.get(url)
assert response.status_code == HTTPStatus.OK
@pytest.fixture()
@pytest.fixture
def _force_allauth(self, settings):
settings.DJANGO_ADMIN_FORCE_ALLAUTH = True
# Reload the admin module to apply the setting change
@ -55,7 +55,7 @@ class TestUserAdmin:
with contextlib.suppress(admin.sites.AlreadyRegistered): # type: ignore[attr-defined]
reload(users_admin)
@pytest.mark.django_db()
@pytest.mark.django_db
@pytest.mark.usefixtures("_force_allauth")
def test_allauth_login(self, rf, settings):
request = rf.get("/fake-url")

View File

@ -6,7 +6,7 @@ from {{ cookiecutter.project_slug }}.users.models import User
class TestUserViewSet:
@pytest.fixture()
@pytest.fixture
def api_rf(self) -> APIRequestFactory:
return APIRequestFactory()

View File

@ -6,7 +6,7 @@ from django.core.management import call_command
from {{ cookiecutter.project_slug }}.users.models import User
@pytest.mark.django_db()
@pytest.mark.django_db
class TestUserManager:
def test_create_user(self):
user = User.objects.create_user(
@ -43,7 +43,7 @@ class TestUserManager:
assert user.username is None
@pytest.mark.django_db()
@pytest.mark.django_db
def test_createsuperuser_command():
"""Ensure createsuperuser command works with our custom manager."""
out = StringIO()

View File

@ -10,7 +10,7 @@ def test_swagger_accessible_by_admin(admin_client):
assert response.status_code == HTTPStatus.OK
@pytest.mark.django_db()
@pytest.mark.django_db
def test_swagger_ui_not_accessible_by_normal_user(client):
url = reverse("api-docs")
response = client.get(url)