Skip to content

Commit b559e5f

Browse files
Merge pull request #92 from maykinmedia/pyproject
Switch to `pyproject.toml`, update versions
2 parents 73d758c + bac5274 commit b559e5f

File tree

14 files changed

+161
-193
lines changed

14 files changed

+161
-193
lines changed

.bumpversion.cfg

-18
This file was deleted.

.flake8

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[flake8]
2+
max-line-length = 88
3+
ignore = E501
4+
exclude =
5+
env
6+
.tox
7+
doc
8+
**/migrations/*

.github/workflows/ci.yml

+18-23
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,14 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
18-
django: ['3.2', '4.1', '4.2']
19-
exclude:
20-
- python: '3.7'
21-
django: '4.1'
22-
- python: '3.7'
23-
django: '4.2'
24-
- python: '3.11'
25-
django: '3.2'
17+
python: ['3.10', '3.11', '3.12']
18+
django: ['4.2']
2619

2720
name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})
2821

2922
steps:
30-
- uses: actions/checkout@v3
31-
- uses: actions/setup-python@v4
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-python@v5
3225
with:
3326
python-version: ${{ matrix.python }}
3427

@@ -42,15 +35,17 @@ jobs:
4235
DJANGO: ${{ matrix.django }}
4336

4437
- name: Publish coverage report
45-
uses: codecov/codecov-action@v3
38+
uses: codecov/codecov-action@v4
39+
with:
40+
token: ${{ secrets.CODECOV_TOKEN }}
4641

4742
styles:
4843
name: Build sass into CSS
4944
runs-on: ubuntu-latest
5045

5146
steps:
52-
- uses: actions/checkout@v3
53-
- uses: actions/setup-node@v3
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-node@v4
5449
with:
5550
node-version-file: '.nvmrc'
5651
- name: Install dependencies
@@ -62,22 +57,22 @@ jobs:
6257
name: Publish package to PyPI
6358
runs-on: ubuntu-latest
6459
needs: tests
60+
environment: release
61+
permissions:
62+
id-token: write
6563

6664
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
6765

6866
steps:
69-
- uses: actions/checkout@v3
70-
- uses: actions/setup-python@v4
67+
- uses: actions/checkout@v4
68+
- uses: actions/setup-python@v5
7169
with:
72-
python-version: '3.9'
70+
python-version: '3.10'
7371

74-
- name: Build sdist and wheel
72+
- name: Build wheel
7573
run: |
76-
pip install pip setuptools wheel --upgrade
77-
python setup.py sdist bdist_wheel
74+
pip install build --upgrade
75+
python -m build
7876
7977
- name: Publish a Python distribution to PyPI
8078
uses: pypa/gh-action-pypi-publish@release/v1
81-
with:
82-
user: ${{ secrets.PYPI_USERNAME }}
83-
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/code_quality.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ jobs:
2323
toxenv:
2424
- isort
2525
- black
26+
- flake8
2627
steps:
27-
- uses: actions/checkout@v2
28-
- uses: actions/setup-python@v2
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-python@v5
2930
with:
30-
python-version: '3.9'
31+
python-version: '3.10'
3132
- name: Install dependencies
3233
run: pip install tox
3334
- run: tox

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Admin Index for Django
33
======================
44

55
:Version: 3.1.1
6-
:Download: https://pypi.python.org/pypi/django-admin-index
6+
:Download: https://pypi.org/project/django-admin-index/
77
:Source: https://github.com/maykinmedia/django-admin-index
88
:Keywords: django, admin, dashboard
99

django_admin_index/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# :copyright: (c) 2017, Maykin Media BV.
22
# All rights reserved.
33
# :license: BSD (3 Clause), see LICENSE for more details.
4-
__version__ = "3.1.1"
4+
from importlib.metadata import version
5+
6+
__version__ = version("django-admin-index")
57
__author__ = "Joeri Bekker"

django_admin_index/locale/nl/LC_MESSAGES/django.po

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#, fuzzy
77
msgid ""
88
msgstr ""
9-
"Project-Id-Version: PACKAGE VERSION\n"
9+
"Project-Id-Version: 3.1.1\n"
1010
"Report-Msgid-Bugs-To: \n"
1111
"POT-Creation-Date: 2024-02-29 22:25+0100\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

manage.py

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
#!/usr/bin/env python
2-
from __future__ import absolute_import, unicode_literals
3-
42
import os
53
import sys
64

75
if __name__ == "__main__":
86
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.proj.settings")
7+
98
try:
109
from django.core.management import execute_from_command_line
11-
except ImportError:
12-
# The above import may fail for some other reason. Ensure that the
13-
# issue is really that Django is missing to avoid masking other
14-
# exceptions on Python 2.
15-
try:
16-
import django
17-
except ImportError:
18-
raise ImportError(
19-
"Couldn't import Django. Are you sure it's installed and "
20-
"available on your PYTHONPATH environment variable? Did you "
21-
"forget to activate a virtual environment?"
22-
)
23-
raise
10+
except ImportError as e:
11+
raise ImportError(
12+
"Couldn't import Django. Are you sure it's installed and "
13+
"available on your PYTHONPATH environment variable? Did you "
14+
"forget to activate a virtual environment?"
15+
) from e
16+
2417
execute_from_command_line(sys.argv)

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+106-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,108 @@
11
[build-system]
2-
requires = ["setuptools >= 30.3.0"] # version supporting setup.cfg
2+
requires = ["setuptools>=61.0.0"]
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "django-admin-index"
7+
version = "3.1.1"
8+
description = "Admin index for Django"
9+
authors = [
10+
{name = "Maykin Media", email = "[email protected]"}
11+
]
12+
readme = "README.rst"
13+
license = {file = "LICENSE"}
14+
keywords = ["Django", "index", "dashboard"]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Framework :: Django",
18+
"Framework :: Django :: 4.2",
19+
"Intended Audience :: Developers",
20+
"Operating System :: Unix",
21+
"Operating System :: MacOS",
22+
"Operating System :: Microsoft :: Windows",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Topic :: Software Development :: Libraries :: Python Modules",
27+
]
28+
requires-python = ">=3.10"
29+
dependencies = [
30+
"django>=4.2",
31+
"django-ordered-model>=3.5",
32+
]
33+
34+
[project.urls]
35+
Homepage = "https://github.com/maykinmedia/django-admin-index"
36+
"Bug Tracker" = "https://github.com/maykinmedia/django-admin-index/issues"
37+
"Source Code" = "https://github.com/maykinmedia/django-admin-index"
38+
Changelog = "https://github.com/maykinmedia/django-admin-index/blob/main/CHANGELOG.rst"
39+
40+
[project.optional-dependencies]
41+
tests = [
42+
"pytest",
43+
"pytest-django",
44+
"tox",
45+
"isort",
46+
"black",
47+
"flake8",
48+
]
49+
coverage = [
50+
"pytest-cov",
51+
]
52+
docs = [
53+
"sphinx",
54+
"sphinx-rtd-theme",
55+
]
56+
release = [
57+
"bump-my-version",
58+
]
59+
60+
[tool.setuptools.packages.find]
61+
include = ["django_admin_index*"]
62+
namespaces = false
63+
64+
[tool.isort]
65+
profile = "black"
66+
combine_as_imports = true
67+
known_django = "django"
68+
known_first_party="django_admin_index"
69+
sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
70+
skip = ["env", ".tox", ".history"]
71+
72+
[tool.pytest.ini_options]
73+
testpaths = ["tests/unit"]
74+
python_classes = ["test_*"]
75+
DJANGO_SETTINGS_MODULE = "tests.proj.settings"
76+
77+
[tool.bumpversion]
78+
current_version = "3.1.1"
79+
files = [
80+
{filename = "pyproject.toml"},
81+
{filename = "README.rst"},
82+
{filename = "django_admin_index/locale/nl/LC_MESSAGES/django.po"},
83+
{filename = "package.json"},
84+
{filename = "package-lock.json"},
85+
]
86+
87+
[tool.coverage.run]
88+
branch = true
89+
source = [
90+
"django_admin_index"
91+
]
92+
omit = [
93+
"django_admin_index/migrations/*",
94+
]
95+
96+
[tool.coverage.report]
97+
exclude_also = [
98+
"if (typing\\.)?TYPE_CHECKING:",
99+
"@(typing\\.)?overload",
100+
"class .*\\(.*Protocol.*\\):",
101+
"@(abc\\.)?abstractmethod",
102+
"raise NotImplementedError",
103+
"\\.\\.\\.",
104+
"pass",
105+
]
106+
omit = [
107+
"django_admin_index/migrations/*",
108+
]

0 commit comments

Comments
 (0)