From 46cd56191cda8953ad91ed70a380e6952e0bc060 Mon Sep 17 00:00:00 2001 From: Jelmer Draaijer Date: Sat, 26 Oct 2024 17:02:16 +0200 Subject: [PATCH] Cleanup --- tests/test_bare.sh | 1 - {{cookiecutter.project_slug}}/pyproject.toml | 387 +++++++++---------- 2 files changed, 190 insertions(+), 198 deletions(-) diff --git a/tests/test_bare.sh b/tests/test_bare.sh index bb5658a3b2..58ac3d4578 100755 --- a/tests/test_bare.sh +++ b/tests/test_bare.sh @@ -33,6 +33,5 @@ then npm run build fi -. .venv/bin/activate # Generate the HTML for the documentation cd docs && uv run make html diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index b8dfdc1493..6049b85740 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -6,9 +6,9 @@ python_files = [ "tests.py", "test_*.py", ] -{%- if cookiecutter.frontend_pipeline == 'Gulp' %} +{%- if cookiecutter.frontend_pipeline == 'Gulp' % } norecursedirs = ["node_modules"] -{%- endif %} +{%- endif % } # ==== Coverage ==== [tool.coverage.run] @@ -26,9 +26,9 @@ warn_redundant_casts = true warn_unused_configs = true plugins = [ "mypy_django_plugin.main", -{%- if cookiecutter.use_drf == "y" %} + {%- if cookiecutter.use_drf == "y" % } "mypy_drf_plugin.main", -{%- endif %} + {%- endif % } ] [[tool.mypy.overrides]] @@ -68,69 +68,69 @@ extend-exclude = [ [tool.ruff.lint] select = [ - "F", - "E", - "W", - "C90", - "I", - "N", - "UP", - "YTT", - # "ANN", # flake8-annotations: we should support this in the future but 100+ errors atm - "ASYNC", - "S", - "BLE", - "FBT", - "B", - "A", - "COM", - "C4", - "DTZ", - "T10", - "DJ", - "EM", - "EXE", - "FA", - 'ISC', - "ICN", - "G", - 'INP', - 'PIE', - "T20", - 'PYI', - 'PT', - "Q", - "RSE", - "RET", - "SLF", - "SLOT", - "SIM", - "TID", - "TCH", - "INT", - # "ARG", # Unused function argument - "PTH", - "ERA", - "PD", - "PGH", - "PL", - "TRY", - "FLY", - # "NPY", - # "AIR", - "PERF", - # "FURB", - # "LOG", - "RUF", + "F", + "E", + "W", + "C90", + "I", + "N", + "UP", + "YTT", + # "ANN", # flake8-annotations: we should support this in the future but 100+ errors atm + "ASYNC", + "S", + "BLE", + "FBT", + "B", + "A", + "COM", + "C4", + "DTZ", + "T10", + "DJ", + "EM", + "EXE", + "FA", + 'ISC', + "ICN", + "G", + 'INP', + 'PIE', + "T20", + 'PYI', + 'PT', + "Q", + "RSE", + "RET", + "SLF", + "SLOT", + "SIM", + "TID", + "TCH", + "INT", + # "ARG", # Unused function argument + "PTH", + "ERA", + "PD", + "PGH", + "PL", + "TRY", + "FLY", + # "NPY", + # "AIR", + "PERF", + # "FURB", + # "LOG", + "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 - # of types for comparison. - # Deactivated because it can make the code slow: - # https://github.com/astral-sh/ruff/issues/7871 + "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 + # of types for comparison. + # Deactivated because it can make the code slow: + # https://github.com/astral-sh/ruff/issues/7871 ] # The fixes in extend-unsafe-fixes will require # provide the `--unsafe-fixes` flag when fixing. @@ -143,47 +143,42 @@ force-single-line = true [tool.uv] dev-dependencies = [ - "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.3", # https://github.com/psycopg/psycopg -{%- else %} - "psycopg[binary]==3.2.3", # https://github.com/psycopg/psycopg -{%- endif %} -{%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %} - "watchfiles==0.24.0", # https://github.com/samuelcolvin/watchfiles -{%- endif %} - # Testing - # ------------------------------------------------------------------------------ - "mypy==1.11.2", # https://github.com/python/mypy - "django-stubs[compatible-mypy]==5.1.0", # https://github.com/typeddjango/django-stubs - "pytest==8.3.3", # https://github.com/pytest-dev/pytest - "pytest-sugar==1.0.0", # https://github.com/Frozenball/pytest-sugar -{%- if cookiecutter.use_drf == "y" %} - "djangorestframework-stubs==3.15.1", # https://github.com/typeddjango/djangorestframework-stubs -{%- endif %} - - # Documentation - # ------------------------------------------------------------------------------ - "sphinx==7.4.7", # https://github.com/sphinx-doc/sphinx - "sphinx-autobuild==2024.10.3", # https://github.com/GaretJax/sphinx-autobuild - - # Code quality - # ------------------------------------------------------------------------------ - "ruff==0.6.9", # https://github.com/astral-sh/ruff - "coverage==7.6.1", # https://github.com/nedbat/coveragepy - "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.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.9.0", # https://github.com/pytest-dev/pytest-django + "Werkzeug[watchdog]==3.0.6", # https://github.com/pallets/werkzeug + "ipdb==0.13.13", # https://github.com/gotcha/ipdb + {%- if cookiecutter.use_docker == 'y' % } + "psycopg[c]==3.2.3", # https://github.com/psycopg/psycopg + {%- else % } + "psycopg[binary]==3.2.3", # https://github.com/psycopg/psycopg + {%- endif % } + {%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' % } + "watchfiles==0.24.0", # https://github.com/samuelcolvin/watchfiles + {%- endif % } + # Testing + # ------------------------------------------------------------------------------ + "mypy==1.11.2", # https://github.com/python/mypy + "django-stubs[compatible-mypy]==5.1.0", # https://github.com/typeddjango/django-stubs + "pytest==8.3.3", # https://github.com/pytest-dev/pytest + "pytest-sugar==1.0.0", # https://github.com/Frozenball/pytest-sugar + {%- if cookiecutter.use_drf == "y" % } + "djangorestframework-stubs==3.15.1", # https://github.com/typeddjango/djangorestframework-stubs + {%- endif % } + # Documentation + # ------------------------------------------------------------------------------ + "sphinx==7.4.7", # https://github.com/sphinx-doc/sphinx + "sphinx-autobuild==2024.10.3", # https://github.com/GaretJax/sphinx-autobuild + # Code quality + # ------------------------------------------------------------------------------ + "ruff==0.6.9", # https://github.com/astral-sh/ruff + "coverage==7.6.1", # https://github.com/nedbat/coveragepy + "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.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.9.0", # https://github.com/pytest-dev/pytest-django ] [project] @@ -198,95 +193,93 @@ authors = [ ] requires-python = "==3.12.*" dependencies = [ - "python-slugify==8.0.4", # https://github.com/un33k/python-slugify - "Pillow==10.4.0", # https://github.com/python-pillow/Pillow - {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} - {%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} - "rcssmin==1.1.2", # --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin - {%- else %} - "rcssmin==1.1.2", # https://github.com/ndparker/rcssmin - {%- endif %} - {%- endif %} - "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.1.1", # https://github.com/redis/redis-py - {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} - "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.7.0", # https://github.com/celery/django-celery-beat - {%- if cookiecutter.use_docker == 'y' %} - "flower==2.0.1", # https://github.com/mher/flower - {%- endif %} - {%- endif %} - {%- if cookiecutter.use_async == 'y' %} - "uvicorn[standard]==0.31.0", # https://github.com/encode/uvicorn - "uvicorn-worker==0.2.0", # https://github.com/Kludex/uvicorn-worker - {%- endif %} - -# Django -# ------------------------------------------------------------------------------ - "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==5.0.0", # https://github.com/jazzband/django-model-utils - "django-allauth[mfa]==65.0.2", # https://github.com/pennersr/django-allauth - "django-crispy-forms==2.3", # https://github.com/django-crispy-forms/django-crispy-forms - "crispy-bootstrap5==2024.10", # https://github.com/django-crispy-forms/crispy-bootstrap5 - {%- if cookiecutter.frontend_pipeline == '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' %} - # Django REST Framework - "djangorestframework==3.15.2", # https://github.com/encode/django-rest-framework - "django-cors-headers==4.4.0", # https://github.com/adamchainz/django-cors-headers - # DRF-spectacular for api documentation - "drf-spectacular==0.27.2", # https://github.com/tfranzel/drf-spectacular - {%- endif %} - {%- if cookiecutter.frontend_pipeline == 'Webpack' %} - "django-webpack-loader==3.1.1", # https://github.com/django-webpack/django-webpack-loader - {%- endif %} - "gunicorn==23.0.0", # https://github.com/benoitc/gunicorn - "psycopg[c]==3.2.3", # https://github.com/psycopg/psycopg - {%- if cookiecutter.use_whitenoise == 'n' %} - "Collectfasta==3.2.0", # https://github.com/jasongi/collectfasta - {%- endif %} - {%- if cookiecutter.use_sentry == "y" %} - "sentry-sdk==2.15.0", # https://github.com/getsentry/sentry-python - {%- endif %} - {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} - "hiredis==3.0.0", # https://github.com/redis/hiredis-py - {%- endif %} - - # Django - # ------------------------------------------------------------------------------ - {%- if cookiecutter.cloud_provider == 'AWS' %} - "django-storages[s3]==1.14.4", # https://github.com/jschneier/django-storages - {%- elif cookiecutter.cloud_provider == 'GCP' %} - "django-storages[google]==1.14.4", # https://github.com/jschneier/django-storages - {%- elif cookiecutter.cloud_provider == 'Azure' %} - "django-storages[azure]==1.14.4", # https://github.com/jschneier/django-storages - {%- endif %} - {%- if cookiecutter.mail_service == 'Mailgun' %} - "django-anymail[mailgun]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'Amazon SES' %} - "django-anymail[amazon-ses]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'Mailjet' %} - "django-anymail[mailjet]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'Mandrill' %} - "django-anymail[mandrill]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'Postmark' %} - "django-anymail[postmark]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'Sendgrid' %} - "django-anymail[sendgrid]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'Brevo' %} - "django-anymail[brevo]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'SparkPost' %} - "django-anymail[sparkpost]==12.0", # https://github.com/anymail/django-anymail - {%- elif cookiecutter.mail_service == 'Other SMTP' %} - "django-anymail==12.0", # https://github.com/anymail/django-anymail - {%- endif %} + "python-slugify==8.0.4", # https://github.com/un33k/python-slugify + "Pillow==10.4.0", # https://github.com/python-pillow/Pillow + {%- if cookiecutter.frontend_pipeline == 'Django Compressor' % } + {%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' % } + "rcssmin==1.1.2", # --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin + {%- else % } + "rcssmin==1.1.2", # https://github.com/ndparker/rcssmin + {%- endif % } + {%- endif % } + "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.1.1", # https://github.com/redis/redis-py + {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" % } + "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.7.0", # https://github.com/celery/django-celery-beat + {%- if cookiecutter.use_docker == 'y' % } + "flower==2.0.1", # https://github.com/mher/flower + {%- endif % } + {%- endif % } + {%- if cookiecutter.use_async == 'y' % } + "uvicorn[standard]==0.31.0", # https://github.com/encode/uvicorn + "uvicorn-worker==0.2.0", # https://github.com/Kludex/uvicorn-worker + {%- endif % } + # Django + # ------------------------------------------------------------------------------ + "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==5.0.0", # https://github.com/jazzband/django-model-utils + "django-allauth[mfa]==65.0.2", # https://github.com/pennersr/django-allauth + "django-crispy-forms==2.3", # https://github.com/django-crispy-forms/django-crispy-forms + "crispy-bootstrap5==2024.10", # https://github.com/django-crispy-forms/crispy-bootstrap5 + {%- if cookiecutter.frontend_pipeline == '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' % } + # Django REST Framework + "djangorestframework==3.15.2", # https://github.com/encode/django-rest-framework + "django-cors-headers==4.4.0", # https://github.com/adamchainz/django-cors-headers + # DRF-spectacular for api documentation + "drf-spectacular==0.27.2", # https://github.com/tfranzel/drf-spectacular + {%- endif % } + {%- if cookiecutter.frontend_pipeline == 'Webpack' % } + "django-webpack-loader==3.1.1", # https://github.com/django-webpack/django-webpack-loader + {%- endif % } + "gunicorn==23.0.0", # https://github.com/benoitc/gunicorn + "psycopg[c]==3.2.3", # https://github.com/psycopg/psycopg + {%- if cookiecutter.use_whitenoise == 'n' % } + "Collectfasta==3.2.0", # https://github.com/jasongi/collectfasta + {%- endif % } + {%- if cookiecutter.use_sentry == "y" % } + "sentry-sdk==2.15.0", # https://github.com/getsentry/sentry-python + {%- endif % } + {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" % } + "hiredis==3.0.0", # https://github.com/redis/hiredis-py + {%- endif % } + # Django + # ------------------------------------------------------------------------------ + {%- if cookiecutter.cloud_provider == 'AWS' % } + "django-storages[s3]==1.14.4", # https://github.com/jschneier/django-storages + {%- elif cookiecutter.cloud_provider == 'GCP' % } + "django-storages[google]==1.14.4", # https://github.com/jschneier/django-storages + {%- elif cookiecutter.cloud_provider == 'Azure' % } + "django-storages[azure]==1.14.4", # https://github.com/jschneier/django-storages + {%- endif % } + {%- if cookiecutter.mail_service == 'Mailgun' % } + "django-anymail[mailgun]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'Amazon SES' % } + "django-anymail[amazon-ses]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'Mailjet' % } + "django-anymail[mailjet]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'Mandrill' % } + "django-anymail[mandrill]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'Postmark' % } + "django-anymail[postmark]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'Sendgrid' % } + "django-anymail[sendgrid]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'Brevo' % } + "django-anymail[brevo]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'SparkPost' % } + "django-anymail[sparkpost]==12.0", # https://github.com/anymail/django-anymail + {%- elif cookiecutter.mail_service == 'Other SMTP' % } + "django-anymail==12.0", # https://github.com/anymail/django-anymail + {%- endif % } ]