Skip to content

Commit 5f66918

Browse files
authored
chore: use dependency-groups (#624)
Using dependency groups. --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent c00d1fc commit 5f66918

File tree

8 files changed

+40
-14
lines changed

8 files changed

+40
-14
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
checks:
2929
runs-on: ubuntu-latest
3030
strategy:
31+
fail-fast: false
3132
matrix:
3233
python-version:
3334
- "3.9"
@@ -54,17 +55,17 @@ jobs:
5455

5556
- name: Install package
5657
if: matrix.python-version == '3.14'
57-
run: uv pip install -e ".[test]"
58+
run: uv pip install -e. --group test
5859

5960
- name: Install package (dask)
6061
if: matrix.python-version != '3.14'
61-
run: uv pip install -e ".[test,dask]"
62+
run: uv pip install -e ".[dask]" --group test
6263

6364
- name: Test package
6465
run: .venv/bin/python -m pytest
6566

6667
- name: Install plotting requirements too
67-
run: uv pip install -e ".[test,plot]"
68+
run: uv pip install -e ".[plot]"
6869

6970
- name: Test plotting too
7071
run: .venv/bin/python -m pytest --mpl

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ build:
1414
- asdf install uv latest
1515
- asdf global uv latest
1616
- uv venv
17-
- uv pip install -e .[docs]
17+
- uv pip install -e. --group docs
1818
- . .venv/bin/activate && sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html

noxfile.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def tests(session):
4343
"""
4444
Run the unit and regular tests.
4545
"""
46-
session.install("-e", ".[test,plot]")
46+
session.install("-e.[plot]", "--group=test")
4747
args = ["--mpl"] if sys.platform.startswith("linux") else []
4848
session.run("pytest", *args, *session.posargs)
4949

@@ -54,7 +54,7 @@ def minimums(session):
5454
Run with the minimum dependencies.
5555
"""
5656

57-
session.install("-e", ".[test]", "--resolution=lowest-direct")
57+
session.install("-e.", "--group=test", "--resolution=lowest-direct")
5858
session.run("pytest", *session.posargs)
5959

6060

@@ -63,7 +63,7 @@ def regenerate(session):
6363
"""
6464
Regenerate MPL images.
6565
"""
66-
session.install("-e", ".[test,plot]")
66+
session.install("-e.[plot]", "--group=test")
6767
if not sys.platform.startswith("linux"):
6868
session.error(
6969
"Must be run from Linux, images will be slightly different on macOS"
@@ -85,7 +85,7 @@ def docs(session: nox.Session) -> None:
8585

8686
serve = args.builder == "html" and session.interactive
8787
extra_installs = ["sphinx-autobuild"] if serve else []
88-
session.install("-e.[docs]", *extra_installs)
88+
session.install("-e.", "--group=docs", *extra_installs)
8989

9090
session.chdir("docs")
9191

@@ -107,7 +107,12 @@ def docs(session: nox.Session) -> None:
107107
@nox.session(reuse_venv=True, default=False)
108108
def build_api_docs(session: nox.Session) -> None:
109109
"""
110-
Build (regenerate) API docs.
110+
Build (regenerate) API docs. Requires Linux.
111+
112+
For example:
113+
114+
docker run -v $PWD:/histogram -w /histogram -it quay.io/pypa/manylinux_2_28_x86_64
115+
uvx nox -s regenerate
111116
"""
112117

113118
session.install("sphinx")

pyproject.toml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Discussions = "https://github.com/scikit-hep/hist/discussions"
5454
Changelog = "https://hist.readthedocs.io/en/latest/changelog.html"
5555

5656
[project.optional-dependencies]
57+
# Keep in sync with dependency-groups below
5758
mpl = [
5859
"matplotlib >=3.3.3",
5960
"mplhep >=0.3.17",
@@ -63,32 +64,51 @@ plot = [
6364
"mplhep >=0.3.17",
6465
]
6566
fit = [
66-
"scipy >=1.4",
67+
"scipy >=1.5.4",
6768
"iminuit >=2",
6869
]
6970
dask = [
7071
"dask[dataframe] >=2022,<2025",
7172
"dask_histogram >=2023.1",
7273
]
74+
75+
[dependency-groups]
76+
plot = [
77+
"matplotlib >=3.3.3",
78+
"mplhep >=0.3.17",
79+
]
80+
fit = [
81+
"scipy >=1.5.4",
82+
"iminuit >=2; python_version<'3.14'",
83+
]
84+
dask = [
85+
"dask[dataframe] >=2022,<2025",
86+
"dask_histogram >=2023.1",
87+
]
7388
test = [
89+
{ include-group = "test-core" },
90+
{ include-group = "fit" },
91+
]
92+
test-core = [
7493
"pytest >=8",
7594
"pytest-mpl >=0.12",
76-
"hist[plot]",
95+
{ include-group = "plot" },
7796
]
7897
dev = [
79-
"hist[mpl,fit,test,dask]",
8098
"ipykernel",
99+
{ include-group = "test" },
100+
{ include-group = "plot" },
101+
{ include-group = "dask" },
81102
]
82103
docs = [
83-
"hist[test,plot,fit,dask]",
104+
{ include-group = "dev" },
84105
"ipython_genutils",
85106
"nbsphinx",
86107
"sphinx >=3.0.0",
87108
"sphinx_copybutton",
88109
"sphinx_book_theme >=0.0.38",
89110
"sphinxcontrib-programoutput",
90111
"ipython",
91-
"ipykernel",
92112
"pillow",
93113
"uncertainties>=3",
94114
"myst_parser>=0.14",
52 Bytes
Loading
-69 Bytes
Loading
-135 Bytes
Loading
-324 Bytes
Loading

0 commit comments

Comments
 (0)