diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd9d7e4d..c852963c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,11 +38,3 @@ repos: hooks: - id: pyupgrade args: [--py38-plus] - - - repo: local - hooks: - - id: pyproject.toml - name: pyproject.toml - language: system - entry: python tools/generate_pyproject.toml.py - files: "pyproject.toml|requirements/.*\\.txt|tools/.*pyproject.*" diff --git a/pyproject.toml b/pyproject.toml index 7e17b148..05137654 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,23 +1,16 @@ -################################################################################ -# DO NOT EDIT -# AUTOGENERATED BY -# -# $ python tools/generate_pyproject.toml.py -# -# EDIT tools/pyproject.toml.in AND RUN THAT SCRIPT. -# -################################################################################ - [build-system] build-backend = 'setuptools.build_meta' -requires = ['setuptools>=61.2'] +requires = ['setuptools>=62.6'] [project] name = 'numpydoc' description = 'Sphinx extension to support docstrings in Numpy format' readme = 'README.rst' requires-python = '>=3.8' -dynamic = ['version'] +dynamic = [ + 'optional-dependencies', + 'version', +] keywords = [ 'sphinx', 'numpy', @@ -52,27 +45,22 @@ file = 'LICENSE.txt' Homepage = 'https://numpydoc.readthedocs.io' Source = 'https://github.com/numpy/numpydoc/' -[project.optional-dependencies] -doc = [ - 'numpy>=1.22', - 'matplotlib>=3.5', - 'pydata-sphinx-theme>=0.13', - 'sphinx>=6', -] -test = [ - 'pytest', - 'pytest-cov', - 'matplotlib', -] - [project.scripts] validate-docstrings = 'numpydoc.hooks.validate_docstrings:main' + [tool.setuptools] include-package-data = false packages = [ 'numpydoc', 'numpydoc.hooks', ] + +[tool.setuptools.dynamic.optional-dependencies.doc] +file = 'requirements/doc.txt' + +[tool.setuptools.dynamic.optional-dependencies.test] +file = 'requirements/test.txt' + [tool.setuptools.dynamic.version] attr = 'numpydoc.__version__' @@ -84,6 +72,7 @@ numpydoc = [ 'tests/tinybuild/*.py', 'templates/*.rst', ] + [tool.pytest.ini_options] addopts = ''' --showlocals --doctest-modules -ra --cov-report= --cov=numpydoc diff --git a/requirements/developer.txt b/requirements/developer.txt index 832c8cbe..ff8f63cc 100644 --- a/requirements/developer.txt +++ b/requirements/developer.txt @@ -1,2 +1 @@ pre-commit>=3.3 -rtoml diff --git a/tools/generate_pyproject.toml.py b/tools/generate_pyproject.toml.py deleted file mode 100755 index bc7d9671..00000000 --- a/tools/generate_pyproject.toml.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python - -import os -import sys - -try: - import rtoml as toml -except ImportError: - print("Please install `rtoml` first: `pip install rtoml`") - sys.exit(1) - - -if not os.path.isfile("pyproject.toml"): - print("Please run this script from the skimage repository root:") - print(" python tools/generate_pyproject.toml.py") - sys.exit(1) - - -def parse_requirements_file(filename): - with open(filename) as fid: - requires = [l.strip() for l in fid.readlines() if not l.startswith("#")] - requires = [l for l in requires if l] - - return requires - - -with open("tools/pyproject.toml.in") as f: - pyproject = toml.load(f) - -# pyproject['project']['dependencies'] = \ -# parse_requirements_file("requirements/default.txt") - -pyproject["project"]["optional-dependencies"] = { - dep: parse_requirements_file(f"requirements/{dep}.txt") for dep in ["doc", "test"] -} - -banner = f"""\ -{"#" * 80} -# DO NOT EDIT -# AUTOGENERATED BY -# -# $ python tools/generate_pyproject.toml.py -# -# EDIT tools/pyproject.toml.in AND RUN THAT SCRIPT. -# -{"#" * 80} - -""" - -with open("pyproject.toml", "w") as f: - f.write(banner) - toml.dump(pyproject, f, pretty=True) diff --git a/tools/pyproject.toml.in b/tools/pyproject.toml.in deleted file mode 100644 index 51d33b64..00000000 --- a/tools/pyproject.toml.in +++ /dev/null @@ -1,71 +0,0 @@ -[build-system] -requires = [ - "setuptools>=61.2", -] -build-backend = "setuptools.build_meta" - -[project] -name = "numpydoc" -description = "Sphinx extension to support docstrings in Numpy format" -license = {file = "LICENSE.txt"} -dynamic = ['version'] -keywords = [ - "sphinx", - "numpy", -] -readme = "README.rst" -classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Plugins", - "License :: OSI Approved :: BSD License", - "Topic :: Documentation", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", -] -requires-python = ">=3.8" -dependencies = [ - "sphinx>=5", - "Jinja2>=2.10", - "tabulate>=0.8.10", - "tomli>=1.1.0;python_version<'3.11'", -] - -[[project.authors]] -name = "Pauli Virtanen and others" -email = "pav@iki.fi" - -[project.urls] -Homepage = "https://numpydoc.readthedocs.io" -Source = "https://github.com/numpy/numpydoc/" - -[project.optional-dependencies] - -[project.scripts] -validate-docstrings = "numpydoc.hooks.validate_docstrings:main" - -[tool.setuptools] -packages = [ - "numpydoc", - "numpydoc.hooks", -] -include-package-data = false - -[tool.setuptools.dynamic] -version = {attr = "numpydoc.__version__"} - -[tool.setuptools.package-data] -numpydoc = [ - "tests/test_*.py", - "tests/tinybuild/Makefile", - "tests/tinybuild/index.rst", - "tests/tinybuild/*.py", - "templates/*.rst", -] - -[tool.pytest.ini_options] -addopts = "--showlocals --doctest-modules -ra --cov-report= --cov=numpydoc\n--junit-xml=junit-results.xml --ignore=doc/ --ignore=tools/" -junit_family = "xunit2"