Skip to content

Switch to Poetry for dependency management and package description #356

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

Merged
merged 30 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
eac1e54
Add poetry configuration file and update project dependencies
cx1111 Apr 11, 2022
832d1b1
Update package description and patch version. Remove version.py file
cx1111 Apr 11, 2022
d8590da
Remove requirements.txt, setup.py, and MANIFEST.in. Update GH Actions…
cx1111 Apr 11, 2022
aebb215
Merge branch 'master' into cx/poetry
cx1111 Apr 11, 2022
e3be731
Add Sphinx to dev dependencies
cx1111 Apr 12, 2022
3590737
Remove old __version__ variable
cx1111 Apr 12, 2022
d326a13
Update contact email. Correct python version matrix and bump debian c…
cx1111 Apr 12, 2022
4c89ddb
Correct poetry install command in actions
cx1111 Apr 12, 2022
fda67a3
Update nosetest call
cx1111 Apr 12, 2022
7fb2539
Debug test
cx1111 Apr 12, 2022
c0d3a3e
Debug test
cx1111 Apr 12, 2022
bb5a8aa
Update dependencies to working set with Python 3.7
cx1111 Apr 13, 2022
e3ab58c
Add installation notes
cx1111 Apr 13, 2022
36bbf04
Update CI python-version to include 3.7
cx1111 Apr 13, 2022
d32b56e
Reset Actions to use debian 10
cx1111 Apr 13, 2022
ac1d9a7
Restore version file
cx1111 Apr 13, 2022
e93046d
Lower min dependency versions
cx1111 Apr 15, 2022
674827f
Revert install instructions
cx1111 Apr 15, 2022
215bf79
Add requests
cx1111 Apr 15, 2022
2864f7b
Merge branch 'master' into cx/poetry
cx1111 Apr 15, 2022
3869ec8
Update actions file
cx1111 Apr 15, 2022
57d4ee3
Try calling nose with python
cx1111 Apr 16, 2022
c653d67
Try separate command
cx1111 Apr 16, 2022
6643046
Replace nose with pytest
cx1111 Apr 17, 2022
d0c8a40
Do not install wfdb for dept install action
cx1111 Apr 17, 2022
e062b0c
Test
cx1111 Apr 17, 2022
8961b5f
Use optional for dev dependencies. Use pip instead of poetry for CI
cx1111 Apr 18, 2022
f3616b9
Correct escaping
cx1111 Apr 18, 2022
a9564e0
Tighten Python versions and update developer docs
cx1111 Apr 18, 2022
d90a1f3
Restore Python compat versions
cx1111 Apr 20, 2022
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
15 changes: 8 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -27,11 +27,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run nosetests
run: |
nosetests
python -m pip install --upgrade pip poetry
pip install ".[dev]"
Copy link
Member Author

@cx1111 cx1111 Apr 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using pip to install the dependencies instead of poetry for a few reasons:

  • We want to support pip installations. This will probably be the primary way for most users.
  • A deployment doesn't actually need poetry, which would add another dependency. Use poetry primarily for developing.
  • Poetry has its own system of managing environments, and where packages are installed by default, which can get complex. https://realpython.com/dependency-management-python-poetry/ eg. When trying to run the CI earlier with poetry, poetry install would install the packages (including the test executable) into ~/.cache which weren't automatically usable by the system installed Python (causing all those test failures). We don't need to deal with this.

- name: Run tests
run: nosetests
- name: Validate poetry file
run: poetry check

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

- name: Run nosetests
- name: Run tests
run: |
nosetests3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ target/

# OSX .DS_Store
.DS_Store

# pyenv
.python-version
12 changes: 0 additions & 12 deletions MANIFEST.in

This file was deleted.

36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,56 @@ See the [demo.ipynb](https://github.com/MIT-LCP/wfdb-python/blob/master/demo.ipy

## Installation

The distribution is hosted on pypi at: <https://pypi.python.org/pypi/wfdb/>. To directly install the package from pypi, run from your terminal::
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:

```sh
pip install wfdb
poetry add wfdb
```

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:

```sh
# Without dev dependencies
pip install .
```
poetry install

## Development
# With dev dependencies
pip install ".[dev]"
poetry install -E dev
```

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

## Contributing
## Developing

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

- [PEP8](https://www.python.org/dev/peps/pep-0008/) style guidelines are followed.
- 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).
- Unit tests are written for new features that are not covered by [existing tests](https://github.com/MIT-LCP/wfdb-python/tree/master/tests).

### Package Management

This project uses [poetry](https://python-poetry.org/docs/) for package management and distribution.

Development dependencies are specified as optional dependencies, and then added to the "dev" extra group in the [pyproject.toml](./pyproject.toml) file.

```sh
# Do NOT use: poetry add <somepackage> --dev
poetry add --optional <somepackage>
```

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.

Make sure the versions in [version.py](./wfdb/version.py) and [pyproject.toml](./pyproject.toml) are kept in sync.

To upload a new distribution to PyPI:

```sh
poetry publish
```

## Citing

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