diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 0afa5fe..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[bumpversion] -commit = False -tag = False -current_version = 3.1.1 - -[bumpversion:file:setup.cfg] - -[bumpversion:file:README.rst] -search = :Version: {current_version} -replace = :Version: {new_version} - -[bumpversion:file:package.json] -search = "version": "{current_version}", -replace = "version": "{new_version}", - -[bumpversion:file:django_admin_index/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..699e9b9 --- /dev/null +++ b/.flake8 @@ -0,0 +1,8 @@ +[flake8] +max-line-length = 88 +ignore = E501 +exclude = + env + .tox + doc + **/migrations/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17bccf7..57e1527 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,21 +14,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.7', '3.8', '3.9', '3.10', '3.11'] - django: ['3.2', '4.1', '4.2'] - exclude: - - python: '3.7' - django: '4.1' - - python: '3.7' - django: '4.2' - - python: '3.11' - django: '3.2' + python: ['3.10', '3.11', '3.12'] + django: ['4.2'] name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }}) steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} @@ -42,15 +35,17 @@ jobs: DJANGO: ${{ matrix.django }} - name: Publish coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} styles: name: Build sass into CSS runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - name: Install dependencies @@ -62,22 +57,22 @@ jobs: name: Publish package to PyPI runs-on: ubuntu-latest needs: tests + environment: release + permissions: + id-token: write if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.10' - - name: Build sdist and wheel + - name: Build wheel run: | - pip install pip setuptools wheel --upgrade - python setup.py sdist bdist_wheel + pip install build --upgrade + python -m build - name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: ${{ secrets.PYPI_USERNAME }} - password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index cbb6b92..8898827 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -23,11 +23,12 @@ jobs: toxenv: - isort - black + - flake8 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.10' - name: Install dependencies run: pip install tox - run: tox diff --git a/README.rst b/README.rst index 4b62d59..78f0ec2 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ Admin Index for Django ====================== :Version: 3.1.1 -:Download: https://pypi.python.org/pypi/django-admin-index +:Download: https://pypi.org/project/django-admin-index/ :Source: https://github.com/maykinmedia/django-admin-index :Keywords: django, admin, dashboard diff --git a/django_admin_index/__init__.py b/django_admin_index/__init__.py index becf695..ddcb6d1 100644 --- a/django_admin_index/__init__.py +++ b/django_admin_index/__init__.py @@ -1,5 +1,7 @@ # :copyright: (c) 2017, Maykin Media BV. # All rights reserved. # :license: BSD (3 Clause), see LICENSE for more details. -__version__ = "3.1.1" +from importlib.metadata import version + +__version__ = version("django-admin-index") __author__ = "Joeri Bekker" diff --git a/django_admin_index/locale/nl/LC_MESSAGES/django.po b/django_admin_index/locale/nl/LC_MESSAGES/django.po index a1484ac..52fe2e1 100644 --- a/django_admin_index/locale/nl/LC_MESSAGES/django.po +++ b/django_admin_index/locale/nl/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: 3.1.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-02-29 22:25+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/manage.py b/manage.py index 3d9fdbf..b50636e 100644 --- a/manage.py +++ b/manage.py @@ -1,24 +1,17 @@ #!/usr/bin/env python -from __future__ import absolute_import, unicode_literals - import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.proj.settings") + try: from django.core.management import execute_from_command_line - except ImportError: - # The above import may fail for some other reason. Ensure that the - # issue is really that Django is missing to avoid masking other - # exceptions on Python 2. - try: - import django - except ImportError: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) - raise + except ImportError as e: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from e + execute_from_command_line(sys.argv) diff --git a/package-lock.json b/package-lock.json index c078ae5..217e8eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "django-admin-index", - "version": "3.0.0", + "version": "3.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "django-admin-index", - "version": "3.0.0", + "version": "3.1.1", "license": "BSD-3-Clause", "devDependencies": { "@parcel/transformer-sass": "^2.3.2", diff --git a/pyproject.toml b/pyproject.toml index a9e8cdd..b9dd9b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,108 @@ [build-system] -requires = ["setuptools >= 30.3.0"] # version supporting setup.cfg +requires = ["setuptools>=61.0.0"] build-backend = "setuptools.build_meta" + +[project] +name = "django-admin-index" +version = "3.1.1" +description = "Admin index for Django" +authors = [ + {name = "Maykin Media", email = "support@maykinmedia.nl"} +] +readme = "README.rst" +license = {file = "LICENSE"} +keywords = ["Django", "index", "dashboard"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Django", + "Framework :: Django :: 4.2", + "Intended Audience :: Developers", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.10" +dependencies = [ + "django>=4.2", + "django-ordered-model>=3.5", +] + +[project.urls] +Homepage = "https://github.com/maykinmedia/django-admin-index" +"Bug Tracker" = "https://github.com/maykinmedia/django-admin-index/issues" +"Source Code" = "https://github.com/maykinmedia/django-admin-index" +Changelog = "https://github.com/maykinmedia/django-admin-index/blob/main/CHANGELOG.rst" + +[project.optional-dependencies] +tests = [ + "pytest", + "pytest-django", + "tox", + "isort", + "black", + "flake8", +] +coverage = [ + "pytest-cov", +] +docs = [ + "sphinx", + "sphinx-rtd-theme", +] +release = [ + "bump-my-version", +] + +[tool.setuptools.packages.find] +include = ["django_admin_index*"] +namespaces = false + +[tool.isort] +profile = "black" +combine_as_imports = true +known_django = "django" +known_first_party="django_admin_index" +sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] +skip = ["env", ".tox", ".history"] + +[tool.pytest.ini_options] +testpaths = ["tests/unit"] +python_classes = ["test_*"] +DJANGO_SETTINGS_MODULE = "tests.proj.settings" + +[tool.bumpversion] +current_version = "3.1.1" +files = [ + {filename = "pyproject.toml"}, + {filename = "README.rst"}, + {filename = "django_admin_index/locale/nl/LC_MESSAGES/django.po"}, + {filename = "package.json"}, + {filename = "package-lock.json"}, +] + +[tool.coverage.run] +branch = true +source = [ + "django_admin_index" +] +omit = [ + "django_admin_index/migrations/*", +] + +[tool.coverage.report] +exclude_also = [ + "if (typing\\.)?TYPE_CHECKING:", + "@(typing\\.)?overload", + "class .*\\(.*Protocol.*\\):", + "@(abc\\.)?abstractmethod", + "raise NotImplementedError", + "\\.\\.\\.", + "pass", +] +omit = [ + "django_admin_index/migrations/*", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d2ea620..0000000 --- a/setup.cfg +++ /dev/null @@ -1,112 +0,0 @@ -# setuptools config -# see http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files -[metadata] -name = django-admin-index -version = 3.1.1 -description = Admin index for Django -long_description = file: README.rst -url = https://github.com/maykinmedia/django-admin-index -project_urls = - ; Documentation = http://django-admin-index.readthedocs.io/en/latest/ - Changelog = https://github.com/maykinmedia/django-admin-index/blob/master/CHANGELOG.rst - Bug Tracker = https://github.com/maykinmedia/django-admin-index/issues - Source Code = https://github.com/maykinmedia/django-admin-index -license = BSD -author = Joeri Bekker -author_email = joeri@maykinmedia.nl -keywords = django, index, dashboard -classifiers = - Development Status :: 5 - Production/Stable - Framework :: Django - Framework :: Django :: 3.2 - Framework :: Django :: 4.1 - Framework :: Django :: 4.2 - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: Software Development :: Libraries :: Python Modules - -[options] -zip_safe = False -include_package_data = True -packages = find: -install_requires = - django >= 3.2 - django-ordered-model >= 3.5 -tests_require = - pytest - pytest-django - tox - isort - black - -[options.packages.find] -include = - django_admin_index - django_admin_index.* - -[options.extras_require] -tests = - pytest - pytest-django - tox - isort - black -pep8 = flake8 -coverage = pytest-cov -; docs = -; sphinx -; sphinx-rtd-theme -release = - bump2version - twine - -# 3rd party configuration -[aliases] -test=pytest - -[isort] -combine_as_imports = true -default_section = THIRDPARTY -include_trailing_comma = true -line_length = 88 -multi_line_output = 3 -force_grid_wrap = 0 -use_parentheses = True -ensure_newline_before_comments = True -skip = env,.tox,.history,.eggs -known_django=django -known_first_party=django_admin_index -sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER - -[tool:pytest] -testpaths = tests/unit -python_classes = test_* -DJANGO_SETTINGS_MODULE=tests.proj.settings - -[pep8] -[flake8] -max-line-length = 88 -exclude = - env - .tox - doc - **/migrations/* - -[coverage:run] -branch = True -source = django_admin_index -omit = tests/* - -[coverage:report] -skip_covered = 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() diff --git a/tests/unit/test_admin_index.py b/tests/unit/test_admin_index.py index 0298cd1..fda8fc6 100644 --- a/tests/unit/test_admin_index.py +++ b/tests/unit/test_admin_index.py @@ -63,7 +63,7 @@ def test_check_admin_index_app_missing(self): self.assertEqual(len(result), 1) @override_settings(TEMPLATES=[{"OPTIONS": {"context_processors": []}}]) - def test_check_admin_index_context_process_present(self): + def test_check_admin_index_context_process_not_present(self): result = check_admin_index_context_processor([]) self.assertEqual(len(result), 0) diff --git a/tox.ini b/tox.ini index 6a206ee..a4a679f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,24 +1,19 @@ [tox] envlist = - py37-django32 - py{38,39,310}-django{32,41,42} - py311-django{41,42} + py{310,311,312}-django42 isort black + flake8 skip_missing_interpreters = true [gh-actions] python = - 3.7: py37 - 3.8: py38 - 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [gh-actions:env] DJANGO = - 3.2: django32 - 4.1: django41 4.2: django42 [testenv] @@ -29,12 +24,10 @@ extras = tests coverage deps = - django32: Django~=3.2.0 - django41: Django~=4.1.0 django42: Django~=4.2.0 commands = - py.test -v \ + pytest -v \ --cov-report=term \ --cov-report xml:reports/coverage-{envname}.xml \ {posargs} @@ -47,5 +40,9 @@ commands = isort --check-only --diff . [testenv:black] extras = tests skipsdist = True -commands = black --check django_admin_index tests setup.py +commands = black --check django_admin_index tests +[testenv:flake8] +extras = tests +skipsdist = True +commands = flake8 .