Skip to content

Conversation

SnoopJ
Copy link
Contributor

@SnoopJ SnoopJ commented Dec 6, 2023

Closes #471

This changeset adds numpydoc to the documentation build requirements, better distinguishing between parameters and return values.

Typical function documentation before this changeset:

Screenshot of wfdb documentation for wfdb.processing.get_filter_gain() showing the return values listed alongside parameters with no distinction between the two

After this changeset:

Screenshot of wfdb documentation for wfdb.processing.get_filter_gain() showing the return values and parameters listed separately and with explicit labels

Note that this does produce some Sphinx errors and warnings when building the documentation, generally because wfdb is not following numpydoc style exactly. Most of them look like small tweaks, many of them can probably be resolved by removing unnecessary indentation or introducing a literal code block. I'll leave that to the maintainers.

click for build log
Running Sphinx v4.5.0 making output directory... done [autosummary] generating autosummary for: changes.rst, convert.rst, index.rst, installation.rst, io.rst, plot.rst, processing.rst, wfdb-specifications.rst, wfdb.rst building [mo]: targets for 0 po files that are out of date building [html]: targets for 9 source files that are out of date updating environment: [new config] 9 added, 0 changed, 0 removed reading sources... [ 11%] changes reading sources... [ 22%] convert reading sources... [ 33%] index reading sources... [ 44%] installation reading sources... [ 55%] io reading sources... [ 66%] plot reading sources... [ 77%] processing reading sources... [ 88%] wfdb reading sources... [100%] wfdb-specifications /tmp/wfdb-python/venv/lib/python3.8/site-packages/numpydoc/docscrape.py:460: UserWarning: Unknown section Examples: in the docstring of adc in /tmp/wfdb-python/wfdb/io/_signal.py. warn(msg) /tmp/wfdb-python/venv/lib/python3.8/site-packages/numpydoc/docscrape.py:460: UserWarning: Unknown section Examples: in the docstring of adc in /tmp/wfdb-python/wfdb/io/_signal.py. warn(msg) /tmp/wfdb-python/venv/lib/python3.8/site-packages/numpydoc/docscrape.py:460: UserWarning: potentially wrong underline length... Parameters ------- in Main comparison function. Note: Make sure to be able to handle these ref/test scenarios:... in the docstring of compare in /tmp/wfdb-python/wfdb/processing/evaluate.py. warn(msg) /tmp/wfdb-python/venv/lib/python3.8/site-packages/numpydoc/docscrape.py:460: UserWarning: Unknown section Example in the docstring of compare in /tmp/wfdb-python/wfdb/processing/evaluate.py. warn(msg) /tmp/wfdb-python/venv/lib/python3.8/site-packages/numpydoc/docscrape.py:460: UserWarning: Unknown section Examples: in the docstring of adc in /tmp/wfdb-python/wfdb/io/_signal.py. warn(msg) /tmp/wfdb-python/venv/lib/python3.8/site-packages/numpydoc/docscrape.py:460: UserWarning: Unknown section Examples: in the docstring of adc in /tmp/wfdb-python/wfdb/io/_signal.py. warn(msg) /tmp/wfdb-python/wfdb/io/convert/csv.py:docstring of wfdb.io.convert.csv.csv_to_wfdb:273: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/convert/csv.py:docstring of wfdb.io.convert.csv.csv_to_wfdb:279: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.rdedfann:5: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.rdedfann:10: WARNING: Definition list ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.rdedfann:12: WARNING: Definition list ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.rdedfann:13: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.read_edf:102: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.read_edf:103: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.wfdb_to_edf:91: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/convert/edf.py:docstring of wfdb.io.convert.edf.wfdb_to_edf:92: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/convert/matlab.py:docstring of wfdb.io.convert.matlab.wfdb_to_mat:81: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/convert/matlab.py:docstring of wfdb.io.convert.matlab.wfdb_to_mat:82: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/convert/wav.py:docstring of wfdb.io.convert.wav.read_wav:59: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/convert/wav.py:docstring of wfdb.io.convert.wav.read_wav:62: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/convert/wav.py:docstring of wfdb.io.convert.wav.read_wav:65: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/__init__.py:docstring of wfdb.io.record.rdsamp:54: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.io.Record.adc'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.io.Record.dac'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.io.Record.get_absolute_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.io.Record.get_elapsed_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.io.Record.get_frame_number'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.io.Record.to_dataframe'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.io.Record.wrsamp'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.io.MultiRecord.contained_combined_ranges'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.io.MultiRecord.contained_ranges'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.io.MultiRecord.get_absolute_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.io.MultiRecord.get_elapsed_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.io.MultiRecord.get_frame_number'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.io.MultiRecord.multi_to_single'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/docs/io.rst:24: WARNING: Title underline too short. WFDB Annotations --------------- /tmp/wfdb-python/docs/io.rst:24: WARNING: Title underline too short. WFDB Annotations --------------- /tmp/wfdb-python/wfdb/io/__init__.py:docstring of wfdb.io:1: WARNING: duplicate object description of wfdb.io, other instance in io, use :noindex: for one of them /tmp/wfdb-python/wfdb/io/annotation.py:docstring of wfdb.io.annotation.Annotation:62: WARNING: Definition list ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/annotation.py:docstring of wfdb.io.annotation.Annotation:80: WARNING: Definition list ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/annotation.py:docstring of wfdb.io.annotation.Annotation:152: WARNING: autosummary: stub file not found 'wfdb.io.Annotation.wrann'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/__init__.py:docstring of wfdb.io:1: WARNING: duplicate object description of wfdb.io, other instance in io, use :noindex: for one of them /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing:1: WARNING: duplicate object description of wfdb.processing, other instance in processing, use :noindex: for one of them /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing:1: WARNING: duplicate object description of wfdb.processing, other instance in processing, use :noindex: for one of them /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing:1: WARNING: duplicate object description of wfdb.processing, other instance in processing, use :noindex: for one of them /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing:1: WARNING: duplicate object description of wfdb.processing, other instance in processing, use :noindex: for one of them /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing.qrs.gqrs_detect:110: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing.qrs.gqrs_detect:112: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing.qrs.gqrs_detect:115: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing.qrs.gqrs_detect:117: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing.qrs.gqrs_detect:122: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/processing/__init__.py:docstring of wfdb.processing:1: WARNING: duplicate object description of wfdb.processing, other instance in processing, use :noindex: for one of them /tmp/wfdb-python/wfdb/processing/evaluate.py:docstring of wfdb.processing.evaluate.Comparitor.compare:6: WARNING: Title underline too short. Parameters ------- /tmp/wfdb-python/wfdb/processing/evaluate.py:docstring of wfdb.processing.evaluate.Comparitor.compare:6: CRITICAL: Unexpected section title. Parameters ------- /tmp/wfdb-python/wfdb/__init__.py:docstring of wfdb.io.record.rdsamp:54: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:1: WARNING: duplicate object description of wfdb.io.record.Record, other instance in io, use :noindex: for one of them /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.Record.adc'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.Record.dac'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.Record.get_absolute_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.Record.get_elapsed_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.Record.get_frame_number'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.Record.to_dataframe'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.Record:141: WARNING: autosummary: stub file not found 'wfdb.Record.wrsamp'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:1: WARNING: duplicate object description of wfdb.io.record.MultiRecord, other instance in io, use :noindex: for one of them /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.MultiRecord.contained_combined_ranges'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.MultiRecord.contained_ranges'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.MultiRecord.get_absolute_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.MultiRecord.get_elapsed_time'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.MultiRecord.get_frame_number'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.MultiRecord:103: WARNING: autosummary: stub file not found 'wfdb.MultiRecord.multi_to_single'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_absolute_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_elapsed_time:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:6: ERROR: Unexpected indentation. /tmp/wfdb-python/wfdb/io/record.py:docstring of wfdb.io.record.BaseRecord.get_frame_number:7: WARNING: Block quote ends without a blank line; unexpected unindent. /tmp/wfdb-python/docs/wfdb.rst:24: WARNING: Title underline too short. WFDB Annotations --------------- /tmp/wfdb-python/docs/wfdb.rst:24: WARNING: Title underline too short. WFDB Annotations --------------- /tmp/wfdb-python/wfdb/__init__.py:docstring of wfdb:1: WARNING: duplicate object description of wfdb, other instance in wfdb, use :noindex: for one of them /tmp/wfdb-python/wfdb/io/annotation.py:docstring of wfdb.io.annotation.Annotation:1: WARNING: duplicate object description of wfdb.io.annotation.Annotation, other instance in io, use :noindex: for one of them /tmp/wfdb-python/wfdb/io/annotation.py:docstring of wfdb.io.annotation.Annotation:62: WARNING: Definition list ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/annotation.py:docstring of wfdb.io.annotation.Annotation:80: WARNING: Definition list ends without a blank line; unexpected unindent. /tmp/wfdb-python/wfdb/io/annotation.py:docstring of wfdb.io.annotation.Annotation:152: WARNING: autosummary: stub file not found 'wfdb.Annotation.wrann'. Check your autosummary_generate setting. /tmp/wfdb-python/wfdb/__init__.py:docstring of wfdb:1: WARNING: duplicate object description of wfdb, other instance in wfdb, use :noindex: for one of them /tmp/wfdb-python/wfdb/__init__.py:docstring of wfdb:1: WARNING: duplicate object description of wfdb, other instance in wfdb, use :noindex: for one of them looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [ 11%] changes writing output... [ 22%] convert writing output... [ 33%] index writing output... [ 44%] installation writing output... [ 55%] io writing output... [ 66%] plot writing output... [ 77%] processing writing output... [ 88%] wfdb writing output... [100%] wfdb-specifications generating indices... genindex py-modindex done writing additional pages... search done copying static files... done copying extra files... done dumping search index in English (code: en)... done dumping object inventory... done build succeeded, 97 warnings. The HTML pages are in _build/html. 
@bemoody
Copy link
Collaborator

bemoody commented Dec 7, 2023

Excellent, thank you!

@bemoody bemoody merged commit 7b58dad into MIT-LCP:main Dec 7, 2023
tompollard added a commit that referenced this pull request Jan 21, 2025
This pull request adds a changelog for `v4.2.0`. The changelog is based on the following auto-generated summary of merge commits generated by GitHub: ``` ## What's Changed * bug-fix: Numpy ValueError when cheking empty list equality by @ajadczaksunriselabs in #459 * bug-fix: Pandas set indexing error by @ajadczaksunriselabs in #460 * fix for /issues/452 by @tecamenz in #465 * Use numpydoc to render documentation by @SnoopJ in #472 * build(deps): bump readthedocs-sphinx-search from 0.1.1 to 0.3.2 in /docs by @dependabot in #477 * Update style by @bemoody in #482 * Fix NaN handling in Record.adc, and other fixes by @bemoody in #481 * Set upper bound on Numpy version (numpy = ">=1.10.1,<2.0.0"). Ref #493. by @tompollard in #494 * Update actions to use actions/checkout@v3 and actions/setup-python@v4. by @tompollard in #495 * Fix: Indent code to ensure 'j' is within for-loop in GQRS algorithm by @tompollard in #499 * Add write_dir argument to csv_to_wfdb. Fixes #67. by @tompollard in #492 * Fix warnings by @cbrnr in #502 * README improvements by @bemoody in #503 * Change in type promotion. Fixes to annotation.py by @tompollard in #506 * Use uv by @cbrnr in #504 * Change in type promotion. Fixes to _signal.py by @tompollard in #507 * Test round-trip write/read of supported binary formats by @bemoody in #509 * Corrected typo and extended allowed types for MultiSegmentRecord by @agent3gatech in #514 * Allow expanded physical signal in `calc_adc_params` by @briangow in #512 * Add capability to write signal with unique `samps_per_frame` to `wfdb.io.wrsamp` by @briangow in #510 * Fix selection of channels when converting to EDF by @SamJelfs in #519 * Change in type promotion introduced in Numpy 2.0. Fixes to edf.py. by @tompollard in #527 * Bump dependencies for NumPy 2 compatibility by @cbrnr in #511 * Bump version to v4.2.0 and update notes on creating new releases by @tompollard in #497 ## New Contributors * @ajadczaksunriselabs made their first contribution in #459 * @tecamenz made their first contribution in #465 * @SnoopJ made their first contribution in #472 * @dependabot made their first contribution in #477 * @agent3gatech made their first contribution in #514 * @SamJelfs made their first contribution in #519 **Full Changelog**: v4.1.2...v4.2.0 ```
@SnoopJ SnoopJ deleted the bugfix/use-numpydoc branch January 21, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants