summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-05-28 10:42:42 -0400
committerJulian Berman <Julian@GrayVines.com>2022-05-28 12:24:45 -0400
commitf61f3b7a73c14409178921bf4ce23050bf90560d (patch)
treef6681db659f242ccddfe11b0fb60f78599470f40
parentf2fb1df342a27fdbfb0c007f2a141115964b3b86 (diff)
downloadjsonschema-f61f3b7a73c14409178921bf4ce23050bf90560d.tar.gz
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/
-rw-r--r--.flake810
-rw-r--r--docs/validate.rst2
-rw-r--r--pyproject.toml97
-rw-r--r--setup.cfg91
-rw-r--r--tox.ini2
5 files changed, 101 insertions, 101 deletions
diff --git a/.flake8 b/.flake8
new file mode 100644
index 0000000..6a6b5cf
--- /dev/null
+++ b/.flake8
@@ -0,0 +1,10 @@
+[flake8]
+ban-relative-imports = true
+inline-quotes = "
+exclude =
+ jsonschema/__init__.py
+ jsonschema/_reflect.py
+ignore =
+ B008, # Barring function calls in default args. Ha, no.
+ B306, # See https://github.com/PyCQA/flake8-bugbear/issues/131
+ W503, # (flake8 default) old PEP8 boolean operator line breaks
diff --git a/docs/validate.rst b/docs/validate.rst
index cda8f35..abb52cb 100644
--- a/docs/validate.rst
+++ b/docs/validate.rst
@@ -205,7 +205,7 @@ to validate. Their names can be viewed by inspecting the
`FormatChecker.checkers` attribute. Certain checkers will only be
available if an appropriate package is available for use. The easiest way to
ensure you have what is needed is to install ``jsonschema`` using the
-``format`` or ``format_nongpl`` setuptools extra -- i.e.
+``format`` or ``format_nongpl`` collection of optional dependencies -- e.g.
.. code-block:: sh
diff --git a/pyproject.toml b/pyproject.toml
index 477d5e6..fc1487b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,16 +1,97 @@
[build-system]
-requires = [
- # The minimum setuptools version is specific to the PEP 517 backend,
- # and may be stricter than the version required in `setup.py`
- "setuptools>=40.6.0",
- "setuptools_scm[toml]>=3.4",
- "wheel",
+requires = ["hatchling", "hatch-vcs"]
+build-backend = "hatchling.build"
+
+[tool.hatch.version]
+source = "vcs"
+
+[project]
+name = "jsonschema"
+description = "An implementation of JSON Schema validation for Python"
+readme = "README.rst"
+requires-python = ">=3.7"
+license = {text = "MIT"}
+keywords = ["validation", "data validation", "jsonschema", "json"]
+authors = [
+ {email = "Julian+jsonschema@GrayVines.com"},
+ {name = "Julian Berman"},
+]
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Programming Language :: Python :: Implementation :: PyPy",
+]
+dynamic = ["version"]
+
+dependencies = [
+ "attrs>=17.4.0",
+ "pyrsistent>=0.14.0,!=0.17.0,!=0.17.1,!=0.17.2",
+
+ "importlib_metadata;python_version<'3.8'",
+ "typing_extensions;python_version<'3.8'",
+ "importlib_resources>=1.4.0;python_version<'3.9'",
+]
+
+[project.optional-dependencies]
+format = [
+ "fqdn",
+ "idna",
+ "isoduration",
+ "jsonpointer>1.13",
+ "rfc3339-validator",
+ "rfc3987",
+ "uri_template",
+ "webcolors>=1.11",
+]
+format_nongpl = [
+ "fqdn",
+ "idna",
+ "isoduration",
+ "jsonpointer>1.13",
+ "rfc3339-validator",
+ "rfc3986-validator>0.1.0",
+ "uri_template",
+ "webcolors>=1.11",
]
-build-backend = "setuptools.build_meta"
+
+[project.scripts]
+jsonschema = "jsonschema.cli:main"
+
+[project.urls]
+homepage = "github.com/python-jsonschema/jsonschema"
+documentation = "python-jsonschema.readthedocs.io/en/latest/"
+issues = "github.com/python-jsonschema/jsonschema/issues/"
+funding = "github.com/sponsors/Julian"
+tidelift = "tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-jsonschema&utm_medium=referral&utm_campaign=pypi-link"
+changelog = "github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst"
+source = "github.com/python-jsonschema/jsonschema"
[tool.isort]
from_first = true
include_trailing_comma = true
multi_line_output = 3
-[tool.setuptools_scm]
+[tool.mypy]
+ignore_missing_imports = true
+
+[tool.pydocstyle]
+match = "(?!(test_|_|compat|cli)).*\\.py" # see PyCQA/pydocstyle#323
+add-select = [
+ "D410", # Trailing whitespace plz
+]
+add-ignore = [
+ "D107", # Hah, no
+ "D200", # 1-line docstrings don't need to be on one line
+ "D202", # One line is fine.
+ "D412", # Trailing whitespace plz
+ "D413", # No trailing whitespace plz
+]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 7571fdf..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,91 +0,0 @@
-[metadata]
-name = jsonschema
-url = https://github.com/python-jsonschema/jsonschema
-project_urls =
- Funding = https://github.com/sponsors/Julian
- Tidelift = https://tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-jsonschema&utm_medium=referral&utm_campaign=pypi-link
- Changelog = https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst
- Documentation = https://python-jsonschema.readthedocs.io/en/latest/
- Source = https://github.com/python-jsonschema/jsonschema
- Issues = https://github.com/python-jsonschema/jsonschema/issues/
-description = An implementation of JSON Schema validation for Python
-long_description = file: README.rst
-long_description_content_type = text/x-rst
-author = Julian Berman
-author_email = Julian@GrayVines.com
-license = MIT
-classifiers =
- Development Status :: 5 - Production/Stable
- Intended Audience :: Developers
- License :: OSI Approved :: MIT License
- Operating System :: OS Independent
- Programming Language :: Python
- Programming Language :: Python :: 3.7
- Programming Language :: Python :: 3.8
- Programming Language :: Python :: 3.9
- Programming Language :: Python :: 3.10
- Programming Language :: Python :: 3.11
- Programming Language :: Python :: Implementation :: CPython
- Programming Language :: Python :: Implementation :: PyPy
-
-[options]
-packages = find:
-python_requires = >=3.7
-install_requires =
- attrs>=17.4.0
- importlib_metadata;python_version<'3.8'
- importlib_resources>=1.4.0;python_version<'3.9'
- pyrsistent>=0.14.0,!=0.17.0,!=0.17.1,!=0.17.2
- typing_extensions;python_version<'3.8'
-
-[options.extras_require]
-format =
- fqdn
- idna
- isoduration
- jsonpointer>1.13
- rfc3339-validator
- rfc3987
- uri_template
- webcolors>=1.11
-format_nongpl =
- fqdn
- idna
- isoduration
- jsonpointer>1.13
- rfc3339-validator
- rfc3986-validator>0.1.0
- uri_template
- webcolors>=1.11
-
-[options.entry_points]
-console_scripts =
- jsonschema = jsonschema.cli:main
-
-[options.package_data]
-jsonschema = schemas/*.json, schemas/*/*.json
-
-[flake8]
-ban-relative-imports = true
-inline-quotes = "
-exclude =
- jsonschema/__init__.py
- jsonschema/_reflect.py
-ignore =
- B008, # Barring function calls in default args. Ha, no.
- B306, # See https://github.com/PyCQA/flake8-bugbear/issues/131
- W503, # (flake8 default) old PEP8 boolean operator line breaks
-
-[mypy]
-ignore_missing_imports = true
-
-[pydocstyle]
-match = (?!(test_|_|compat|cli)).*\.py # see PyCQA/pydocstyle#323
-add-select =
- D410, # Trailing whitespace plz
-add-ignore =
- D107, # Hah, no
- D200, # 1-line docstrings don't need to be on one line
- D202, # One line is fine.
- D412, # Trailing whitespace plz
- D413, # No trailing whitespace plz
diff --git a/tox.ini b/tox.ini
index 93365b7..bc40266 100644
--- a/tox.ini
+++ b/tox.ini
@@ -97,7 +97,7 @@ deps =
pyrsistent
types-attrs
types-requests
-commands = {envpython} -m mypy --config {toxinidir}/setup.cfg {posargs} {toxinidir}/jsonschema
+commands = {envpython} -m mypy --config {toxinidir}/pyproject.toml {posargs} {toxinidir}/jsonschema
[testenv:docs-dirhtml]
commands = {envpython} -m sphinx -b dirhtml {toxinidir}/docs/ {envtmpdir}/build {posargs:-a -n -q -T -W}