Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use uv for package management #31

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,26 @@ jobs:

steps:
- uses: actions/checkout@v4

# Following steps given here: https://docs.astral.sh/uv/guides/integration/github/#setting-up-python
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.lock ]; then pip install -r requirements.lock; fi
run: uv python install ${{ matrix.python-version }}

- name: Install the project
run: uv sync --all-extras --dev

- name: Lint with Ruff
run: |
pip install ruff
ruff --format=github --target-version=py310 .
run: uv run ruff check --output-format=github --target-version=py310 .
continue-on-error: true

- name: Test with pytest
run: |
pip install coverage pytest
coverage run -m pytest -v -s
uv pip install pytest-cov
uv run pytest -v -s --cov=acoustic_toolbox tests/

- name: Generate Coverage Report
run: |
coverage report -m
run: uv run coverage report -m

16 changes: 8 additions & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ version: "2"
build:
os: "ubuntu-22.04"
tools:
python: "3.10"
python: "3.12"
apt_packages:
- graphviz

python:
install:
- requirements: docs/requirements.txt
# Install our python package before building the docs
- method: pip
path: .
commands:
# Following documentation at https://docs.readthedocs.io/en/latest/build-customization.html#install-dependencies-with-uv
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv sync --extra docs --frozen
- uv run -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html

sphinx:
configuration: docs/source/conf.py
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Several examples can be found in the `examples` folder.

The test suite can be run with

`pytest`
`uv run pytest`

## Documentation

Expand All @@ -40,6 +40,11 @@ Documentation can be found [online](http://acoustic-toolbox.readthedocs.io/).

Contributors are always welcome.

Setting up the development environment and dependency management is done with `uv`. `uv` can be installed [from source](https://docs.astral.sh/uv/getting-started/installation/#standalone-installer) or with `pip install uv`.

To install the development environment, run `uv sync --all-extras` in the root of the repository. This will setup a `.venv` and install all dependencies including dev and docs dependencies.

Documentation is built with `uv run make html` from the `docs` folder and can be viewed in the `docs/build/html` folder.

## Origin project

Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ docs = [
[tool.flit.sdist]
include = ["tests/"]

[tool.rye]
universal = true
[tool.uv]
dev-dependencies = [
"ruff>=0.5.5",
"pytest>=8.3.2",
"coverage>=7.6.0",
]

[tool.uv.pip]
universal = true
Loading
Loading