Skip to content

Latest commit

 

History

History
82 lines (52 loc) · 3.53 KB

DEVELOPING.md

File metadata and controls

82 lines (52 loc) · 3.53 KB

Developing WFDB-Python

Guidelines

We welcome community contributions in the form of pull requests. When contributing code, please ensure:

  • Documentation is provided. New functions and classes should have numpy/scipy style docstrings.
  • Unit tests are written for new features that are not covered by existing tests.
  • The code style is consistent with the project's formating standards.

Run the formatter with:

black .

Package and Dependency Management

This project uses uv for package management and distribution.

Development dependencies are specified as optional dependencies, at least for now and until development dependencies become more widely used.

uv add <somepackage> --optional <somegroup>

Creating Distributions

  1. Bump the version in version.py.

  2. Add a summary of the changes to the changelog. You may also need to update the documentation. For example, if function arguments have been updated, this change will need to be captured. Open a pull request to merge these changes to the main branch.

  3. After the pull requests above have been merged, go to https://github.com/MIT-LCP/wfdb-python/releases and click "Draft new release" to create a new tag/release of the package. Set the tag to the new version number and draft the release notes (or click "Generate release notes"!).

  4. Publish the project to PyPI, the Python Package Index.

It may be useful to publish to testpypi and preview the changes before publishing to PyPi. However, the project dependencies likely will not be available when trying to install from there.

Setup: configure access to repositories:

# Create an API token, then add it
poetry config pypi-token.pypi <my-token>

# For testpypi
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi <my-testpypi-token>

To build and upload a new distribution:

uv build

uv publish --publish-url https://test.pypi.org/legacy/
uv publish

Creating Documentation

The project's documentation is generated by Sphinx using the content in the docs directory. The generated content is then hosted on readthedocs (RTD) at: http://wfdb.readthedocs.io

To manage the content on RTD, request yourself to be added to the 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 for more details.

There is some redundancy in specifying the Sphinx requirements between pyproject.toml and 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:

make html

Tests

Run tests using pytest:

pytest
# Distribute tests across multiple cores.
# https://github.com/pytest-dev/pytest-xdist
pytest -n auto