Skip to content

Commit de8fdaa

Browse files
authored
UV (#146)
* Convert to use uv * Exclude jupyter notebooks from pre-commit JSON reformatting. * Use license SPDX ID rather than name * Update GH Actions and add caching * Set default module name to replace '-' with '_'
1 parent 709a9e6 commit de8fdaa

File tree

12 files changed

+84
-638
lines changed

12 files changed

+84
-638
lines changed

.github/workflows/docs.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v4
20-
- uses: actions/setup-python@v5
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
22+
with:
23+
enable-cache: true
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
2126
with:
2227
python-version-file: pyproject.toml
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install poetry
26-
poetry install --with docs
28+
- name: Install the project
29+
run: uv sync --only-group docs
2730
- name: Build docs
2831
run: |
2932
APP_MODULE_NAME=$(ls src -U | head -1) # Get the first module name in the src directory
30-
poetry run pdoc src/"$APP_MODULE_NAME" -o docs_build -t docs/pdoc-theme --docformat google
33+
uv run pdoc src/"$APP_MODULE_NAME" -o docs_build -t docs/pdoc-theme --docformat google
3134
touch docs_build/.nojekyll
3235
- uses: JamesIves/github-pages-deploy-action@v4
3336
with:

.github/workflows/test.yaml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Install poetry
15-
run: pipx install poetry
16-
- uses: actions/setup-python@v5
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v5
16+
with:
17+
enable-cache: true
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
1720
with:
1821
python-version-file: pyproject.toml
19-
cache: poetry
20-
- name: Install dependencies
21-
run: |
22-
poetry install
22+
- name: Install the project
23+
run: uv sync --only-dev
2324
- name: Run tests
2425
id: run-tests
2526
run: >
26-
poetry run pytest \
27+
uv run pytest \
2728
--junitxml=pytest.xml \
2829
--cov-report=term-missing:skip-covered \
2930
--cov-report=xml:coverage.xml \
@@ -40,30 +41,34 @@ jobs:
4041
runs-on: ubuntu-latest
4142
steps:
4243
- uses: actions/checkout@v4
43-
- name: Install poetry
44-
run: pipx install poetry
45-
- uses: actions/setup-python@v5
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v5
46+
with:
47+
enable-cache: true
48+
- name: Set up Python
49+
uses: actions/setup-python@v5
4650
with:
4751
python-version-file: pyproject.toml
48-
cache: poetry
49-
- name: Install dependencies
50-
run: |
51-
poetry install
52+
- name: Install the project
53+
run: uv sync --only-dev
5254
- name: Ruff format
53-
run: poetry run ruff format --check
55+
run: uv run ruff format --check
5456
- name: Ruff check
55-
run: poetry run ruff check
57+
run: uv run ruff check
5658

5759
mypy:
5860
runs-on: ubuntu-latest
5961
steps:
6062
- uses: actions/checkout@v4
61-
- name: Install poetry
62-
run: pipx install poetry
63-
- uses: actions/setup-python@v5
63+
- name: Install uv
64+
uses: astral-sh/setup-uv@v5
6465
with:
65-
python-version: '3.11'
66-
cache: poetry
66+
enable-cache: true
67+
- name: Set up Python
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version-file: pyproject.toml
71+
- name: Install the project
72+
run: uv sync --only-dev
6773
- run: |
68-
poetry install
69-
poetry run mypy .
74+
uv run mypy .

.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# MacOS system files
2+
.DS_Store
3+
4+
# Ruff tmp files
15
.ruff_cache
26

37
# Byte-compiled / optimized / DLL files
@@ -96,12 +100,12 @@ ipython_config.py
96100
# install all needed dependencies.
97101
#Pipfile.lock
98102

99-
# poetry
100-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103+
# uv
104+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
101105
# This is especially recommended for binary packages to ensure reproducibility, and is more
102106
# commonly ignored for libraries.
103-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104-
#poetry.lock
107+
# https://docs.astral.sh/uv/concepts/projects/layout/#the-lockfile
108+
#uv.lock
105109

106110
# pdm
107111
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
fail_fast: false
22

33
repos:
4-
- repo: https://github.com/python-poetry/poetry
5-
rev: 1.8.0
6-
hooks:
7-
- id: poetry-check
8-
94
- repo: https://github.com/astral-sh/ruff-pre-commit
105
rev: v0.8.1
116
hooks:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
Welcome to the CMI-DAIR Template Python Repository! This template is designed to streamline your project setup and ensure a consistent structure. To get started, follow these steps:
66

7-
87
- [ ] Run `setup_template.py` to initialize the repository.
98
- [ ] Replace the content of this `README.md` with details specific to your project.
109
- [ ] Install the `pre-commit` hooks to ensure code quality on each commit.

0 commit comments

Comments
 (0)