Skip to content

Commit 3596f33

Browse files
feat: ⭐ Introducing UV as package manager (#1785)
* feat: ✨ Introduce UV instead of poetry * feat: 🔧 bump version to 1.2.0 and update tests * chore: ✨ update project configuration and improve build process * feat: ✨ migrate CI workflow from Poetry to UV for dependency management * fix: ✅ clean up file handling and remove unnecessary type ignore in tests * fix: ✅ update pre-commit configuration to exclude uv.lock instead of poetry.lock * fix: 🚨 standardize YAML formatting in GitHub workflows and labeler configuration * fix: ✅ remove quotes from cache-dependency-glob in CI workflow * ci: 👷 update trunk.yaml to latest plugin versions and CLI version * fix: ✏️ correct command syntax in CI workflow for running tests * fix: 📝 add uv.lock to labeler configuration for dependency tracking * ci: 👷 enhance CI workflow for uv installation and project setup * fix: 🐛 add stacklevel argument to DeprecationWarning for clearer warning context * fix: ✏️ update CI workflow to install any wheel file and run spectrafit with verbose output * fix: 🚨 adjust stacklevel argument in DeprecationWarning for clearer warning context * ci: 👷 add uv build step to CI workflow for project installation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: 🐛 add type ignore comment for AutoPeakDetection instantiation in tests * fix: 🐛 remove type ignore comment for AutoPeakDetection instantiation in tests * fix: 🐛 add type ignore comment for AutoPeakDetection instantiation in tests * ci: 👷 update CI workflow to rename project installation step and add wheel installation * feat: 🎨 update devcontainer configuration to use latest features and install uv for environment setup * feat: 🎨 update devcontainer configuration to use latest versions of GitHub CLI and remove unused features * fix: 🐛 update devcontainer configuration to include Docker-in-Docker and Git features, and adjust GitHub CLI installation * docs: 📝 update installation instructions to replace Poetry with UV as the package manager for SpectraFit * feat: 🎨 update GitHub Actions workflow to replace Poetry with uv for dependency management * ci: ✅ update GitHub Actions workflow to replace Poetry with uv for dependency management * docs: 📝 clean up reference links in documentation files * chore: 📝 clean up formatting in CONTRIBUTING.md, codecov.yml, and renovate.json * fix: 🐛 add stacklevel parameter to warning messages for better traceability --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4011a88 commit 3596f33

34 files changed

+7585
-7132
lines changed

.devcontainer/devcontainer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"image": "mcr.microsoft.com/devcontainers/python:dev-3.10",
77
"features": {
8-
"ghcr.io/devcontainers/features/git:1": {},
9-
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
108
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
119
"ghcr.io/devcontainers-contrib/features/prettier:1": {},
12-
"ghcr.io/devcontainers/features/github-cli:1": {},
1310
"ghcr.io/devcontainers-contrib/features/bash-command:1": {},
14-
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
11+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
12+
"ghcr.io/devcontainers/features/git:1": {},
13+
"ghcr.io/devcontainers/features/github-cli:1": {},
14+
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {}
1515
},
1616

1717
// Features to add to the dev container. More info: https://containers.dev/features.
@@ -29,7 +29,8 @@
2929
"njpwerner.autodocstring",
3030
"ms-python.isort",
3131
"ms-python.vscode-pylance",
32-
"ms-python.python"
32+
"ms-python.python",
33+
"charliermarsh.ruff"
3334
]
3435
}
3536
}

.devcontainer/setup.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
python -m pip install --upgrade pip
2-
python -m pip install poetry
3-
poetry config virtualenvs.in-project true
4-
python -m poetry install --with dev,docs --all-extras
2+
python -m pip install uv
3+
uv venv --python 3.10
4+
uv sync --all-extras --all-groups

.github/labeler.yml

+65-64
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,83 @@
11
root:
2-
- changed-files:
3-
- any-glob-to-any-file: '*'
2+
- changed-files:
3+
- any-glob-to-any-file: "*"
44
codeowners:
5-
- changed-files:
6-
- any-glob-to-any-file: .github/CODEOWNERS
5+
- changed-files:
6+
- any-glob-to-any-file: .github/CODEOWNERS
77
codespaces:
8-
- changed-files:
9-
- any-glob-to-any-file: .devcontainer/**
8+
- changed-files:
9+
- any-glob-to-any-file: .devcontainer/**
1010
dependencies:
11-
- changed-files:
12-
- any-glob-to-any-file:
13-
- poetry.lock
14-
- github/dependabot.yml
11+
- changed-files:
12+
- any-glob-to-any-file:
13+
- uv.lock
14+
- poetry.lock
15+
- github/dependabot.yml
1516
documentation:
16-
- changed-files:
17-
- any-glob-to-any-file:
18-
- docs/**
19-
- Examples/**
20-
- mkdocs.yml
21-
- README.md
22-
- INSTALLATION.md
17+
- changed-files:
18+
- any-glob-to-any-file:
19+
- docs/**
20+
- Examples/**
21+
- mkdocs.yml
22+
- README.md
23+
- INSTALLATION.md
2324
forms:
24-
- changed-files:
25-
- any-glob-to-any-file:
26-
- .github/ISSUE_TEMPLATE/**
27-
- .github/pull_request_template.md
25+
- changed-files:
26+
- any-glob-to-any-file:
27+
- .github/ISSUE_TEMPLATE/**
28+
- .github/pull_request_template.md
2829
github-actions:
29-
- changed-files:
30-
- any-glob-to-any-file: .github/workflows/**
30+
- changed-files:
31+
- any-glob-to-any-file: .github/workflows/**
3132
pre-commit:
32-
- changed-files:
33-
- any-glob-to-any-file:
34-
- .pre-commit-config.yaml
35-
- .pre-commit-hooks.yaml
33+
- changed-files:
34+
- any-glob-to-any-file:
35+
- .pre-commit-config.yaml
36+
- .pre-commit-hooks.yaml
3637
python:
37-
- changed-files:
38-
- any-glob-to-any-file: "spectrafit/**/*.py"
38+
- changed-files:
39+
- any-glob-to-any-file: "spectrafit/**/*.py"
3940
testing:
40-
- changed-files:
41-
- any-glob-to-any-file: "spectrafit/**/test_*.py"
41+
- changed-files:
42+
- any-glob-to-any-file: "spectrafit/**/test_*.py"
4243
docker:
43-
- changed-files:
44-
- any-glob-to-any-file:
45-
- Dockerfile
46-
- .dockerignore
47-
- .devcontainer/Dockerfile
44+
- changed-files:
45+
- any-glob-to-any-file:
46+
- Dockerfile
47+
- .dockerignore
48+
- .devcontainer/Dockerfile
4849
release:
49-
- changed-files:
50-
- any-glob-to-any-file: spectrafit/__init__.py
50+
- changed-files:
51+
- any-glob-to-any-file: spectrafit/__init__.py
5152
vendor:
52-
- changed-files:
53-
- any-glob-to-any-file: vendor/**
53+
- changed-files:
54+
- any-glob-to-any-file: vendor/**
5455
maintenance:
55-
- changed-files:
56-
- any-glob-to-any-file:
57-
- .gitignore
58-
- .github/dependabot.yml
59-
- .github/release-drafter.yml
60-
- .github/labeler.yml
61-
- .github/workflows/label.yml
62-
- .sonarcloud.properties
63-
- .pre-commit-config.yaml
64-
- .prettierignore
65-
- .pylintrc
66-
- .sonarcloud.properties
67-
- .sourcery.yaml
68-
- "pyproject.toml"
56+
- changed-files:
57+
- any-glob-to-any-file:
58+
- .gitignore
59+
- .github/dependabot.yml
60+
- .github/release-drafter.yml
61+
- .github/labeler.yml
62+
- .github/workflows/label.yml
63+
- .sonarcloud.properties
64+
- .pre-commit-config.yaml
65+
- .prettierignore
66+
- .pylintrc
67+
- .sonarcloud.properties
68+
- .sourcery.yaml
69+
- "pyproject.toml"
6970
license:
70-
- changed-files:
71-
- any-glob-to-any-file:
72-
- LICENSE
73-
- THIRD_PARTY_LICENSES
71+
- changed-files:
72+
- any-glob-to-any-file:
73+
- LICENSE
74+
- THIRD_PARTY_LICENSES
7475
security:
75-
- changed-files:
76-
- any-glob-to-any-file: SECURITY.md
76+
- changed-files:
77+
- any-glob-to-any-file: SECURITY.md
7778
code-of-conduct:
78-
- changed-files:
79-
- any-glob-to-any-file: CODE_OF_CONDUCT.md
79+
- changed-files:
80+
- any-glob-to-any-file: CODE_OF_CONDUCT.md
8081
changelog:
81-
- changed-files:
82-
- any-glob-to-any-file: CHANGELOG.md
82+
- changed-files:
83+
- any-glob-to-any-file: CHANGELOG.md

.github/workflows/codeql.yml

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ on:
2222
repository_dispatch:
2323
types: [create-pull-request]
2424

25-
2625
jobs:
2726
analyze:
2827
name: Analyze

.github/workflows/conda_check.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ jobs:
1515
max-parallel: 5
1616

1717
steps:
18-
- uses: actions/checkout@v4
19-
- name: Set up Python 3.10
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: '3.10'
23-
- name: Add conda to system path
24-
run: |
25-
# $CONDA is an environment variable pointing to the root of the miniconda directory
26-
echo $CONDA/bin >> $GITHUB_PATH
27-
# - name: Install dependencies
28-
# run: |
29-
# conda env update --file environment.yml --name base
30-
- name: Install spectrafit package
31-
run: |
32-
conda install -c conda-forge ${{ matrix.package }}
18+
- uses: actions/checkout@v4
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.10"
23+
- name: Add conda to system path
24+
run: |
25+
# $CONDA is an environment variable pointing to the root of the miniconda directory
26+
echo $CONDA/bin >> $GITHUB_PATH
27+
# - name: Install dependencies
28+
# run: |
29+
# conda env update --file environment.yml --name base
30+
- name: Install spectrafit package
31+
run: |
32+
conda install -c conda-forge ${{ matrix.package }}

.github/workflows/docker-ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
repository_dispatch:
88
types: [create-pull-request]
99

10-
1110
jobs:
1211
docker:
1312
# Only if Dockerfile is changed

.github/workflows/python-ci.yml

+41-36
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,15 @@ jobs:
4848
steps:
4949
- uses: actions/checkout@v4
5050
- name: Set up Python ${{ matrix.python-version }}
51-
uses: actions/setup-python@v5
52-
with:
53-
python-version: ${{ matrix.python-version }}
54-
- name: Check out repository
55-
uses: actions/checkout@v4
56-
- name: Set up python ${{ matrix.python-version }}
57-
id: setup-python
58-
uses: actions/setup-python@v5
51+
uses: astral-sh/setup-uv@v5
5952
with:
53+
enable-cache: true
54+
cache-dependency-glob: uv.lock
6055
python-version: ${{ matrix.python-version }}
61-
- name: Install Poetry and dependencies with dev-dependencies
62-
run: |
63-
python -m pip install --upgrade pip
64-
pip install poetry
65-
poetry config virtualenvs.create true
66-
poetry config virtualenvs.in-project true
67-
poetry config virtualenvs.path .venv
68-
poetry install --no-interaction --with dev -E all
56+
- name: Install the project
57+
run: uv sync --all-extras --dev
6958
- name: Test SpectraFit
70-
run: poetry run pytest
59+
run: uv run --group dev --all-extras pytest spectrafit/
7160
- name: Codecov
7261
uses: codecov/[email protected]
7362
with:
@@ -83,17 +72,36 @@ jobs:
8372
needs: build
8473
steps:
8574
- uses: actions/checkout@v4
86-
- uses: actions/setup-python@v5
75+
- name: Install uv
76+
uses: astral-sh/setup-uv@v5
8777
with:
78+
enable-cache: true
79+
cache-dependency-glob: uv.lock
8880
python-version: "3.10"
89-
- name: Install Poetry and dependencies without dev-dependencies
81+
- name: Install the project
9082
run: |
91-
python -m pip install --upgrade pip
92-
pip install poetry
93-
poetry config virtualenvs.create true
94-
poetry config virtualenvs.in-project true
95-
poetry config virtualenvs.path .venv
96-
poetry install --no-interaction --only main
83+
uv sync --all-extras
84+
uv run pip install -e .
85+
install-build:
86+
name: Install SpectraFit from wheel
87+
runs-on: ubuntu-latest
88+
needs: build
89+
steps:
90+
- uses: actions/checkout@v4
91+
- name: Install uv
92+
uses: astral-sh/setup-uv@v5
93+
with:
94+
enable-cache: true
95+
cache-dependency-glob: uv.lock
96+
python-version: "3.10"
97+
- name: Setup the project
98+
run: |
99+
uv sync --all-extras
100+
uv build
101+
- name: Install the wheel
102+
run: |
103+
uv pip install dist/*.whl
104+
uv run spectrafit -v
97105
documentation:
98106
name: Build Documentation
99107
runs-on: ubuntu-latest
@@ -102,27 +110,24 @@ jobs:
102110
- uses: actions/checkout@v4
103111
with:
104112
fetch-depth: 0
105-
- uses: actions/setup-python@v5
113+
- name: Install uv and dependencies with doc-dependencies
114+
uses: astral-sh/setup-uv@v5
106115
with:
116+
enable-cache: true
117+
cache-dependency-glob: uv.lock
107118
python-version: "3.10"
108-
- name: Install Poetry and dependencies with doc-dependencies
109-
run: |
110-
python -m pip install --upgrade pip
111-
pip install poetry
112-
poetry config virtualenvs.create true
113-
poetry config virtualenvs.in-project true
114-
poetry config virtualenvs.path .venv
115-
poetry install --no-interaction --with docs --all-extras
119+
- name: Install the project
120+
run: uv sync --all-extras --group docs
116121
- name: Set git config
117122
run: |
118123
git config --local user.email "[email protected]"
119124
git config --local user.name "GitHub Action"
120125
- name: Build documentation
121126
if: ${{ !contains(github.ref, 'refs/heads/main')}}
122-
run: poetry run mkdocs build --clean
127+
run: uv run --group docs --all-extras mkdocs build --clean
123128
- name: Deploy documentation develops
124129
if: contains(github.ref, 'refs/heads/main')
125-
run: poetry run mike deploy --push --update-aliases develop
130+
run: uv run --group docs --all-extras mike deploy --push --update-aliases develop
126131
devcontainer:
127132
name: Devcontainer
128133
needs: build

.github/workflows/update-changelog.yaml

+11-12
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,15 @@ jobs:
7878
- uses: actions/setup-python@v5
7979
with:
8080
python-version: "3.10"
81-
- name: Install Poetry and dependencies with doc-dependencies
81+
- name: Install uv
82+
uses: astral-sh/setup-uv@v5
83+
with:
84+
enable-cache: true
85+
cache-dependency-glob: uv.lock
86+
python-version: "3.10"
87+
- name: Install the project
8288
run: |
83-
python -m pip install --upgrade pip
84-
pip install poetry
85-
poetry config virtualenvs.create true
86-
poetry config virtualenvs.in-project true
87-
poetry config virtualenvs.path .venv
88-
poetry install --no-interaction --with docs --all-extras
89-
- name: Install library
90-
run: poetry install --no-interaction --with docs --all-extras
89+
uv sync --all-extras --all-groups
9190
- name: Set git config
9291
run: |
9392
git config --local user.email "[email protected]"
@@ -108,9 +107,9 @@ jobs:
108107
previous_version=$(echo $previous_tag | cut -d '.' -f 1,2)
109108
current_version=$(echo $current_tag | cut -d '.' -f 1,2)
110109
if [[ "$previous_version" == "$current_version" ]]; then
111-
poetry run mike delete ${{ steps.previous_release.outputs.previous_tag }} --push
110+
uv run mike delete ${{ steps.previous_release.outputs.previous_tag }} --push
112111
fi
113112
- name: Deploy documentation develops
114113
run: |
115-
poetry run mike deploy --push --update-aliases ${{ github.event.release.tag_name }} latest --message "Release ${{ github.event.release.tag_name }}"
116-
poetry run mike set-default --push latest
114+
uv run mike deploy --push --update-aliases ${{ github.event.release.tag_name }} latest --message "Release ${{ github.event.release.tag_name }}"
115+
uv run mike set-default --push latest

0 commit comments

Comments
 (0)