Skip to content

Add uv dependency groups #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}

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

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

type-checking:
name: type-checking
Expand All @@ -57,10 +57,10 @@ jobs:
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}

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

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

tests:
name: ${{ matrix.session }} ${{ matrix.python }} [${{ matrix.os }}]
Expand Down Expand Up @@ -98,14 +98,14 @@ jobs:

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

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

- name: Run pytest
run: uv run -p ${{ matrix.python }} coverage run --parallel-mode -m pytest -m 'not benchmark_suite' --junitxml=junit.xml -o junit_family=legacy
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

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

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

- name: Install pandoc
uses: pandoc/actions/setup@v1

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

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

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

- name: Download coverage data
uses: actions/download-artifact@v4
Expand All @@ -180,13 +180,13 @@ jobs:
merge-multiple: true

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

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

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

- name: Upload coverage report
uses: codecov/codecov-action@v4
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- name: Check out the repository
Expand Down Expand Up @@ -50,16 +52,11 @@ jobs:
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

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

- name: Publish the release notes
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ build:
- asdf install uv latest
- asdf global uv latest
- uv python install 3.12
- uv sync -p 3.12 --frozen --extra rhino --extra dxf
- uv run -p 3.12 -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
- uv sync -p 3.12 --frozen --extra rhino --extra dxf --no-group test --no-group lint
- uv run -p 3.12 --no-sync -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
9 changes: 1 addition & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Installation instructions for other methods and Windows can be found [here](http
`uv` can then be used to install the latest compatible version of python:

```shell
uv python install 3.12
uv python install 3.12
```

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

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:

```shell
uv sync -p 3.12
uv run -p 3.12 example.py
```

Specific extras (e.g. `numba`) can be installed with the `--extra` flag or all extras with the `--all-extras` flag:

```shell
Expand Down
8 changes: 0 additions & 8 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@ Installation instructions for other methods and Windows can be found

uv sync

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:

.. code:: shell

uv sync -p 3.12
uv run -p 3.12 example.py

Specific extras (e.g. ``numba``) can be installed with the ``--extra`` flag or all
extras with the ``--all-extras`` flag:

Expand Down
28 changes: 15 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,8 @@ pardiso = [
"pypardiso~=0.4.6; platform_system == 'Windows' or platform_system == 'Linux'"
]

[tool.uv]
dev-dependencies = [
# linting & code formatting
"ruff==0.7.1",
# type checking
"pyright==1.1.386",
# testing
"pytest==8.3.3",
"pytest-benchmark[histogram]==4.0.0",
"pytest-check==2.4.1",
"coverage[toml]==7.6.4",
# docs
[dependency-groups]
docs = [
"furo==2024.8.6",
"sphinx==8.1.3",
"notebook==7.2.2",
Expand All @@ -81,10 +71,22 @@ dev-dependencies = [
"nbconvert==7.16.4",
"sphinx-copybutton==0.5.2",
"sphinxext-opengraph==0.9.1",
# pre-commit
]
test = [
"pytest==8.3.3",
"pytest-benchmark[histogram]==4.0.0",
"pytest-check==2.4.1",
"coverage[toml]==7.6.4",
]
lint = [
"pre-commit==4.0.1",
"ruff==0.7.1",
"pyright==1.1.386",
]

[tool.uv]
default-groups = ["docs", "test", "lint"]

[tool.pyright]
venvPath = "."
venv = ".venv"
Expand Down
42 changes: 25 additions & 17 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.