Skip to content

Commit defb4e6

Browse files
authored
Add instructions for generating documentation (MIT-LCP#361)
* Add Sphinx to dependencies * Add document building workflow * Add a requirements.txt file for readthedocs * Add a warning for the major v4 breaking changes
1 parent 034c761 commit defb4e6

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

.github/workflows/run-tests.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,16 @@ jobs:
6161
- name: Run tests
6262
run: |
6363
pytest-3
64+
65+
build-documentation:
66+
runs-on: ubuntu-20.04
67+
steps:
68+
- uses: actions/checkout@v2
69+
- name: Install dependencies
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install -r docs/requirements.txt
73+
- name: Build documentation
74+
run: |
75+
cd docs
76+
make html

.readthedocs.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# File: .readthedocs.yaml
2+
3+
version: 2
4+
5+
build:
6+
os: "ubuntu-20.04"
7+
tools:
8+
python: "3.9"
9+
10+
# Build from the docs/ directory with Sphinx
11+
sphinx:
12+
configuration: docs/conf.py
13+
14+
# Explicitly set the version of Python and its requirements
15+
python:
16+
install:
17+
- requirements: docs/requirements.txt

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
[![PhysioNet Project](https://img.shields.io/badge/DOI-10.13026%2Fegpf--2788-blue)](https://doi.org/10.13026/egpf-2788)
88
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/wfdb.svg)](https://pypi.org/project/wfdb)
99

10+
## v4 Announcement
11+
12+
[Major breaking changes](https://github.com/MIT-LCP/wfdb-python/issues/369) are planned for WFDB v4, in the core APIs, and the installation method. The planned release date is in August 2022.
13+
14+
- Stable v3 documentation: <https://wfdb.readthedocs.io/en/stable/>
15+
- WIP v4 documentation: <https://wfdb.readthedocs.io/en/latest/>
16+
1017
## Introduction
1118

1219
A Python-native package for reading, writing, processing, and plotting physiologic signal and annotation data. The core I/O functionality is based on the Waveform Database (WFDB) [specifications](https://github.com/wfdb/wfdb-spec/).
@@ -80,6 +87,20 @@ To upload a new distribution to PyPI:
8087
poetry publish
8188
```
8289

90+
### Creating Documentation
91+
92+
The project's documentation is generated by [Sphinx](https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html) using the content in the [docs](./docs) directory. The generated content is then hosted on readthedocs (RTD) at: <http://wfdb.readthedocs.io>
93+
94+
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.
95+
96+
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.
97+
98+
To generate the HTML content locally, install the required dependencies and run from the `docs` directory:
99+
100+
```sh
101+
make html
102+
```
103+
83104
### Tests
84105

85106
Run tests using pytest:

docs/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sphinx==4.5.0
2+
sphinx_rtd_theme==1.0.0
3+
readthedocs-sphinx-search==0.1.1

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ pytest = {version = "^7.1.1", optional = true}
1616
pytest-xdist = {version = "^2.5.0", optional = true}
1717
pylint = {version = "^2.13.7", optional = true}
1818
black = {version = "^22.3.0", optional = true}
19+
Sphinx = {version = "^4.5.0", optional = true}
1920

2021
[tool.poetry.extras]
21-
dev = ["pytest", "pytest-xdist", "pylint", "black"]
22+
dev = ["pytest", "pytest-xdist", "pylint", "black", "Sphinx"]
2223

2324
# Do NOT use [tool.poetry.dev-dependencies]. See: https://github.com/python-poetry/poetry/issues/3514
2425

0 commit comments

Comments
 (0)