Skip to content

Commit 994b794

Browse files
authored
Switch to Poetry for dependency management and package description (#356)
* Add poetry configuration file and update project dependencies * Update package description and patch version. * Remove requirements.txt, setup.py, and MANIFEST.in. * Update GH workflows. Set test Python version matrix to 3.7, 3.8, 3.9. * Add instructions for developing with Poetry and downloading dependencies
1 parent b84a765 commit 994b794

File tree

9 files changed

+593
-137
lines changed

9 files changed

+593
-137
lines changed

.github/workflows/run-tests.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
os: [windows-latest, ubuntu-latest, macos-latest]
21-
python-version: [3.6, 3.7, 3.8]
21+
python-version: ["3.7", "3.8", "3.9"]
2222
steps:
2323
- uses: actions/checkout@v2
2424
- name: Set up Python ${{ matrix.python-version }}
@@ -27,11 +27,12 @@ jobs:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install dependencies
2929
run: |
30-
python -m pip install --upgrade pip
31-
pip install -r requirements.txt
32-
- name: Run nosetests
33-
run: |
34-
nosetests
30+
python -m pip install --upgrade pip poetry
31+
pip install ".[dev]"
32+
- name: Run tests
33+
run: nosetests
34+
- name: Validate poetry file
35+
run: poetry check
3536

3637
test-deb10-i386:
3738
runs-on: ubuntu-latest
@@ -55,6 +56,6 @@ jobs:
5556
# https://github.com/actions/checkout/issues/334
5657
- uses: actions/checkout@v1
5758

58-
- name: Run nosetests
59+
- name: Run tests
5960
run: |
6061
nosetests3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@ target/
6969

7070
# OSX .DS_Store
7171
.DS_Store
72+
73+
# pyenv
74+
.python-version

MANIFEST.in

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,56 @@ See the [demo.ipynb](https://github.com/MIT-LCP/wfdb-python/blob/master/demo.ipy
2121

2222
## Installation
2323

24-
The distribution is hosted on pypi at: <https://pypi.python.org/pypi/wfdb/>. To directly install the package from pypi, run from your terminal::
24+
The distribution is hosted on PyPI at: <https://pypi.python.org/pypi/wfdb/>. The package can be directly installed from PyPI using either pip or poetry:
2525

2626
```sh
2727
pip install wfdb
28+
poetry add wfdb
2829
```
2930

3031
The development version is hosted at: <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:
3132

3233
```sh
34+
# Without dev dependencies
3335
pip install .
34-
```
36+
poetry install
3537

36-
## Development
38+
# With dev dependencies
39+
pip install ".[dev]"
40+
poetry install -E dev
41+
```
3742

38-
The package is to be expanded with physiological signal-processing tools, and general improvements. Development is made for Python 3.6+ only.
43+
See the [note](#package-management) below about dev dependencies.
3944

40-
## Contributing
45+
## Developing
4146

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

4449
- [PEP8](https://www.python.org/dev/peps/pep-0008/) style guidelines are followed.
4550
- Documentation is provided. New functions and classes should have numpy/scipy style [docstrings](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt).
4651
- Unit tests are written for new features that are not covered by [existing tests](https://github.com/MIT-LCP/wfdb-python/tree/master/tests).
4752

53+
### Package Management
54+
55+
This project uses [poetry](https://python-poetry.org/docs/) for package management and distribution.
56+
57+
Development dependencies are specified as optional dependencies, and then added to the "dev" extra group in the [pyproject.toml](./pyproject.toml) file.
58+
59+
```sh
60+
# Do NOT use: poetry add <somepackage> --dev
61+
poetry add --optional <somepackage>
62+
```
63+
64+
The `[tool.poetry.dev-dependencies]` attribute is NOT used because of a [limitation](https://github.com/python-poetry/poetry/issues/3514) that prevents these dependencies from being pip installable. Therefore, dev dependencies are not installed when purely running `poetry install`, and the `--no-dev` flag has no meaning in this project.
65+
66+
Make sure the versions in [version.py](./wfdb/version.py) and [pyproject.toml](./pyproject.toml) are kept in sync.
67+
68+
To upload a new distribution to PyPI:
69+
70+
```sh
71+
poetry publish
72+
```
73+
4874
## Citing
4975

5076
When using this resource, please cite the software [publication](https://physionet.org/content/wfdb-python/) oh PhysioNet.

0 commit comments

Comments
 (0)