Skip to content

Commit f61f3b7

Browse files
committed
Modernize the packaging setup via PEP 621 and Hatch.
Doing so jettisons setuptools in favor of a more modern, well-designed, legacy-free, and now well-supported packaging tool, Hatch. No end-user facing behavior changes are expected for any users using a recent packaging setup (within the past 2-3 years), so please report any issues. Hatch: https://hatch.pypa.io/latest/ PEP 621: https://peps.python.org/pep-0621/
1 parent f2fb1df commit f61f3b7

File tree

5 files changed

+101
-101
lines changed

5 files changed

+101
-101
lines changed

.flake8

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[flake8]
2+
ban-relative-imports = true
3+
inline-quotes = "
4+
exclude =
5+
jsonschema/__init__.py
6+
jsonschema/_reflect.py
7+
ignore =
8+
B008, # Barring function calls in default args. Ha, no.
9+
B306, # See https://github.com/PyCQA/flake8-bugbear/issues/131
10+
W503, # (flake8 default) old PEP8 boolean operator line breaks

docs/validate.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ to validate. Their names can be viewed by inspecting the
205205
`FormatChecker.checkers` attribute. Certain checkers will only be
206206
available if an appropriate package is available for use. The easiest way to
207207
ensure you have what is needed is to install ``jsonschema`` using the
208-
``format`` or ``format_nongpl`` setuptools extra -- i.e.
208+
``format`` or ``format_nongpl`` collection of optional dependencies -- e.g.
209209

210210
.. code-block:: sh
211211

pyproject.toml

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,97 @@
11
[build-system]
2-
requires = [
3-
# The minimum setuptools version is specific to the PEP 517 backend,
4-
# and may be stricter than the version required in `setup.py`
5-
"setuptools>=40.6.0",
6-
"setuptools_scm[toml]>=3.4",
7-
"wheel",
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
4+
5+
[tool.hatch.version]
6+
source = "vcs"
7+
8+
[project]
9+
name = "jsonschema"
10+
description = "An implementation of JSON Schema validation for Python"
11+
readme = "README.rst"
12+
requires-python = ">=3.7"
13+
license = {text = "MIT"}
14+
keywords = ["validation", "data validation", "jsonschema", "json"]
15+
authors = [
16+
{email = "[email protected]"},
17+
{name = "Julian Berman"},
18+
]
19+
classifiers = [
20+
"Development Status :: 5 - Production/Stable",
21+
"Intended Audience :: Developers",
22+
"License :: OSI Approved :: MIT License",
23+
"Operating System :: OS Independent",
24+
"Programming Language :: Python",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: Implementation :: CPython",
31+
"Programming Language :: Python :: Implementation :: PyPy",
32+
]
33+
dynamic = ["version"]
34+
35+
dependencies = [
36+
"attrs>=17.4.0",
37+
"pyrsistent>=0.14.0,!=0.17.0,!=0.17.1,!=0.17.2",
38+
39+
"importlib_metadata;python_version<'3.8'",
40+
"typing_extensions;python_version<'3.8'",
41+
"importlib_resources>=1.4.0;python_version<'3.9'",
42+
]
43+
44+
[project.optional-dependencies]
45+
format = [
46+
"fqdn",
47+
"idna",
48+
"isoduration",
49+
"jsonpointer>1.13",
50+
"rfc3339-validator",
51+
"rfc3987",
52+
"uri_template",
53+
"webcolors>=1.11",
54+
]
55+
format_nongpl = [
56+
"fqdn",
57+
"idna",
58+
"isoduration",
59+
"jsonpointer>1.13",
60+
"rfc3339-validator",
61+
"rfc3986-validator>0.1.0",
62+
"uri_template",
63+
"webcolors>=1.11",
864
]
9-
build-backend = "setuptools.build_meta"
65+
66+
[project.scripts]
67+
jsonschema = "jsonschema.cli:main"
68+
69+
[project.urls]
70+
homepage = "github.com/python-jsonschema/jsonschema"
71+
documentation = "python-jsonschema.readthedocs.io/en/latest/"
72+
issues = "github.com/python-jsonschema/jsonschema/issues/"
73+
funding = "github.com/sponsors/Julian"
74+
tidelift = "tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-jsonschema&utm_medium=referral&utm_campaign=pypi-link"
75+
changelog = "github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst"
76+
source = "github.com/python-jsonschema/jsonschema"
1077

1178
[tool.isort]
1279
from_first = true
1380
include_trailing_comma = true
1481
multi_line_output = 3
1582

16-
[tool.setuptools_scm]
83+
[tool.mypy]
84+
ignore_missing_imports = true
85+
86+
[tool.pydocstyle]
87+
match = "(?!(test_|_|compat|cli)).*\\.py" # see PyCQA/pydocstyle#323
88+
add-select = [
89+
"D410", # Trailing whitespace plz
90+
]
91+
add-ignore = [
92+
"D107", # Hah, no
93+
"D200", # 1-line docstrings don't need to be on one line
94+
"D202", # One line is fine.
95+
"D412", # Trailing whitespace plz
96+
"D413", # No trailing whitespace plz
97+
]

setup.cfg

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

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ deps =
9797
pyrsistent
9898
types-attrs
9999
types-requests
100-
commands = {envpython} -m mypy --config {toxinidir}/setup.cfg {posargs} {toxinidir}/jsonschema
100+
commands = {envpython} -m mypy --config {toxinidir}/pyproject.toml {posargs} {toxinidir}/jsonschema
101101

102102
[testenv:docs-dirhtml]
103103
commands = {envpython} -m sphinx -b dirhtml {toxinidir}/docs/ {envtmpdir}/build {posargs:-a -n -q -T -W}

0 commit comments

Comments
 (0)