Skip to content

Commit 4828f5b

Browse files
committed
migrate to uv as project manager
1 parent 34de92e commit 4828f5b

7 files changed

Lines changed: 1072 additions & 46 deletions

File tree

.github/workflows/build-docs.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,26 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v5
1518
with:
16-
fetch-depth: 0
19+
enable-cache: true
1720

18-
- name: Setup Python
21+
- name: "Set up Python"
1922
uses: actions/setup-python@v5
2023
with:
21-
python-version: '3.11'
24+
python-version-file: ".python-version"
2225

23-
- name: Upgrade pip
24-
run: |
25-
python3 -m pip install --upgrade pip
26-
2726
- name: Install dependencies
28-
run: python3 -m pip install '.[complete]'
27+
run: uv sync --all-extras --dev
2928

3029
- name: Sphinx Build HTML docs
3130
working-directory: docs
3231
run: make html
3332

3433
- name: Deploy
35-
uses: peaceiris/actions-gh-pages@v3
34+
uses: peaceiris/actions-gh-pages@v4
3635
with:
3736
github_token: ${{ secrets.GITHUB_TOKEN }}
3837
publish_dir: ./docs/_build/html

.github/workflows/do-release.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,9 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v4
18-
- name: Set up Python 3.11
19-
uses: actions/setup-python@v4
20-
with:
21-
python-version: "3.11"
22-
- name: Install Bundling dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install twine build
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
2620
- name: Build Dists
27-
run: |
28-
python -m build --sdist --wheel . --outdir dist
29-
- name: Test Wheel
30-
run: |
31-
cd dist && pip install $(ls *.whl)'[selftest]' && python -m pytest --pyargs cchdo.params && twine check *
21+
run: uv build
3222
- name: Publish Python distribution to PyPI
33-
uses: pypa/gh-action-pypi-publish@release/v1
23+
run: uv publish

.github/workflows/python-app.yml

Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,89 @@ on:
1010
branches: [ master ]
1111

1212
jobs:
13-
build:
13+
lint:
14+
name: Lint and Style
1415

1516
runs-on: ubuntu-latest
1617

1718
steps:
1819
- uses: actions/checkout@v4
19-
- name: Set up Python 3.11
20-
uses: actions/setup-python@v5
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
2122
with:
22-
python-version: '3.11'
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
python -m pip install wheel
27-
pip install .[complete]
23+
enable-cache: true
2824
- name: Lint with ruff
2925
run: |
30-
ruff check .
26+
uvx ruff check
3127
- name: Test code style with ruff
3228
run: |
33-
ruff format --check .
29+
uvx ruff format --check
30+
31+
pytest:
32+
name: Pytest
33+
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v5
40+
with:
41+
enable-cache: true
42+
- name: "Set up Python"
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version-file: ".python-version"
46+
- name: Install dependencies
47+
run: uv sync
3448
- name: Test with pytest
35-
run: |
36-
pytest --cov-report xml --cov=cchdo.params
37-
- name: Test typing
38-
run: |
39-
mypy --namespace-packages --explicit-package-bases cchdo
49+
run: uv run pytest --pyargs cchdo.params --cov-report xml --cov=src
4050
- name: Upload coverage to Coveralls
4151
uses: coverallsapp/github-action@v2.3.0
4252
continue-on-error: true
4353
with:
4454
file: ./coverage.xml
55+
56+
selftest:
57+
name: Selftest
58+
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Install uv
64+
uses: astral-sh/setup-uv@v5
65+
with:
66+
enable-cache: true
67+
- name: "Set up Python"
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version-file: ".python-version"
71+
- name: Install dependencies
72+
run: |
73+
uv venv
74+
uv pip install .[selftest]
75+
- name: Test with pytest
76+
run: uv run --no-default-groups pytest --pyargs cchdo.params
77+
78+
typing:
79+
name: Typing with mypy
80+
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Install uv
86+
uses: astral-sh/setup-uv@v5
87+
with:
88+
enable-cache: true
89+
- name: "Set up Python"
90+
uses: actions/setup-python@v5
91+
with:
92+
python-version-file: ".python-version"
93+
- name: Install dependencies
94+
run: uv sync
95+
- name: Test typing
96+
env:
97+
MYPYPATH: cchdo
98+
run: uv run mypy --namespace-packages --explicit-package-bases src

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ selftest = [
4141
"jsonschema",
4242
"sqlalchemy"
4343
]
44+
45+
[dependency-groups]
4446
dev = [
4547
"cchdo.params[selftest]",
4648
"click",
@@ -55,9 +57,6 @@ docs = [
5557
"furo",
5658
"sphinx-autoapi",
5759
]
58-
complete = [
59-
"cchdo.params[dev,docs]"
60-
]
6160

6261
[tool.mypy]
6362
namespace_packages = true
@@ -100,10 +99,15 @@ select = [
10099
"I",
101100
# Pyupgrade
102101
"UP",
102+
# Tidy imports
103+
"TID",
103104
]
104105

105106
[tool.ruff.lint.isort]
106107
known-first-party = ["cchdo"]
107108

108109
[tool.ruff.format]
109-
exclude = ["_*_names.py"]
110+
exclude = ["_*_names.py"]
111+
112+
[tool.uv]
113+
default-groups = ["dev", "docs"]

setup.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)