Skip to content

Commit 602f475

Browse files
authored
Update package metadata (#1690)
* Update package metadata * Update setup.py * Update contributing.rst
1 parent 4c5ac3f commit 602f475

File tree

10 files changed

+115
-98
lines changed

10 files changed

+115
-98
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# TODO: move this to pyproject.toml when supported, see https://github.com/PyCQA/flake8/issues/234
2+
3+
[flake8]
4+
extend-ignore = E203, E501

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install -U pip
26-
python -m pip install -U setuptools twine wheel
26+
python -m pip install -U build hatchling
2727
2828
- name: Build package
2929
run: |
30-
python setup.py --version
31-
python setup.py sdist --format=gztar bdist_wheel
30+
hatchling version
31+
python -m build
3232
twine check dist/*
3333
3434
- name: Upload packages to Jazzband
3535
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
36-
uses: pypa/gh-action-pypi-publish@master
36+
uses: pypa/gh-action-pypi-publish@release/v1
3737
with:
3838
user: jazzband
3939
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
with:
4848
path: ${{ steps.pip-cache.outputs.dir }}
4949
key:
50-
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }}
50+
${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }}
5151
restore-keys: |
5252
${{ matrix.python-version }}-v1-
5353
@@ -118,7 +118,7 @@ jobs:
118118
with:
119119
path: ${{ steps.pip-cache.outputs.dir }}
120120
key:
121-
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }}
121+
${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }}
122122
restore-keys: |
123123
${{ matrix.python-version }}-v1-
124124
@@ -171,7 +171,7 @@ jobs:
171171
with:
172172
path: ${{ steps.pip-cache.outputs.dir }}
173173
key:
174-
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }}
174+
${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }}
175175
restore-keys: |
176176
${{ matrix.python-version }}-v1-
177177
@@ -203,7 +203,7 @@ jobs:
203203
# Use latest, so it understands all syntax.
204204
python-version: "3.10"
205205

206-
- run: python -m pip install --upgrade coverage
206+
- run: python -m pip install --upgrade coverage[toml]
207207

208208
- name: Download coverage data.
209209
uses: actions/download-artifact@v3
@@ -246,7 +246,7 @@ jobs:
246246
with:
247247
path: ${{ steps.pip-cache.outputs.dir }}
248248
key:
249-
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }}
249+
${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }}
250250
restore-keys: |
251251
${{ matrix.python-version }}-v1-
252252

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/contributing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ The release itself requires the following steps:
152152

153153
#. Update supported Python and Django versions:
154154

155-
- ``setup.cfg`` ``python_requires`` and ``install_requires`` options
156-
- ``setup.cfg`` trove classifiers
155+
- ``pyproject.toml`` options ``requires-python``, ``dependencies``,
156+
and ``classifiers``
157157
- ``README.rst``
158158

159159
Commit.
@@ -167,12 +167,12 @@ The release itself requires the following steps:
167167
Commit.
168168

169169
#. Bump version numbers in ``docs/changes.rst``, ``docs/conf.py``,
170-
``README.rst``, ``debug_toolbar/__init__.py`` and ``setup.cfg``.
170+
``README.rst``, and ``debug_toolbar/__init__.py``.
171171
Add the release date to ``docs/changes.rst``. Commit.
172172

173173
#. Tag the new version.
174174

175-
#. ``python setup.py sdist bdist_wheel upload``.
175+
#. ``tox -e packaging``.
176176

177177
#. Push the commit and the tag.
178178

pyproject.toml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "django-debug-toolbar"
7+
dynamic = ["version"]
8+
description = "A configurable set of panels that display various debug information about the current request/response."
9+
readme = "README.rst"
10+
license = "BSD-3-Clause"
11+
requires-python = ">=3.7"
12+
authors = [
13+
{ name = "Rob Hudson", email = "[email protected]" },
14+
]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Environment :: Web Environment",
18+
"Framework :: Django",
19+
"Framework :: Django :: 3.2",
20+
"Framework :: Django :: 4.0",
21+
"Framework :: Django :: 4.1",
22+
"Intended Audience :: Developers",
23+
"License :: OSI Approved :: BSD License",
24+
"Operating System :: OS Independent",
25+
"Programming Language :: Python",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3 :: Only",
28+
"Programming Language :: Python :: 3.7",
29+
"Programming Language :: Python :: 3.8",
30+
"Programming Language :: Python :: 3.9",
31+
"Programming Language :: Python :: 3.10",
32+
"Topic :: Software Development :: Libraries :: Python Modules",
33+
]
34+
dependencies = [
35+
"Django >= 3.2.4",
36+
"sqlparse >= 0.2.0",
37+
]
38+
39+
[project.urls]
40+
Download = "https://pypi.org/project/django-debug-toolbar/"
41+
Homepage = "https://github.com/jazzband/django-debug-toolbar"
42+
43+
[tool.hatch.version]
44+
path = "debug_toolbar/__init__.py"
45+
46+
[tool.hatch.build.targets.wheel]
47+
packages = ["debug_toolbar"]
48+
49+
[tool.hatch.build.targets.sdist]
50+
include = [
51+
"/debug_toolbar",
52+
"/CONTRIBUTING.md",
53+
]
54+
55+
[tool.isort]
56+
combine_as_imports = true
57+
profile = "black"
58+
59+
[tool.coverage.run]
60+
branch = true
61+
parallel = true
62+
source = ["debug_toolbar"]
63+
64+
[tool.coverage.paths]
65+
source = ["src", ".tox/*/site-packages"]
66+
67+
[tool.coverage.report]
68+
# Update coverage badge link in README.rst when fail_under changes
69+
fail_under = 93
70+
show_missing = true
71+
72+
[tool.coverage.html]
73+
skip_covered = true
74+
skip_empty = true

requirements_dev.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Jinja2
66

77
# Testing
88

9-
coverage
9+
coverage[toml]
1010
flake8
1111
html5lib
1212
isort
@@ -23,4 +23,3 @@ sphinxcontrib-spelling
2323

2424
pre-commit
2525
transifex-client
26-
wheel

setup.cfg

Lines changed: 0 additions & 72 deletions
This file was deleted.

setup.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
#!/usr/bin/env python3
22

3+
import sys
4+
35
from setuptools import setup
46

5-
setup()
7+
sys.stderr.write(
8+
"""\
9+
===============================
10+
Unsupported installation method
11+
===============================
12+
This project no longer supports installation with `python setup.py install`.
13+
Please use `python -m pip install .` instead.
14+
"""
15+
)
16+
sys.exit(1)
17+
18+
# The code below will never execute, however is required to
19+
# display the "Used by" section on the GitHub repository.
20+
#
21+
# See: https://github.com/github/feedback/discussions/6456
22+
23+
setup(name="django-debug-toolbar")

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[tox]
2+
isolated_build = true
23
envlist =
34
docs
45
packaging
@@ -15,7 +16,7 @@ deps =
1516
postgis: psycopg2-binary
1617
mysql: mysqlclient
1718
djmain: https://github.com/django/django/archive/main.tar.gz
18-
coverage
19+
coverage[toml]
1920
Jinja2
2021
html5lib
2122
pygments
@@ -77,12 +78,11 @@ deps =
7778

7879
[testenv:packaging]
7980
commands =
80-
python setup.py sdist bdist_wheel
81+
python -m build
8182
twine check --strict dist/*
8283
deps =
83-
readme_renderer
84+
build
8485
twine
85-
wheel
8686
skip_install = true
8787

8888
[gh-actions]

0 commit comments

Comments
 (0)