From 9cfb3344acc9efe8cfb44874ed91a46f69a46bf0 Mon Sep 17 00:00:00 2001 From: Andy Babic Date: Wed, 10 Jul 2024 16:13:00 +0100 Subject: [PATCH 1/4] Update test matrix to cover more recent python and django versions --- .github/workflows/test.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 37d9fa4..26ea091 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ on: push # - At least one test run for older supported version of Python and Django # Current configuration: +# - python 3.12, django 5.0 +# - python 3.12, django 4.2 # - python 3.11, django 4.1 # - python 3.10, django 4.0 # - python 3.9, django 3.2 @@ -19,7 +21,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.12 cache: "pip" cache-dependency-path: "**/setup.cfg" - run: pip install -e .[lint] @@ -44,22 +46,26 @@ jobs: strategy: matrix: include: - - name: dj41-py310 - django: 'Django>=4.1,<4.2' - python: '3.10' + - name: dj5-py312 + django: 'Django>=5,<5.1' + python: '3.12' latest: true experimental: false + - name: dj42-py312 + django: 'Django>=4.2,<5' + python: '3.12' + experimental: false + - name: dj41-py311 + django: 'Django>=4.1,<4.2' + python: '3.11' + experimental: false - name: dj32-py39 django: 'Django>=3.2,<4.0' python: '3.9' experimental: false - - name: dj31-py38 - django: 'Django>=3.1,<3.2' - python: '3.8' - experimental: false - - name: djmain-py311 + - name: djmain-py312 django: 'git+https://github.com/django/django.git@main#egg=Django' - python: '3.11' + python: '3.12' experimental: true steps: - uses: actions/checkout@v3 From 09191d3aae6b5b16b585981de50ee3c75eb48bf5 Mon Sep 17 00:00:00 2001 From: Andy Babic Date: Wed, 10 Jul 2024 16:47:27 +0100 Subject: [PATCH 2/4] Update pyproject.toml --- pyproject.toml | 86 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 21 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 83b11b2..3bcc963 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,21 +1,65 @@ -[tool.black] -line_length = 88 -target-version = ['py38'] -exclude = ''' -( - /( - \.eggs # exclude a few common directories in the - | \.git # root of the project - | \.mypy_cache - | \.tox - | \.venv - | __pycache__ - | _build - | build - | dist - | docs - | venv - | node_modules - )/ -) -''' +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "django-querystring-tag" +authors = [{name = "Andy Babic", email = "andyjbabic@gmail.com"}] +description = "A single, powerful template tag for modifying and rendering safe, suitably-encoded querystrings. It's the clean and simple way to create pagination links, filter toggles, and other state-preserving links." +readme = "README.md" +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Framework :: Django", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", +] +dynamic = ["version"] +requires-python = ">=3.11" +dependencies = [ + "Django>=4.2", +] +[project.optional-dependencies] +lint = [ + "ruff>=0.5", +] +test = [ + "dj-database-url==2.1.0", + "pytest-cov==2.12.1", + "pytest-mock==3.12.0", + "pytest-django>=4.5.2", + "pytest>=7.4.2", +] + +[project.urls] +Home = "https://github.com/ababic/django-querystring-tag" + +[tool.flit.module] +name = "querystring_tag" + +[tool.flit.sdist] +exclude = [ + "querystring_tag/testapp", + "querystring_tag/templatetags/tests.py", +] + +[tool.pytest.ini_options] +DJANGO_SETTINGS_MODULE = "testapp.settings" +pythonpath = ["tests.py", "test_*.py", "*_tests.py"] +addopts = "--tb=short" +log_level = "INFO" +filterwarnings = [ + "ignore::DeprecationWarning", +] + +[tool.ruff] +lint.select = ["F", "E", "C90", "I", "B", "DJ", "RUF", "TRY", "C4", "TCH005", "TCH004"] +lint.ignore = ["TRY003", "E501", "RUF012"] From d7f990dccf70cf4025d973e5bd01caa13dd07894 Mon Sep 17 00:00:00 2001 From: Andy Babic Date: Wed, 10 Jul 2024 16:56:14 +0100 Subject: [PATCH 3/4] Remove build config no longer needed by flit --- MANIFEST.in | 6 ------ pytest.ini | 6 ------ setup.cfg | 61 ----------------------------------------------------- setup.py | 3 --- 4 files changed, 76 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 pytest.ini delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 4a98a6a..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include LICENSE *.txt *.md -graft querystring_tag -global-exclude testapp/* -global-exclude __pycache__ -global-exclude *.py[co] -global-exclude .DS_Store diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index c85a7aa..0000000 --- a/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -DJANGO_SETTINGS_MODULE = querystring_tag.testapp.settings -python_files = tests.py test_*.py *_tests.py -testpaths = - querystring_tag -addopts = --tb=short diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index bccc58f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,61 +0,0 @@ -[bdist_wheel] -universal = 1 - -[metadata] -name = django-querystring-tag -version = attr: querystring_tag.get_version -author = Andy Babic -author_email = andyjbabic@gmail.com -long_description = file: README.md -long_description_content_type = text/markdown -license = BSD-3-Clause -license_file = LICENSE -keywords= django querystring GET parameters pagination filter state-preserving link template tag util -classifiers= - Environment :: Web Environment - Development Status :: 5 - Production/Stable - Intended Audience :: Developers - Operating System :: OS Independent - License :: OSI Approved :: BSD License - Natural Language :: English - Programming Language :: Python - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Framework :: Django - Framework :: Django :: 3.1 - Framework :: Django :: 3.2 - Framework :: Django :: 4.0 - -[options] -packages = find: -include_package_data = true -install_requires = - Django >=3.1 -python_requires = >=3.7 - -[options.extras_require] -lint = - black ==22.3.0 - isort ==5.9.3 - flake8 ==3.9.2 -test = - pytest-cov ==2.12.1 - pytest-mock ==3.6.1 - pytest-django ==4.4.0 - pytest ==6.2.4 - -[flake8] -ignore = C901,W503 -max-line-length = 120 - -[isort] -known_first_party=querystring_tag -profile=black -skip=migrations,node_modules,venv -sections=STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER -default_section=THIRDPARTY -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses=True diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From f5a9298614d33ae9e8e386417ab8656f413829d9 Mon Sep 17 00:00:00 2001 From: Andy Babic Date: Wed, 10 Jul 2024 16:49:48 +0100 Subject: [PATCH 4/4] Use ruff for formatting --- .github/workflows/test.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 26ea091..03b3b69 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,18 +23,10 @@ jobs: with: python-version: 3.12 cache: "pip" - cache-dependency-path: "**/setup.cfg" + cache-dependency-path: "pyproject.toml" - run: pip install -e .[lint] - - name: Run flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Run isort - run: isort . --check-only --diff - - name: Run black - run: black . --check --fast + - name: Run ruff + run: ruff check . test: name: 🧪 Test