Skip to content

Commit a5ef7fe

Browse files
authored
chore: Porting from poetry to UV (#491)
1 parent a5a1392 commit a5ef7fe

File tree

6 files changed

+1644
-1690
lines changed

6 files changed

+1644
-1690
lines changed

.github/workflows/python-package.yml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,44 +26,32 @@ jobs:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Setup Graphviz
2828
uses: ts-graphviz/setup-graphviz@v1
29-
- name: Install Poetry
30-
uses: snok/install-poetry@v1
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v3
3131
with:
32-
version: 1.5.1
33-
virtualenvs-create: true
34-
virtualenvs-in-project: true
35-
installer-parallel: true
36-
- name: Load cached venv
37-
id: cached-poetry-dependencies
38-
uses: actions/cache@v3
39-
with:
40-
path: .venv
41-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
42-
- name: Install dependencies
43-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
44-
run: poetry install --no-interaction --no-root --all-extras
32+
enable-cache: true
33+
cache-suffix: "python${{ matrix.python-version }}"
34+
- name: Install the project
35+
run: uv sync --all-extras --dev
4536
- name: Install old pydot for 3.7 only
4637
if: matrix.python-version == 3.7
4738
run: |
48-
source .venv/bin/activate
49-
pip install pydot==2.0.0
39+
uv pip install pydot==2.0.0
5040
#----------------------------------------------
5141
# run ruff
5242
#----------------------------------------------
5343
- name: Linter with ruff
5444
if: matrix.python-version == 3.12
5545
run: |
56-
source .venv/bin/activate
57-
ruff check .
58-
ruff format --check .
46+
uv run ruff check .
47+
uv run ruff format --check .
5948
#----------------------------------------------
6049
# run pytest
6150
#----------------------------------------------
6251
- name: Test with pytest
6352
run: |
64-
source .venv/bin/activate
65-
pytest --cov-report=xml:coverage.xml
66-
coverage xml
53+
uv run pytest --cov-report=xml:coverage.xml
54+
uv run coverage xml
6755
#----------------------------------------------
6856
# upload coverage
6957
#----------------------------------------------

.github/workflows/release.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,14 @@ jobs:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Setup Graphviz
2828
uses: ts-graphviz/setup-graphviz@v1
29-
- name: Install Poetry
30-
uses: snok/install-poetry@v1
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v3
3131
with:
32-
version: 1.5.1
33-
virtualenvs-create: true
34-
virtualenvs-in-project: true
35-
installer-parallel: true
36-
- name: Load cached venv
37-
id: cached-poetry-dependencies
38-
uses: actions/cache@v3
39-
with:
40-
path: .venv
41-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
42-
- name: Install dependencies
43-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
44-
run: poetry install --no-interaction --no-root --all-extras
45-
- name: Test with pytest
46-
run: |
47-
source .venv/bin/activate
48-
pytest
49-
- name: Poetry build
32+
enable-cache: true
33+
- name: Install the project
34+
run: uv sync --all-extras --dev
35+
- name: Build
5036
run: |
51-
source .venv/bin/activate
52-
poetry build
37+
uv build
5338
- name: Publish package distributions to PyPI
5439
uses: pypa/gh-action-pypi-publish@release/v1

.readthedocs.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,18 @@
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-22.04"
1110
tools:
1211
python: "3.12"
1312
apt_packages:
1413
- graphviz
1514
jobs:
1615
post_create_environment:
17-
# Install poetry
18-
# https://python-poetry.org/docs/#installing-manually
19-
- python -m pip install poetry
20-
# Tell poetry to not use a virtual environment
21-
- poetry config virtualenvs.create false
22-
post_install:
23-
# Install dependencies with 'docs' dependency group
24-
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
25-
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --extras diagrams --with docs
16+
- asdf plugin add uv
17+
- asdf install uv latest
18+
- asdf global uv latest
19+
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --frozen
2620

2721
# Build documentation in the docs/ directory with Sphinx
2822
sphinx:

0 commit comments

Comments
 (0)