Skip to content

Commit

Permalink
feat: ⭐ Introducing UV as package manager (#1785)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Anselmoo and pre-commit-ci[bot] authored Jan 22, 2025
1 parent 4011a88 commit 3596f33
Show file tree
Hide file tree
Showing 34 changed files with 7,585 additions and 7,132 deletions.
11 changes: 6 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:dev-3.10",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
"ghcr.io/devcontainers-contrib/features/prettier:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/bash-command:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
Expand All @@ -29,7 +29,8 @@
"njpwerner.autodocstring",
"ms-python.isort",
"ms-python.vscode-pylance",
"ms-python.python"
"ms-python.python",
"charliermarsh.ruff"
]
}
}
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python -m pip install --upgrade pip
python -m pip install poetry
poetry config virtualenvs.in-project true
python -m poetry install --with dev,docs --all-extras
python -m pip install uv
uv venv --python 3.10
uv sync --all-extras --all-groups
129 changes: 65 additions & 64 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,83 @@
root:
- changed-files:
- any-glob-to-any-file: '*'
- changed-files:
- any-glob-to-any-file: "*"
codeowners:
- changed-files:
- any-glob-to-any-file: .github/CODEOWNERS
- changed-files:
- any-glob-to-any-file: .github/CODEOWNERS
codespaces:
- changed-files:
- any-glob-to-any-file: .devcontainer/**
- changed-files:
- any-glob-to-any-file: .devcontainer/**
dependencies:
- changed-files:
- any-glob-to-any-file:
- poetry.lock
- github/dependabot.yml
- changed-files:
- any-glob-to-any-file:
- uv.lock
- poetry.lock
- github/dependabot.yml
documentation:
- changed-files:
- any-glob-to-any-file:
- docs/**
- Examples/**
- mkdocs.yml
- README.md
- INSTALLATION.md
- changed-files:
- any-glob-to-any-file:
- docs/**
- Examples/**
- mkdocs.yml
- README.md
- INSTALLATION.md
forms:
- changed-files:
- any-glob-to-any-file:
- .github/ISSUE_TEMPLATE/**
- .github/pull_request_template.md
- changed-files:
- any-glob-to-any-file:
- .github/ISSUE_TEMPLATE/**
- .github/pull_request_template.md
github-actions:
- changed-files:
- any-glob-to-any-file: .github/workflows/**
- changed-files:
- any-glob-to-any-file: .github/workflows/**
pre-commit:
- changed-files:
- any-glob-to-any-file:
- .pre-commit-config.yaml
- .pre-commit-hooks.yaml
- changed-files:
- any-glob-to-any-file:
- .pre-commit-config.yaml
- .pre-commit-hooks.yaml
python:
- changed-files:
- any-glob-to-any-file: "spectrafit/**/*.py"
- changed-files:
- any-glob-to-any-file: "spectrafit/**/*.py"
testing:
- changed-files:
- any-glob-to-any-file: "spectrafit/**/test_*.py"
- changed-files:
- any-glob-to-any-file: "spectrafit/**/test_*.py"
docker:
- changed-files:
- any-glob-to-any-file:
- Dockerfile
- .dockerignore
- .devcontainer/Dockerfile
- changed-files:
- any-glob-to-any-file:
- Dockerfile
- .dockerignore
- .devcontainer/Dockerfile
release:
- changed-files:
- any-glob-to-any-file: spectrafit/__init__.py
- changed-files:
- any-glob-to-any-file: spectrafit/__init__.py
vendor:
- changed-files:
- any-glob-to-any-file: vendor/**
- changed-files:
- any-glob-to-any-file: vendor/**
maintenance:
- changed-files:
- any-glob-to-any-file:
- .gitignore
- .github/dependabot.yml
- .github/release-drafter.yml
- .github/labeler.yml
- .github/workflows/label.yml
- .sonarcloud.properties
- .pre-commit-config.yaml
- .prettierignore
- .pylintrc
- .sonarcloud.properties
- .sourcery.yaml
- "pyproject.toml"
- changed-files:
- any-glob-to-any-file:
- .gitignore
- .github/dependabot.yml
- .github/release-drafter.yml
- .github/labeler.yml
- .github/workflows/label.yml
- .sonarcloud.properties
- .pre-commit-config.yaml
- .prettierignore
- .pylintrc
- .sonarcloud.properties
- .sourcery.yaml
- "pyproject.toml"
license:
- changed-files:
- any-glob-to-any-file:
- LICENSE
- THIRD_PARTY_LICENSES
- changed-files:
- any-glob-to-any-file:
- LICENSE
- THIRD_PARTY_LICENSES
security:
- changed-files:
- any-glob-to-any-file: SECURITY.md
- changed-files:
- any-glob-to-any-file: SECURITY.md
code-of-conduct:
- changed-files:
- any-glob-to-any-file: CODE_OF_CONDUCT.md
- changed-files:
- any-glob-to-any-file: CODE_OF_CONDUCT.md
changelog:
- changed-files:
- any-glob-to-any-file: CHANGELOG.md
- changed-files:
- any-glob-to-any-file: CHANGELOG.md
1 change: 0 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ on:
repository_dispatch:
types: [create-pull-request]


jobs:
analyze:
name: Analyze
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/conda_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:
max-parallel: 5

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
# - name: Install dependencies
# run: |
# conda env update --file environment.yml --name base
- name: Install spectrafit package
run: |
conda install -c conda-forge ${{ matrix.package }}
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
# - name: Install dependencies
# run: |
# conda env update --file environment.yml --name base
- name: Install spectrafit package
run: |
conda install -c conda-forge ${{ matrix.package }}
1 change: 0 additions & 1 deletion .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
repository_dispatch:
types: [create-pull-request]


jobs:
docker:
# Only if Dockerfile is changed
Expand Down
77 changes: 41 additions & 36 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: ${{ matrix.python-version }}
- name: Install Poetry and dependencies with dev-dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
poetry install --no-interaction --with dev -E all
- name: Install the project
run: uv sync --all-extras --dev
- name: Test SpectraFit
run: poetry run pytest
run: uv run --group dev --all-extras pytest spectrafit/
- name: Codecov
uses: codecov/[email protected]
with:
Expand All @@ -83,17 +72,36 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: Install Poetry and dependencies without dev-dependencies
- name: Install the project
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
poetry install --no-interaction --only main
uv sync --all-extras
uv run pip install -e .
install-build:
name: Install SpectraFit from wheel
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: Setup the project
run: |
uv sync --all-extras
uv build
- name: Install the wheel
run: |
uv pip install dist/*.whl
uv run spectrafit -v
documentation:
name: Build Documentation
runs-on: ubuntu-latest
Expand All @@ -102,27 +110,24 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- name: Install uv and dependencies with doc-dependencies
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: Install Poetry and dependencies with doc-dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
poetry install --no-interaction --with docs --all-extras
- name: Install the project
run: uv sync --all-extras --group docs
- name: Set git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Build documentation
if: ${{ !contains(github.ref, 'refs/heads/main')}}
run: poetry run mkdocs build --clean
run: uv run --group docs --all-extras mkdocs build --clean
- name: Deploy documentation develops
if: contains(github.ref, 'refs/heads/main')
run: poetry run mike deploy --push --update-aliases develop
run: uv run --group docs --all-extras mike deploy --push --update-aliases develop
devcontainer:
name: Devcontainer
needs: build
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/update-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Poetry and dependencies with doc-dependencies
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: Install the project
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
poetry install --no-interaction --with docs --all-extras
- name: Install library
run: poetry install --no-interaction --with docs --all-extras
uv sync --all-extras --all-groups
- name: Set git config
run: |
git config --local user.email "[email protected]"
Expand All @@ -108,9 +107,9 @@ jobs:
previous_version=$(echo $previous_tag | cut -d '.' -f 1,2)
current_version=$(echo $current_tag | cut -d '.' -f 1,2)
if [[ "$previous_version" == "$current_version" ]]; then
poetry run mike delete ${{ steps.previous_release.outputs.previous_tag }} --push
uv run mike delete ${{ steps.previous_release.outputs.previous_tag }} --push
fi
- name: Deploy documentation develops
run: |
poetry run mike deploy --push --update-aliases ${{ github.event.release.tag_name }} latest --message "Release ${{ github.event.release.tag_name }}"
poetry run mike set-default --push latest
uv run mike deploy --push --update-aliases ${{ github.event.release.tag_name }} latest --message "Release ${{ github.event.release.tag_name }}"
uv run mike set-default --push latest
Loading

0 comments on commit 3596f33

Please sign in to comment.