diff --git a/.circleci/config.yml b/.circleci/config.yml index 66a60c8d..98cae9bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ jobs: python3 -m venv venv source venv/bin/activate python -m pip install --upgrade pip wheel setuptools - python -m pip install --upgrade -r requirements/doc.txt + python -m pip install --upgrade --group doc python -m pip list - save_cache: key: pip-cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8db3074c..b6c46a46 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,7 @@ jobs: - name: Install run: | - python -m pip install .[test,doc] + python -m pip install . --group test --group doc pip list - name: Run test suite @@ -95,7 +95,7 @@ jobs: - name: Install run: | - python -m pip install .[test,doc] + python -m pip install . --group test --group doc pip list - name: Run test suite diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8e4d289d..1fa15182 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,14 +31,6 @@ repos: args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"] - id: ruff-format - - repo: local - hooks: - - id: generate_requirements.py - name: generate_requirements.py - language: system - entry: python tools/generate_requirements.py - files: "pyproject.toml|requirements/.*\\.txt|tools/generate_requirements.py" - ci: autofix_prs: false autofix_commit_msg: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 252fca8e..ebc00e82 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -13,22 +13,15 @@ build: # nodejs: "19" # rust: "1.64" # golang: "1.19" + jobs: + install: + - python -m pip install --upgrade pip wheel setuptools + - python -m pip install . --group doc # Build documentation in the "doc/" directory with Sphinx sphinx: configuration: doc/conf.py - # Optionally build your docs in additional formats such as PDF and ePub # formats: # - pdf # - epub - -# Optional but recommended, declare the Python requirements required -# to build your documentation -# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html -python: - install: - - method: pip - path: . - extra_requirements: - - doc diff --git a/MANIFEST.in b/MANIFEST.in index d1508eee..0a6df3ac 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,6 @@ include MANIFEST.in include *.txt include *.rst recursive-include doc * -recursive-include requirements * recursive-include numpydoc * # Exclude what we don't want to include diff --git a/pyproject.toml b/pyproject.toml index 53458910..b6acaa4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,10 +43,12 @@ file = 'LICENSE.txt' Homepage = 'https://numpydoc.readthedocs.io' Source = 'https://github.com/numpy/numpydoc/' -[project.optional-dependencies] -developer = [ +[dependency-groups] +dev = [ 'pre-commit>=3.3', "tomli; python_version < '3.11'", + { include-group = "doc" }, + { include-group = "test" } ] doc = [ 'numpy>=1.22', diff --git a/requirements/default.txt b/requirements/default.txt deleted file mode 100644 index dfe792ef..00000000 --- a/requirements/default.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -sphinx>=6 -tomli>=1.1.0;python_version<'3.11' diff --git a/requirements/developer.txt b/requirements/developer.txt deleted file mode 100644 index dbeefe57..00000000 --- a/requirements/developer.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -pre-commit>=3.3 -tomli; python_version < '3.11' diff --git a/requirements/doc.txt b/requirements/doc.txt deleted file mode 100644 index 950966b6..00000000 --- a/requirements/doc.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -numpy>=1.22 -matplotlib>=3.5 -pydata-sphinx-theme>=0.13.3 -sphinx>=7 -intersphinx_registry diff --git a/requirements/test.txt b/requirements/test.txt deleted file mode 100644 index 2a9e670f..00000000 --- a/requirements/test.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -pytest -pytest-cov -matplotlib diff --git a/tools/generate_requirements.py b/tools/generate_requirements.py deleted file mode 100755 index 388d2ccc..00000000 --- a/tools/generate_requirements.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -"""Generate requirements/*.txt files from pyproject.toml.""" - -import sys -from pathlib import Path - -try: # standard module since Python 3.11 - import tomllib as toml -except ImportError: - try: # available for older Python via pip - import tomli as toml - except ImportError: - sys.exit("Please install `tomli` first: `pip install tomli`") - -script_pth = Path(__file__) -repo_dir = script_pth.parent.parent -script_relpth = script_pth.relative_to(repo_dir) -header = [ - f"# Generated via {script_relpth.as_posix()} and pre-commit hook.", - "# Do not edit this file; modify pyproject.toml instead.", -] - - -def generate_requirement_file(name: str, req_list: list[str]) -> None: - req_fname = repo_dir / "requirements" / f"{name}.txt" - req_fname.write_text("\n".join(header + req_list) + "\n") - - -def main() -> None: - pyproject = toml.loads((repo_dir / "pyproject.toml").read_text()) - - generate_requirement_file("default", pyproject["project"]["dependencies"]) - - for key, opt_list in pyproject["project"]["optional-dependencies"].items(): - generate_requirement_file(key, opt_list) - - -if __name__ == "__main__": - main()