Skip to content

Commit

Permalink
Migrate setuptools to use pyproject.toml (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Oct 26, 2023
1 parent f5dcafd commit 6f4f4ef
Show file tree
Hide file tree
Showing 24 changed files with 135 additions and 131 deletions.
9 changes: 0 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ repos:
rev: 1.2.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
args:
- --include-version-classifiers
- --max-py-version
- '3.12'
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.1
hooks:
Expand Down Expand Up @@ -78,4 +70,3 @@ repos:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports
- flake8-typing-imports
28 changes: 9 additions & 19 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
from __future__ import annotations

import datetime
import os
import sys
import tomllib
from pathlib import Path

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# -- Path setup --------------------------------------------------------------

# Get the project root dir, which is the parent dir of this
cwd = os.getcwd()
project_root = os.path.dirname(cwd)

# Insert the project root dir as the first element in the PYTHONPATH.
# This lets us ensure that the source package is imported, and that its
# version is used.
sys.path.insert(0, os.path.join(project_root, "src"))
here = Path(__file__).parent.resolve()
sys.path.insert(0, str(here / ".." / "src"))

# -- General configuration -----------------------------------------------------

Expand Down Expand Up @@ -50,13 +43,10 @@


def _get_version() -> str:
with open(os.path.join(project_root, "setup.cfg")) as setup_fp:
version_lines = [
line.strip() for line in setup_fp if line.startswith("version = ")
]

assert len(version_lines) == 1
return version_lines[0].split(" = ")[1]
with (here / ".." / "pyproject.toml").open("rb") as fp:
data = tomllib.load(fp)
version: str = data["project"]["version"]
return version


version = _get_version()
Expand Down
62 changes: 62 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,51 @@ requires = [
"setuptools",
]

[project]
name = "whitenoise"
version = "6.6.0"
description = "Radically simplified static file serving for WSGI applications"
readme = {file = "README.rst", content-type = "text/x-rst"}
keywords = [
"Django",
]
license = {text = "MIT"}
maintainers = [
{name = "Adam Johnson", email="[email protected]"},
{name = "David Evans"},
]
authors = [{name = "David Evans"}]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware",
"Typing :: Typed",
]
[project.optional-dependencies]
brotli = [
"Brotli",
]
[project.urls]
Changelog = "https://whitenoise.readthedocs.io/en/stable/changelog.html"
Documentation = "https://whitenoise.readthedocs.io/"
Repository = "https://github.com/evansd/whitenoise"

[tool.black]
target-version = ['py38']

Expand All @@ -13,5 +58,22 @@ addopts = """\
--strict-markers
"""

[tool.coverage.run]
branch = true
parallel = true
source = [
"whitenoise",
"tests",
]

[tool.coverage.paths]
source = [
"src",
".tox/**/site-packages",
]

[tool.coverage.report]
show_missing = true

[tool.rstcheck]
report_level = "ERROR"
6 changes: 4 additions & 2 deletions requirements/py310-django32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==3.2.22
# via -r requirements.in
Expand All @@ -39,7 +39,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py310-django40.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.0.10
# via -r requirements.in
Expand All @@ -37,7 +37,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py310-django41.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.1.12
# via -r requirements.in
Expand All @@ -37,7 +37,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py310-django42.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.2.6
# via -r requirements.in
Expand All @@ -37,7 +37,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py310-django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==5.0b1
# via -r requirements.in
Expand All @@ -37,7 +37,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
2 changes: 1 addition & 1 deletion requirements/py311-django41.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.1.12
# via -r requirements.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/py311-django42.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.2.6
# via -r requirements.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/py311-django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==5.0b1
# via -r requirements.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/py312-django42.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.2.6
# via -r requirements.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/py312-django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==5.0b1
# via -r requirements.in
Expand Down
6 changes: 4 additions & 2 deletions requirements/py38-django32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==3.2.22
# via -r requirements.in
Expand Down Expand Up @@ -41,7 +41,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py38-django40.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.0.10
# via -r requirements.in
Expand All @@ -41,7 +41,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py38-django41.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.1.12
# via -r requirements.in
Expand All @@ -41,7 +41,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py38-django42.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==4.2.6
# via -r requirements.in
Expand All @@ -41,7 +41,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
6 changes: 4 additions & 2 deletions requirements/py39-django32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ certifi==2023.7.22
# via requests
charset-normalizer==3.3.1
# via requests
coverage==7.3.2
coverage[toml]==7.3.2
# via -r requirements.in
django==3.2.22
# via -r requirements.in
Expand Down Expand Up @@ -41,7 +41,9 @@ requests==2.31.0
sqlparse==0.4.4
# via django
tomli==2.0.1
# via pytest
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref
urllib3==2.0.7
Expand Down
Loading

0 comments on commit 6f4f4ef

Please sign in to comment.