Skip to content
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ updates:
directory: "/"
schedule:
interval: "monthly"
groups:
actions:
patterns: ["*"]
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "monthly"
# Bump exact pins and upper bounds, but leave lower bounds alone
versioning-strategy: increase-if-necessary
cooldown:
default-days: 7
14 changes: 4 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- uses: astral-sh/[email protected]
- name: Install Python
run: uv python install 3.12
- name: Build documentation
run: |
cd docs
make html
run: uv run --python 3.12 --only-group docs make -C docs html
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ jobs:
run: uv python install 3.11
- name: Check style
run: |
uv run --extra dev ruff format --check --diff .
uv run --extra dev ruff check .
uv run ruff format --check --diff .
uv run ruff check .
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Run tests
env:
MPLBACKEND: Agg
run: uv run --python ${{ matrix.python-version }} --extra dev pytest
run: uv run --python ${{ matrix.python-version }} pytest

# Make sure the lower bounds of the direct dependencies are actually usable
test-minimum:
Expand All @@ -46,4 +46,4 @@ jobs:
- name: Run tests
env:
MPLBACKEND: Agg
run: uv run --python 3.11 --resolution lowest-direct --extra dev pytest
run: uv run --python 3.11 --resolution lowest-direct pytest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ target/

# pyenv
.python-version

# Not committed: CI resolves dependencies fresh
uv.lock
14 changes: 9 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ build:
os: "ubuntu-24.04"
tools:
python: "3.12"
jobs:
pre_create_environment:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --only-group docs

# Build from the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Explicitly set the version of Python and its requirements
python:
install:
- requirements: docs/requirements.txt
12 changes: 6 additions & 6 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ git config blame.ignoreRevsFile .git-blame-ignore-revs

This project uses [uv](https://docs.astral.sh/uv/) for package management and distribution.

Development dependencies are specified as optional dependencies, at least for now and until [development dependencies](https://docs.astral.sh/uv/concepts/dependencies/#development-dependencies) become more widely used.
Development dependencies are specified in the `dev` [dependency group](https://docs.astral.sh/uv/concepts/dependencies/#development-dependencies), which `uv run` installs automatically:

```sh
uv add <somepackage> --optional <somegroup>
uv add --dev <somepackage>
```

Ruff is pinned to an exact version because new releases can change formatting and lint results. Dependabot opens monthly pull requests to bump it, along with the pinned documentation dependencies, uv-build, and the GitHub Actions.

## Creating Distributions

1. Bump the version in [pyproject.toml](./pyproject.toml).
Expand Down Expand Up @@ -64,12 +66,10 @@ The project's documentation is generated by [Sphinx](https://docs.readthedocs.io

To manage the content on RTD, request yourself to be added to the [wfdb](https://readthedocs.org/projects/wfdb/) project. The project has already been configured to import content from the GitHub repository. Documentation for new releases should be automatically built and uploaded. See the [import guide](https://docs.readthedocs.io/en/stable/intro/import-guide.html) for more details.

There is some redundancy in specifying the Sphinx requirements between pyproject.toml and [docs/requirements.txt](./docs/requirements.txt), the latter of which is used by RTD. Make sure that the content is consistent across the two files.

To generate the HTML content locally, install the required dependencies and run from the `docs` directory:
The documentation dependencies are specified in the `docs` dependency group in [pyproject.toml](./pyproject.toml), which is used both locally and by RTD. To generate the HTML content locally, run:

```sh
make html
uv run --only-group docs make -C docs html
```

## Tests
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,26 @@ The distribution is hosted on PyPI at: [https://pypi.python.org/pypi/wfdb/](http
pip install wfdb
```

Alternatively, add it to a project managed with [uv](https://docs.astral.sh/uv/):

```sh
uv add wfdb
```

On some less-common systems, you may need to install `libsndfile` separately. See the [soundfile installation notes](https://pypi.org/project/soundfile/) for more information.

## Development

The development version is hosted at: [https://github.com/MIT-LCP/wfdb-python](https://github.com/MIT-LCP/wfdb-python). This repository also contains demo scripts and example data. To install the development version, clone or download the repository, navigate to the base directory, and run:
The development version is hosted at: [https://github.com/MIT-LCP/wfdb-python](https://github.com/MIT-LCP/wfdb-python). This repository also contains demo scripts and example data. To set up a development environment, install [uv](https://docs.astral.sh/uv/), clone the repository, navigate to the base directory, and run:

```sh
pip install .
uv sync
```

If you intend to make changes to the repository, you can install additional packages that are useful for development by running:
This creates a virtual environment in `.venv` containing the package and all development tools. Commands can then be run inside this environment with `uv run`, for example:

```sh
pip install ".[dev]"
uv run pytest
```

Please see the [DEVELOPING.md](https://github.com/MIT-LCP/wfdb-python/blob/main/DEVELOPING.md) document for contribution/development instructions.
Expand Down
5 changes: 0 additions & 5 deletions docs/requirements.txt

This file was deleted.

21 changes: 13 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,24 @@ dependencies = [
"aiohttp >= 3.10.11",
]

[project.optional-dependencies]
dev = [
"pytest >= 8.0.0",
"pytest-xdist >= 3.5.0",
"ruff >= 0.13.0",
"sphinx >= 7.0.0",
]

[project.urls]
homepage = "https://github.com/MIT-LCP/wfdb-python/"
repository = "https://github.com/MIT-LCP/wfdb-python/"
documentation = "https://wfdb.readthedocs.io/"

[dependency-groups]
dev = [
"pytest >= 8.0.0",
"pytest-xdist >= 3.5.0",
"ruff == 0.17.3",
]
# Heavy dependencies are mocked in docs/conf.py, so the project itself is not needed
docs = [
"fsspec >= 2023.10.0",
"numpydoc == 1.7.0",
"sphinx == 7.0.0",
]

[tool.ruff]
target-version = "py311"
extend-exclude = ["*.ipynb"]
Expand Down
Loading