diff --git a/.github/workflows/builddoc.yml b/.github/workflows/builddoc.yml index 7f8471deecb..f785da70482 100644 --- a/.github/workflows/builddoc.yml +++ b/.github/workflows/builddoc.yml @@ -36,7 +36,9 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install .[docs] + run: | + uv pip install --group docs + uv pip install . - name: Render the documentation run: > sphinx-build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c8444c6a14f..86817e34423 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -60,7 +60,7 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install ".[lint,test]" + run: uv pip install --group types - name: Type check with mypy run: mypy @@ -81,7 +81,7 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install ".[lint,test]" + run: uv pip install --group types - name: Type check with pyright run: pyright @@ -102,7 +102,7 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install --upgrade sphinx-lint + run: uv pip install --group lint - name: Lint documentation with sphinx-lint run: make doclinter diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4b3b3283536..bebdb382da9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,7 +63,9 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install .[test] + run: | + uv pip install --group test + uv pip install . - name: Install Docutils ${{ matrix.docutils }} run: uv pip install --upgrade "docutils~=${{ matrix.docutils }}.0" - name: Test with pytest @@ -202,7 +204,9 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install .[test] + run: | + uv pip install --group test + uv pip install . - name: Test with pytest run: python -m pytest -vv --durations 25 env: @@ -237,7 +241,9 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install .[test] + run: | + uv pip install --group test + uv pip install . - name: Install Docutils' HEAD run: uv pip install "docutils @ git+https://repo.or.cz/docutils.git#subdirectory=docutils" - name: Test with pytest @@ -271,7 +277,8 @@ jobs: enable-cache: false - name: Install dependencies run: | - uv pip install .[test] --resolution lowest-direct + uv pip install --group test + uv pip install . --resolution lowest-direct uv pip install alabaster==1.0.0 - name: Test with pytest run: python -m pytest -vv --durations 25 @@ -301,7 +308,9 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install .[test] + run: | + uv pip install --group test + uv pip install . - name: Test with pytest run: python -m pytest -vv --durations 25 env: @@ -332,7 +341,10 @@ jobs: version: latest enable-cache: false - name: Install dependencies - run: uv pip install .[test] pytest-cov + run: | + uv pip install --group test + uv pip install pytest-cov + uv pip install . - name: Test with pytest run: python -m pytest -vv --cov . --cov-append --cov-config pyproject.toml env: diff --git a/pyproject.toml b/pyproject.toml index 4debbde3fa6..8a04b8d0735 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,13 +77,48 @@ dependencies = [ dynamic = ["version"] [project.optional-dependencies] +docs = [] +lint = [] +test = [] + +[[project.authors]] +name = "Georg Brandl" +email = "georg@python.org" + +[project.scripts] +sphinx-build = "sphinx.cmd.build:main" +sphinx-quickstart = "sphinx.cmd.quickstart:main" +sphinx-apidoc = "sphinx.ext.apidoc:main" +sphinx-autogen = "sphinx.ext.autosummary.generate:main" + +[dependency-groups] +all = [ + { include-group = "docs" }, + { include-group = "lint" }, + { include-group = "test" }, + { include-group = "types" }, +] docs = [ "sphinxcontrib-websupport", ] lint = [ "ruff==0.9.2", - "mypy==1.14.1", "sphinx-lint>=0.9", +] +test = [ + "pytest>=8.0", + "defusedxml>=0.7.1", # for secure XML/HTML parsing + "cython>=3.0", + "setuptools>=70.0", # for Cython compilation + "typing_extensions>=4.9", # for test_restify_Unpack +] +types = [ + "mypy==1.14.1", + "pyright==1.1.392.post0", + "pytest>=8.0", # for mypy + { include-group = "type-stubs" }, +] +type-stubs = [ "types-colorama==0.4.15.20240311", "types-defusedxml==0.7.0.20240218", "types-docutils==0.21.0.20241128", @@ -91,27 +126,8 @@ lint = [ "types-Pygments==2.19.0.20250107", "types-requests==2.32.0.20241016", # align with requests "types-urllib3==1.26.25.14", - "pyright==1.1.392.post0", - "pytest>=6.0", -] -test = [ - "pytest>=8.0", - "defusedxml>=0.7.1", # for secure XML/HTML parsing - "cython>=3.0", - "setuptools>=70.0", # for Cython compilation - "typing_extensions>=4.9", # for typing_extensions.Unpack ] -[[project.authors]] -name = "Georg Brandl" -email = "georg@python.org" - -[project.scripts] -sphinx-build = "sphinx.cmd.build:main" -sphinx-quickstart = "sphinx.cmd.quickstart:main" -sphinx-apidoc = "sphinx.ext.apidoc:main" -sphinx-autogen = "sphinx.ext.autosummary.generate:main" - [tool.flit.module] name = "sphinx" diff --git a/tox.ini b/tox.ini index 674013fdc08..23b239c7ffc 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,7 @@ passenv = READTHEDOCS description = py{311,312,313,314}: Run unit tests against {envname}. -extras = +dependency_groups = test setenv = PYTHONWARNINGS = error @@ -31,8 +31,9 @@ commands= [testenv:lint] description = Run linters. -extras = +dependency_groups = lint + types # If you update any of these commands, don't forget to update the equivalent # GitHub Workflow step commands = @@ -43,7 +44,7 @@ commands = [testenv:docs] description = Build documentation. -extras = +dependency_groups = docs commands = python -c "import shutil; shutil.rmtree('./build/sphinx', ignore_errors=True) if '{env:CLEAN:}' else None" @@ -52,7 +53,7 @@ commands = [testenv:docs-live] description = Build documentation. -extras = +dependency_groups = docs deps = sphinx-autobuild @@ -70,7 +71,7 @@ commands = [testenv:ruff] description = Run ruff formatting and linting. -extras = +dependency_groups = lint commands = ruff format . @@ -79,8 +80,7 @@ commands = [testenv:mypy] description = Run mypy type checking. -extras = - lint - test +dependency_groups = + types commands = mypy {posargs}