PEP 621: Migrate from setup.py to pyproject.toml

This commit is contained in:
Christian Clauss 2024-11-08 20:44:03 +01:00
parent 7f0f29d161
commit 38bda60f52
4 changed files with 73 additions and 89 deletions

58
pyproject.toml Normal file
View file

@ -0,0 +1,58 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=61.2",
"setuptools-scm",
]
[project]
name = "django-configurations"
description = "A helper for organizing Django settings."
readme.content-type = "text/x-rst"
readme.file = "README.rst"
license = { text = "BSD" }
authors = [ { name = "Jannis Leidel", email = "jannis@leidel.info" } ]
requires-python = ">=3.9,<4.0"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Utilities",
]
dynamic = [ "version" ]
dependencies = [ "django>=3.2" ]
optional-dependencies.cache = [ "django-cache-url" ]
optional-dependencies.database = [ "dj-database-url" ]
optional-dependencies.email = [ "dj-email-url" ]
optional-dependencies.search = [ "dj-search-url" ]
optional-dependencies.testing = [
"dj-database-url",
"dj-email-url",
"dj-search-url",
"django-cache-url>=1",
]
urls.Homepage = "https://django-configurations.readthedocs.io/"
urls.Source = "https://github.com/jazzband/django-configurations"
scripts.django-cadmin = "configurations.management:execute_from_command_line"
[tool.setuptools]
packages = [ "configurations" ]
zip-safe = false
include-package-data = false

View file

@ -1,10 +0,0 @@
[coverage:run]
source = .
branch = 1
parallel = 1
[coverage:report]
include = configurations/*,tests/*
[flake8]
exclude = .tox,docs/*,.eggs
ignore = E501,E127,E128,E124,W503

View file

@ -1,71 +0,0 @@
import os
import codecs
from setuptools import setup
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
setup(
name="django-configurations",
use_scm_version={"version_scheme": "post-release", "local_scheme": "dirty-tag"},
setup_requires=["setuptools_scm"],
url='https://django-configurations.readthedocs.io/',
project_urls={
'Source': 'https://github.com/jazzband/django-configurations',
},
license='BSD',
description="A helper for organizing Django settings.",
long_description=read('README.rst'),
long_description_content_type='text/x-rst',
author='Jannis Leidel',
author_email='jannis@leidel.info',
packages=['configurations'],
entry_points={
'console_scripts': [
'django-cadmin = configurations.management:execute_from_command_line',
],
},
install_requires=[
'django>=3.2',
],
python_requires='>=3.9, <4.0',
extras_require={
'cache': ['django-cache-url'],
'database': ['dj-database-url'],
'email': ['dj-email-url'],
'search': ['dj-search-url'],
'testing': [
'django-cache-url>=1.0.0',
'dj-database-url',
'dj-email-url',
'dj-search-url',
],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django :: 5.1',
'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.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Utilities',
],
zip_safe=False,
)

23
tox.ini
View file

@ -1,5 +1,7 @@
[tox]
skipsdist = true
skip_missing_interpreters = true
isolated_build = true
usedevelop = true
minversion = 1.8
envlist =
@ -25,7 +27,7 @@ usedevelop = true
setenv =
DJANGO_SETTINGS_MODULE = tests.settings.main
DJANGO_CONFIGURATION = Test
COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml
deps =
dj32: django~=3.2.9
dj41: django~=4.1.3
@ -44,16 +46,17 @@ commands =
python --version
{envbindir}/coverage run {envbindir}/django-cadmin test -v2 {posargs:tests}
coverage combine . tests docs
coverage report -m --skip-covered
coverage report --show-missing --skip-covered
coverage xml
[testenv:py311-checkqa]
commands =
flake8 {toxinidir}
check-manifest -v
python setup.py sdist
check-manifest --verbose
python -m build
twine check dist/*
deps =
build
flake8
twine
check-manifest
@ -64,9 +67,13 @@ deps =
-r docs/requirements.txt
commands =
sphinx-build \
-b html \
-a \
-W \
-n \
--builder html \
--write-all \
--fail-on-warning \
--nitpicky \
docs \
docs/_build/html
[flake8]
exclude = .tox,docs/*,.eggs
ignore = E124,E127,E128,E501,W503