Skip to content

Commit a252a40

Browse files
Merge pull request #470 from robbievanleeuwen/feature/uv-groups
Add uv dependency groups
2 parents 2b92573 + 18f0a15 commit a252a40

File tree

7 files changed

+58
-66
lines changed

7 files changed

+58
-66
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ jobs:
3434
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
3535

3636
- name: Install dependencies
37-
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen
37+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --only-group lint
3838

3939
- name: Run pre-commit
40-
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} pre-commit run --all-files --color always --show-diff-on-failure
40+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync pre-commit run --all-files --color always --show-diff-on-failure
4141

4242
type-checking:
4343
name: type-checking
@@ -57,10 +57,10 @@ jobs:
5757
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
5858

5959
- name: Install dependencies
60-
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --all-extras
60+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --all-extras --no-group test --no-group docs
6161

6262
- name: Run pyright
63-
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} pyright
63+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync pyright
6464

6565
tests:
6666
name: ${{ matrix.session }} ${{ matrix.python }} [${{ matrix.os }}]
@@ -98,14 +98,14 @@ jobs:
9898

9999
- name: Install test dependencies
100100
if: matrix.session != 'tests-extended'
101-
run: uv sync -p ${{ matrix.python }} --frozen --extra rhino --extra dxf
101+
run: uv sync -p ${{ matrix.python }} --frozen --extra rhino --extra dxf --no-group docs --no-group lint
102102

103103
- name: Install extended test dependencies
104104
if: matrix.session == 'tests-extended'
105-
run: uv sync -p ${{ matrix.python }} --frozen --all-extras
105+
run: uv sync -p ${{ matrix.python }} --frozen --all-extras --no-group docs --no-group lint
106106

107107
- name: Run pytest
108-
run: uv run -p ${{ matrix.python }} coverage run --parallel-mode -m pytest -m 'not benchmark_suite' --junitxml=junit.xml -o junit_family=legacy
108+
run: uv run -p ${{ matrix.python }} --no-sync coverage run --parallel-mode -m pytest -m 'not benchmark_suite' --junitxml=junit.xml -o junit_family=legacy
109109

110110
- name: Upload coverage data
111111
uses: actions/upload-artifact@v4
@@ -138,13 +138,13 @@ jobs:
138138
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
139139

140140
- name: Install dependencies
141-
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --extra rhino --extra dxf
141+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --extra rhino --extra dxf --no-group test --no-group lint
142142

143143
- name: Install pandoc
144144
uses: pandoc/actions/setup@v1
145145

146146
- name: Build docs
147-
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} sphinx-build --color docs docs/_build
147+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync sphinx-build --color docs docs/_build
148148

149149
- name: Upload docs
150150
uses: actions/upload-artifact@v4
@@ -171,7 +171,7 @@ jobs:
171171
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
172172

173173
- name: Install dependencies
174-
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen
174+
run: uv sync -p ${{ env.DEFAULT_PYTHON_VERSION }} --frozen --only-group test
175175

176176
- name: Download coverage data
177177
uses: actions/download-artifact@v4
@@ -180,13 +180,13 @@ jobs:
180180
merge-multiple: true
181181

182182
- name: Combine coverage data
183-
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} coverage combine
183+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage combine
184184

185185
- name: Display coverage report
186-
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} coverage report -i
186+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage report -i
187187

188188
- name: Create coverage report
189-
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} coverage xml -i
189+
run: uv run -p ${{ env.DEFAULT_PYTHON_VERSION }} --no-sync coverage xml -i
190190

191191
- name: Upload coverage report
192192
uses: codecov/codecov-action@v4

.github/workflows/release.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
release:
1414
name: Release
1515
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: write
1618

1719
steps:
1820
- name: Check out the repository
@@ -50,16 +52,11 @@ jobs:
5052
- name: Publish package on PyPI
5153
if: steps.check-version.outputs.tag
5254
uses: pypa/gh-action-pypi-publish@release/v1
53-
with:
54-
user: __token__
55-
password: ${{ secrets.PYPI_API_TOKEN }}
5655

5756
- name: Publish package on TestPyPI
5857
if: "! steps.check-version.outputs.tag"
5958
uses: pypa/gh-action-pypi-publish@release/v1
6059
with:
61-
user: __token__
62-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
6360
repository-url: https://test.pypi.org/legacy/
6461

6562
- name: Publish the release notes

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ build:
99
- asdf install uv latest
1010
- asdf global uv latest
1111
- uv python install 3.12
12-
- uv sync -p 3.12 --frozen --extra rhino --extra dxf
13-
- uv run -p 3.12 -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
12+
- uv sync -p 3.12 --frozen --extra rhino --extra dxf --no-group test --no-group lint
13+
- uv run -p 3.12 --no-sync -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html

CONTRIBUTING.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Installation instructions for other methods and Windows can be found [here](http
4545
`uv` can then be used to install the latest compatible version of python:
4646

4747
```shell
48-
uv python install 3.12
48+
uv python install 3.12
4949
```
5050

5151
`sectionproperties` and it's development dependencies can be installed with:
@@ -54,13 +54,6 @@ Installation instructions for other methods and Windows can be found [here](http
5454
uv sync
5555
```
5656

57-
If you have other versions of python installed on your machine you may need to add the `-p` flag to ensure the correct version of python is used:
58-
59-
```shell
60-
uv sync -p 3.12
61-
uv run -p 3.12 example.py
62-
```
63-
6457
Specific extras (e.g. `numba`) can be installed with the `--extra` flag or all extras with the `--all-extras` flag:
6558

6659
```shell

docs/contributing.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ Installation instructions for other methods and Windows can be found
6363
6464
uv sync
6565
66-
If you have other versions of python installed on your machine you may need to add the
67-
``-p`` flag to ensure the correct version of python is used:
68-
69-
.. code:: shell
70-
71-
uv sync -p 3.12
72-
uv run -p 3.12 example.py
73-
7466
Specific extras (e.g. ``numba``) can be installed with the ``--extra`` flag or all
7567
extras with the ``--all-extras`` flag:
7668

pyproject.toml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,8 @@ pardiso = [
6060
"pypardiso~=0.4.6; platform_system == 'Windows' or platform_system == 'Linux'"
6161
]
6262

63-
[tool.uv]
64-
dev-dependencies = [
65-
# linting & code formatting
66-
"ruff==0.7.1",
67-
# type checking
68-
"pyright==1.1.386",
69-
# testing
70-
"pytest==8.3.3",
71-
"pytest-benchmark[histogram]==4.0.0",
72-
"pytest-check==2.4.1",
73-
"coverage[toml]==7.6.4",
74-
# docs
63+
[dependency-groups]
64+
docs = [
7565
"furo==2024.8.6",
7666
"sphinx==8.1.3",
7767
"notebook==7.2.2",
@@ -81,10 +71,22 @@ dev-dependencies = [
8171
"nbconvert==7.16.4",
8272
"sphinx-copybutton==0.5.2",
8373
"sphinxext-opengraph==0.9.1",
84-
# pre-commit
74+
]
75+
test = [
76+
"pytest==8.3.3",
77+
"pytest-benchmark[histogram]==4.0.0",
78+
"pytest-check==2.4.1",
79+
"coverage[toml]==7.6.4",
80+
]
81+
lint = [
8582
"pre-commit==4.0.1",
83+
"ruff==0.7.1",
84+
"pyright==1.1.386",
8685
]
8786

87+
[tool.uv]
88+
default-groups = ["docs", "test", "lint"]
89+
8890
[tool.pyright]
8991
venvPath = "."
9092
venv = ".venv"

uv.lock

Lines changed: 25 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)