Skip to content

Commit 3576d02

Browse files
authored
chore: move extras to groups (scikit-build#1177)
I forget what the issue was before, so let's try again. I think it might be missing support in a few places, but we can install `dependency-groups` or `uv` if needed. Close scikit-build#1168, close scikit-build#1169. --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 493d450 commit 3576d02

File tree

6 files changed

+59
-59
lines changed

6 files changed

+59
-59
lines changed

.distro/python-scikit-build-core.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ cp -p src/scikit_build_core/_vendor/pyproject_metadata/LICENSE LICENSE-pyproject
5353
%if %{with no_classifier_check}
5454
export HATCH_METADATA_CLASSIFIERS_NO_VERIFY=1
5555
%endif
56-
%pyproject_buildrequires -x test,test-meta,test-numpy
56+
%pyproject_buildrequires -g test,test-meta,test-numpy
5757

5858

5959
%build

.github/workflows/ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ jobs:
124124

125125
- name: Install package (uv)
126126
run:
127-
uv pip install
128-
-e.[test,test-meta,test-numpy,test-schema,test-hatchling,wheels,cov,wheel-free-setuptools]
129-
--system
127+
uv pip install -e.[wheels,wheel-free-setuptools] --group=dev --system
130128

131129
- name: Test package
132130
if: "!contains(matrix.python_version, 'pypy')"
@@ -182,7 +180,7 @@ jobs:
182180

183181
- name: Install min requirements
184182
run: |
185-
uv pip install -e .[test,pyproject] --resolution=lowest-direct --system
183+
uv pip install -e. --group=test --resolution=lowest-direct --system
186184
187185
- name: Setup CMake 3.15
188186
uses: jwlawson/actions-setup-cmake@v2.0
@@ -218,7 +216,7 @@ jobs:
218216
run: python3.13t -m venv /venv
219217

220218
- name: Install deps
221-
run: /venv/bin/pip install -e .[test] ninja
219+
run: /venv/bin/pip install -e . --group=test ninja
222220

223221
- name: Test package
224222
run: /venv/bin/pytest
@@ -241,7 +239,7 @@ jobs:
241239
cmake ninja git make gcc-g++ python39 python39-devel python39-pip
242240

243241
- name: Install
244-
run: python3.9 -m pip install .[test]
242+
run: python3.9 -m pip install . --group=test
245243

246244
- name: Test package
247245
run:
@@ -274,7 +272,7 @@ jobs:
274272
persist-credentials: false
275273

276274
- name: Install
277-
run: python -m pip install .[test]
275+
run: python -m pip install . --group=test
278276

279277
- name: Test package
280278
run: >-
@@ -307,7 +305,7 @@ jobs:
307305
persist-credentials: false
308306

309307
- name: Install
310-
run: python -m pip install .[test]
308+
run: python -m pip install . --group=test
311309

312310
- name: Test package
313311
run: >-

.readthedocs.yml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,15 @@
55
# Required
66
version: 2
77

8-
# Set the version of Python and other tools you might need
98
build:
10-
os: ubuntu-22.04
9+
os: ubuntu-24.04
1110
tools:
12-
python: "3.11"
13-
14-
# Unshallow the git clone to allow vcs versioning to pick
15-
# up tags properly
16-
jobs:
17-
post_checkout:
18-
- git fetch --unshallow
19-
20-
# Build documentation in the docs/ directory with Sphinx
21-
sphinx:
22-
configuration: docs/conf.py
23-
24-
python:
25-
install:
26-
- method: pip
27-
path: .
28-
extra_requirements:
29-
- docs
30-
- pyproject
11+
python: "3.13"
12+
commands:
13+
- git fetch --unshallow
14+
- asdf plugin add uv
15+
- asdf install uv latest
16+
- asdf global uv latest
17+
- uv sync --group docs
18+
- uv run python -m sphinx -T -b html -d docs/_build/doctrees -D language=en
19+
docs $READTHEDOCS_OUTPUT/html

noxfile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def pylint(session: nox.Session) -> None:
4747
"""
4848
# This needs to be installed into the package environment, and is slower
4949
# than a pre-commit check
50-
session.install("-e.[dev,test,test-meta]", "pylint==3.3.*")
50+
session.install("-e.", "--group=dev", "pylint==3.3.*")
5151
session.run("pylint", "--version")
5252
session.run("pylint", "scikit_build_core", *session.posargs)
5353

@@ -80,8 +80,8 @@ def _run_tests(
8080
posargs.append("--cov-config=pyproject.toml")
8181
env["COVERAGE_CORE"] = "sysmon"
8282

83-
install_arg = f"-e.[{','.join(_extras)}]"
84-
session.install(install_arg, *install_args, silent=False)
83+
install_arg = ["-e.", *{" ".join(f"--group={e}" for e in _extras)}]
84+
session.install(*install_arg, *install_args, silent=False)
8585
session.run("pytest", *run_args, *posargs, env=env)
8686

8787

@@ -104,7 +104,7 @@ def tests(session: nox.Session) -> None:
104104
"""
105105
Run the unit and regular tests. Includes coverage if --cov passed.
106106
"""
107-
_run_tests(session, extras=["test-meta,test-numpy,test-schema,test-hatchling"])
107+
_run_tests(session, extras=["dev"])
108108

109109

110110
@nox.session(reuse_venv=True, tags=["gen"])
@@ -158,7 +158,7 @@ def docs(session: nox.Session) -> None:
158158

159159
serve = args.builder == "html" and session.interactive
160160
extra_installs = ["sphinx-autobuild"] if serve else []
161-
session.install("-e.[docs]", *extra_installs)
161+
session.install("-e.", "--group=docs", *extra_installs)
162162

163163
session.chdir("docs")
164164

pyproject.toml

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,32 @@ dependencies = [
4747
[project.optional-dependencies]
4848
pyproject = [
4949
]
50+
wheels = [
51+
"cmake",
52+
"ninja; sys_platform!='win32'",
53+
]
54+
wheel-free-setuptools = [
55+
'setuptools>=70.1; python_version>="3.8"',
56+
]
57+
58+
[project.urls]
59+
Changelog = "https://scikit-build-core.readthedocs.io/en/latest/changelog.html"
60+
Discussions = "https://github.com/orgs/scikit-build/discussions"
61+
Documentation = "https://scikit-build-core.readthedocs.io"
62+
Homepage = "https://github.com/scikit-build/scikit-build-core"
63+
Issues = "https://github.com/scikit-build/scikit-build-core/issues"
64+
65+
[project.entry-points]
66+
"distutils.commands".build_cmake = "scikit_build_core.setuptools.build_cmake:BuildCMake"
67+
"distutils.setup_keywords".cmake_source_dir = "scikit_build_core.setuptools.build_cmake:cmake_source_dir"
68+
"distutils.setup_keywords".cmake_args = "scikit_build_core.setuptools.build_cmake:cmake_args"
69+
"distutils.setup_keywords".cmake_install_target = "scikit_build_core.setuptools.build_cmake:cmake_install_target"
70+
"setuptools.finalize_distribution_options".scikit_build_entry = "scikit_build_core.setuptools.build_cmake:finalize_distribution_options"
71+
"validate_pyproject.tool_schema".scikit-build = "scikit_build_core.settings.skbuild_schema:get_skbuild_schema"
72+
hatch.scikit-build = "scikit_build_core.hatch.hooks"
73+
74+
75+
[dependency-groups]
5076
test = [
5177
"build >=0.8",
5278
"cattrs >=22.2.0",
@@ -64,30 +90,36 @@ test = [
6490
"wheel >=0.40",
6591
]
6692
test-hatchling = [
93+
{ include-group = "test" },
6794
"hatchling >=1.24.0",
6895
]
6996
test-meta = [
97+
{ include-group = "test" },
7098
"hatch-fancy-pypi-readme>=22.3",
7199
"setuptools-scm",
72100
]
73101
test-numpy = [
102+
{ include-group = "test" },
74103
"numpy; python_version<'3.14' and platform_python_implementation!='PyPy' and (platform_system != 'Windows' or platform_machine != 'ARM64')",
75104
"numpy~=1.24.0; python_version=='3.8' and platform_python_implementation=='PyPy'",
76105
"numpy~=2.0.0; python_version=='3.9' and platform_python_implementation=='PyPy'",
77106
"numpy~=2.2.0; python_version=='3.10' and platform_python_implementation=='PyPy'",
78107
]
79108
test-schema = [
109+
{ include-group = "test" },
80110
"fastjsonschema",
81111
"validate-pyproject",
82112
]
83113
cov = [
114+
{ include-group = "test" },
84115
"pytest-cov",
85116
]
86-
wheels = [
87-
"cmake",
88-
"ninja; sys_platform!='win32'",
89-
]
90117
dev = [
118+
{ include-group = "cov" },
119+
{ include-group = "test-hatchling" },
120+
{ include-group = "test-meta" },
121+
{ include-group = "test-numpy" },
122+
{ include-group = "test-schema" },
91123
"rich",
92124
]
93125
docs = [
@@ -103,33 +135,14 @@ docs = [
103135
"sphinx-tippy",
104136
"sphinxcontrib-programoutput",
105137
]
106-
wheel-free-setuptools = [
107-
'setuptools>=70.1; python_version>="3.8"',
108-
]
109138

110-
[project.urls]
111-
Changelog = "https://scikit-build-core.readthedocs.io/en/latest/changelog.html"
112-
Discussions = "https://github.com/orgs/scikit-build/discussions"
113-
Documentation = "https://scikit-build-core.readthedocs.io"
114-
Homepage = "https://github.com/scikit-build/scikit-build-core"
115-
Issues = "https://github.com/scikit-build/scikit-build-core/issues"
116-
117-
[project.entry-points]
118-
"distutils.commands".build_cmake = "scikit_build_core.setuptools.build_cmake:BuildCMake"
119-
"distutils.setup_keywords".cmake_source_dir = "scikit_build_core.setuptools.build_cmake:cmake_source_dir"
120-
"distutils.setup_keywords".cmake_args = "scikit_build_core.setuptools.build_cmake:cmake_args"
121-
"distutils.setup_keywords".cmake_install_target = "scikit_build_core.setuptools.build_cmake:cmake_install_target"
122-
"setuptools.finalize_distribution_options".scikit_build_entry = "scikit_build_core.setuptools.build_cmake:finalize_distribution_options"
123-
"validate_pyproject.tool_schema".scikit-build = "scikit_build_core.settings.skbuild_schema:get_skbuild_schema"
124-
hatch.scikit-build = "scikit_build_core.hatch.hooks"
125139

126140
[tool.hatch]
127141
version.source = "vcs"
128142
build.hooks.vcs.version-file = "src/scikit_build_core/_version.py"
129143

130144

131145
[tool.uv]
132-
dev-dependencies = ["scikit-build-core[test,test-hatchling,test-meta,test-numpy,test-schema,cov,dev]"]
133146
workspace.members = ["tmp/hello/hello"]
134147

135148

tests/plans.fmf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
node-date: 2025-02-27T16:18:39-05:00
2828
describe-name: v0.11.0
2929
EOF
30-
pip install --user .[test]
30+
pip install --user . --group=test
3131
discover:
3232
how: fmf
3333
filter: "tag: pytest"

0 commit comments

Comments
 (0)