pyOpenMS are the Python bindings to the OpenMS open-source C++ library for LC-MS data management and analyses. This repository contains documentation, installation instructions, and example code that show different functions of pyOpenMS.
- Documentation Architecture
- Build System
- Notebook Pipeline
- CI/CD Workflows
- Development Guide
- Binder Integration
- Troubleshooting
The pyOpenMS documentation system is built on several interconnected components:
- Sphinx: Static site generator for documentation (v6.1.0)
- PyData Sphinx Theme: Modern, responsive documentation theme
- Pandoc: Universal document converter for RST → Jupyter notebook conversion
- Jupyter: Interactive notebook environment for examples
- ReadTheDocs: Documentation hosting platform
pyopenms-docs/
├── .github/workflows/ # CI/CD pipelines
├── docs/
│ ├── source/ # RST documentation source files
│ │ ├── _ext/ # Custom Sphinx extensions
│ │ ├── _static/ # Static assets (CSS, JS, images)
│ │ ├── _templates/ # Custom Sphinx templates
│ │ ├── apidocs/ # API documentation configuration
│ │ ├── user_guide/ # User guide RST files
│ │ ├── community/ # Community documentation
│ │ └── conf.py # Sphinx configuration
│ ├── pandoc_filters/ # Custom filters for RST→notebook conversion
│ ├── Makefile # Build automation
│ └── requirements.txt # Documentation dependencies
├── src/ # Example code and data files
├── environment.yml # Binder environment configuration
└── postBuild # Binder post-installation script
- Create and activate a Python virtual environment:
python -m venv /path/to/myenv
source /path/to/myenv/bin/activate # Linux/Mac
# or
path\to\myenv\Scripts\activate.bat # Windows- Install dependencies:
cd docs/
pip install -r requirements.txtcd docs/
make html # Builds HTML docs in build/html/The build process:
- Sphinx reads all RST files from
source/ - Applies custom extensions and themes
- Generates API documentation using autodoc
- Outputs HTML to
build/html/
cd docs/
make doc # Runs source/generate_ipynb.shThis converts all RST files to Jupyter notebooks using Pandoc with custom filters.
cd docs/
make linkcheckKey configuration in docs/source/conf.py:
- Theme: PyData Sphinx Theme with custom options
- Extensions:
autodoc&autosummary: Automatic API documentationhoverxref: Interactive tooltips for glossary termssphinx_copybutton: Code block copy buttons- Custom extensions:
chemrole,glossary_warnings
- Version Management: Automatic version detection from git branches
- Custom Assets: CSS, JavaScript, and logo files
The notebook generation pipeline converts documentation from RST format to interactive Jupyter notebooks:
- Source: RST files in
docs/source/ - Conversion Tool: Pandoc with custom filters
- Output: Jupyter notebooks (
.ipynbfiles)
The generate_ipynb.sh script:
pandoc ${FILE}.rst -o ${FILE}.ipynb \
--resource-path user_guide/ \
--filter ../pandoc_filters/admonitionfilter.py \
--filter ../pandoc_filters/code_pandocfilter.py \
--filter ../pandoc_filters/ignore_pandocfilter.py \
--filter ../pandoc_filters/transformlinks_pandocfilter.py \
--filter ../pandoc_filters/transformreferences_pandocfilter.pyLocated in docs/pandoc_filters/:
- admonitionfilter.py: Converts RST admonitions to notebook-friendly format
- code_pandocfilter.py: Handles code block formatting and execution cells
- ignore_pandocfilter.py: Skips certain RST directives not needed in notebooks
- transformlinks_pandocfilter.py: Converts documentation links
- transformreferences_pandocfilter.py: Handles cross-references
- master: Contains source RST files and documentation
- master+ipynb: Auto-generated branch with compiled Jupyter notebooks
- Created by CI/CD on push to master
- Used by Binder for interactive environments
- Prevents cluttering master with generated files
All workflows are located in .github/workflows/:
Trigger: Push to master branch
Purpose: Generate Jupyter notebooks and push to master+ipynb branch
Steps:
- Setup Python 3.10 and Pandoc 3.1.2
- Install dependencies (Jupyter, requirements.txt)
- Run
make docto generate notebooks from RST - Commit and force-push to master+ipynb branch
Trigger: Push to master+ipynb branch or manual
Purpose: Test all generated notebooks for execution errors
Steps:
- Setup Python 3.10
- Install dependencies
- Execute all notebooks using
jupyter nbconvert --execute - Report any failed notebooks
Trigger: Pull requests to master
Purpose: Verify Sphinx documentation builds successfully
Steps:
- Setup Python 3.11
- Install documentation requirements
- Optionally install custom pyOpenMS wheel (via workflow input)
- Build HTML documentation with
make html
Trigger: Pull requests to master
Purpose: Test notebook generation for changed RST files
Steps:
- Detect changed RST files using tj-actions/changed-files
- Setup Pandoc 3.1.2
- Generate notebooks for changed files
- Execute generated notebooks to verify they work
Trigger: Pull requests
Purpose: Lint Python code blocks in RST files
Steps:
- Install blacken-docs
- Run on changed RST files
- Check for parse errors
- Suggest formatting fixes via reviewdog
Trigger: Pull requests
Purpose: Python code quality checks
Steps:
- Run flake8 linter
- Report violations on PR
- Fail on new violations
-
Create RST file in appropriate directory:
- User guides:
docs/source/user_guide/ - API docs:
docs/source/apidocs/ - Community docs:
docs/source/community/
- User guides:
-
Add to table of contents in
index.rst:
.. toctree::
:maxdepth: 2
your_new_file- Include code examples:
.. code-block:: python
import pyopenms as oms
# Your code here- Test locally:
cd docs/
make html
# Open build/html/index.html in browser- Generate notebook from RST:
cd docs/source/
pandoc your_file.rst -o your_file.ipynb \
--filter ../pandoc_filters/code_pandocfilter.py- Test execution:
jupyter nbconvert --to notebook --execute your_file.ipynbAPI documentation is auto-generated using Sphinx autodoc:
- Configuration:
docs/source/apidocs/index.rst - Templates:
docs/source/_templates/custom-*.rst - Build: Automatically included in
make html
The autosummary extension recursively documents all pyOpenMS modules and classes.
Located in docs/source/_ext/:
- chemrole.py: Adds chemical formula rendering support
- glossary_warnings.py: Validates glossary term usage
Binder provides interactive Jupyter environments for documentation:
-
environment.yml: Conda environment specification
- Python 3.10
- Required packages via pip
-
postBuild: Post-installation script
- Installs nightly pyOpenMS from custom PyPI
- Configures Jupyter settings
-
jupyter_notebook_config.py: Jupyter configuration
Access notebooks via Binder:
- Latest: https://mybinder.org/v2/gh/OpenMS/pyopenms-docs/master+ipynb
- Specific branch: Replace
master+ipynbwith branch name
- Core: sphinx==6.1.0, pydata_sphinx_theme
- Extensions: sphinx-copybutton, sphinx-hoverxref, sphinx-remove-toctrees
- Utilities: ipython, snowballstemmer<3
- pyOpenMS: From custom PyPI server
- Visualization: matplotlib, plotly, bokeh, holoviews
- Data Science: pandas, scikit-learn
- MS-specific: massql, pyopenms
- Utilities: requests, tabulate, adjustText
- Check Pandoc version: Must be 3.1.2+
- Verify filters: Ensure all pandoc_filters/*.py are present
- RST syntax: Validate RST with
rst2html
- Clear cache:
rm -rf docs/build/ - Check imports: Ensure pyOpenMS is installed
- Version conflicts: Review requirements.txt versions
- Notebook tests: Check for missing dependencies
- Linting: Run
blacken-docslocally - PR tests: Ensure RST files are valid
- Build logs: Check Binder build output
- Environment: Verify environment.yml syntax
- postBuild: Ensure script is executable
- Issues: https://github.com/OpenMS/pyopenms-docs/issues
- Discord: https://discord.com/invite/4TAGhqJ7s5
- Documentation: https://pyopenms.readthedocs.io/
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Ensure tests pass locally
- Submit a pull request
All PRs trigger automated testing for documentation build, notebook generation, and code quality.
See License.txt for licensing information.