Skip to content

Commit 910e40a

Browse files
committed
Switch to pyproject.toml
Fix/drop a bunch of outdated things
1 parent 94fbf25 commit 910e40a

File tree

12 files changed

+144
-161
lines changed

12 files changed

+144
-161
lines changed

.bumpversion.cfg

-18
This file was deleted.

.flake8

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

.github/workflows/ci.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,10 @@ jobs:
6969
with:
7070
python-version: "3.10"
7171

72-
- name: Build sdist and wheel
72+
- name: Build wheel
7373
run: |
74-
pip install pip setuptools wheel --upgrade
75-
python setup.py sdist bdist_wheel
74+
pip install build --upgrade
75+
python -m build
7676
7777
- name: Publish a Python distribution to PyPI
7878
uses: pypa/gh-action-pypi-publish@release/v1
79-
with:
80-
user: ${{ secrets.PYPI_USERNAME }}
81-
password: ${{ secrets.PYPI_TOKEN }}

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

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

setup.cfg

-111
This file was deleted.

setup.py

-3
This file was deleted.

tox.ini

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ envlist =
55
py311-django{41,42}
66
isort
77
black
8+
flake8
89
skip_missing_interpreters = true
910

1011
[gh-actions]
@@ -34,7 +35,7 @@ deps =
3435
django42: Django~=4.2.0
3536

3637
commands =
37-
py.test -v \
38+
pytest -v \
3839
--cov-report=term \
3940
--cov-report xml:reports/coverage-{envname}.xml \
4041
{posargs}
@@ -47,5 +48,9 @@ commands = isort --check-only --diff .
4748
[testenv:black]
4849
extras = tests
4950
skipsdist = True
50-
commands = black --check django_admin_index tests setup.py
51+
commands = black --check django_admin_index tests
5152

53+
[testenv:flake8]
54+
extras = tests
55+
skipsdist = True
56+
commands = flake8 .

0 commit comments

Comments
 (0)