Skip to content

Commit

Permalink
Add support for Python 3.12, drop support for Python 3.7, Django 4.1
Browse files Browse the repository at this point in the history
Update actions versions

Switch to `pyproject.toml`

Fix/drop a bunch of outdated things

Run flake8
  • Loading branch information
Viicos committed Jul 24, 2024
1 parent 73d758c commit bac5274
Show file tree
Hide file tree
Showing 14 changed files with 161 additions and 193 deletions.
18 changes: 0 additions & 18 deletions .bumpversion.cfg

This file was deleted.

8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
max-line-length = 88
ignore = E501
exclude =
env
.tox
doc
**/migrations/*
41 changes: 18 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
Expand All @@ -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 }}
7 changes: 4 additions & 3 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion django_admin_index/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion django_admin_index/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 8 additions & 15 deletions manage.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 106 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"}
]
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/*",
]
Loading

0 comments on commit bac5274

Please sign in to comment.