diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c5a1678..fff4119 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,6 @@ jobs: fail-fast: false matrix: python-version: - - "3.9" - "3.10" - "3.11" - "3.12" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 665ad61..5d20e0d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,26 +14,36 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/adamchainz/django-upgrade - rev: 1.18.0 + rev: 1.21.0 hooks: - id: django-upgrade args: [--target-version, "3.2"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.9" + rev: "v0.6.4" hooks: - id: ruff + args: [--unsafe-fixes] - id: ruff-format - - repo: https://github.com/biomejs/pre-commit - rev: "v0.4.0" - hooks: - - id: biome-check - additional_dependencies: ["@biomejs/biome@1.8.1"] - args: [--unsafe] - repo: https://github.com/tox-dev/pyproject-fmt - rev: 2.1.3 + rev: 2.2.3 hooks: - id: pyproject-fmt - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.18 + rev: v0.19 hooks: - id: validate-pyproject + - repo: local + hooks: + - id: prettier + name: prettier + entry: npx prettier@3.3.3 --no-semi --write + language: system + types_or: [css, scss] + require_serial: true + - id: eslint + name: eslint + entry: yarn eslint + language: system + types_or: [javascript] + require_serial: true + verbose: true diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c1e7b05..10e8474 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,7 @@ Next version - Added support for embedding content from the SRF (the Swiss television broadcast company). - Lifted the move status indicator above the nav sidebar. +- Dropped compatibility with Python 3.9. 5.2 (2024-06-07) diff --git a/biome.json b/biome.json deleted file mode 100644 index 051d02c..0000000 --- a/biome.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/1.8.1/schema.json", - "organizeImports": { - "enabled": false - }, - "formatter": { - "enabled": true, - "indentStyle": "space", - "indentWidth": 2 - }, - "javascript": { - "formatter": { - "semicolons": "asNeeded" - } - }, - "css": { - "formatter": { - "enabled": true, - "indentStyle": "space", - "indentWidth": 2 - }, - "linter": { - "enabled": true - } - }, - "linter": { - "enabled": true, - "rules": { - "complexity": { - "noForEach": "off", - "useOptionalChain": "off" - }, - "suspicious": { - "noAssignInExpressions": "off" - } - } - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..5b0c2b8 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,17 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; + + +export default [ + {files: ["**/*.js"], languageOptions: {sourceType: "script"}}, + {languageOptions: { globals: globals.browser }}, + pluginJs.configs.recommended, + { + rules: { + "no-unused-vars": [ + "error", + {argsIgnorePattern: "^_", varsIgnorePattern: "^_"} + ] + }, + }, +]; diff --git a/feincms3/applications.py b/feincms3/applications.py index 25415c6..c690e0f 100644 --- a/feincms3/applications.py +++ b/feincms3/applications.py @@ -123,7 +123,7 @@ def reverse_app(namespaces, viewname, *args, languages=None, **kwargs): f"{_APPS_MODEL.LANGUAGE_CODES_NAMESPACE}-{language}" for language in languages ), - (namespaces if isinstance(namespaces, (list, tuple)) else (namespaces,)), + (namespaces if isinstance(namespaces, list | tuple) else (namespaces,)), (viewname,), ) ] diff --git a/feincms3/renderer.py b/feincms3/renderer.py index d436355..c9676cf 100644 --- a/feincms3/renderer.py +++ b/feincms3/renderer.py @@ -56,7 +56,7 @@ def render_in_context(context, template, local_context=None): except AttributeError: engine = Engine.get_default() - if isinstance(template, (list, tuple)): + if isinstance(template, list | tuple): template = engine.select_template(template) else: template = engine.get_template(template) diff --git a/feincms3/templatetags/feincms3.py b/feincms3/templatetags/feincms3.py index 2a3c588..a22e6f7 100644 --- a/feincms3/templatetags/feincms3.py +++ b/feincms3/templatetags/feincms3.py @@ -47,7 +47,7 @@ def render(self, context): namespaces = self.namespaces.resolve(context) view_name = self.view_name.resolve(context) fallback = kwargs.pop("fallback", None) - if not isinstance(namespaces, (list, tuple)): + if not isinstance(namespaces, list | tuple): namespaces = namespaces.split(",") # Try to look up the URL. If it fails, raise NoReverseMatch unless the # {% reverse ... as var %} construct is used, in which case return diff --git a/package.json b/package.json new file mode 100644 index 0000000..fbe1113 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "type": "module", + "devDependencies": { + "@eslint/js": "^9.10.0", + "eslint": "^9.10.0", + "globals": "^15.9.0" + } +} diff --git a/pyproject.toml b/pyproject.toml index 60e5eda..f8f2c78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ license = { text = "BSD-3-Clause" } authors = [ { name = "Matthias Kestenholz", email = "mk@feinheit.ch" }, ] -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Environment :: Web Environment", "Framework :: Django", @@ -21,7 +21,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -65,7 +64,7 @@ include = [ ] [tool.ruff] -target-version = "py39" +target-version = "py310" fix = true show-fixes = true @@ -89,8 +88,6 @@ lint.extend-select = [ "INT", # flake8-implicit-string-concatenation "ISC", - # pep8-naming - "N", # pygrep-hooks "PGH", # flake8-pie @@ -101,8 +98,6 @@ lint.extend-select = [ "PLW", # unused noqa "RUF100", - # flake8-simplify - "SIM", # pyupgrade "UP", "W", diff --git a/tox.ini b/tox.ini index 9157f66..4f25cbd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = - py{39,310}-dj{32,41,42} - py{310,311,312}-dj{32,41,42,50,main} + py{310}-dj{32,42} + py{310,311,312}-dj{32,42,50,51,main} docs slowtests @@ -13,9 +13,9 @@ commands = coverage report -m deps = dj32: Django>=3.2,<4.0 - dj41: Django>=4.1,<4.2 dj42: Django>=4.2,<5.0 dj50: Django>=5.0,<5.1 + dj51: Django>=5.1,<5.2 djmain: https://github.com/django/django/archive/main.tar.gz [testenv:docs]