Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
81da3ee
init sphinx
Dec 16, 2025
67f353f
sphinx-apidoc first pass
Dec 16, 2025
d00f6ad
autosummary working. Mostly.
Dec 16, 2025
d27954c
Doxygen + breathe + exhale
Dec 18, 2025
d49472c
Should be api not _api
Dec 18, 2025
22bd75e
Remove duplicates in C++ docs
Jan 8, 2026
245063c
init sphinx
Dec 16, 2025
12c9437
sphinx-apidoc first pass
Dec 16, 2025
c007859
autosummary working. Mostly.
Dec 16, 2025
76d5949
Doxygen + breathe + exhale
Dec 18, 2025
6084ddb
Should be api not _api
Dec 18, 2025
91da601
Remove duplicates in C++ docs
Jan 8, 2026
f1e32c2
Merge branch 'PyORBIT-Collaboration:feature/documentation' into featu…
woodtp Jan 12, 2026
9aa4295
Write a new workflow to automatically build and publish docs to GH Pages
Jan 12, 2026
2dbff59
Merge branch 'PyORBIT-Collaboration:feature/documentation' into featu…
woodtp Jan 12, 2026
cfa0083
Don't build docs on PR
Jan 12, 2026
c66b290
Add markdown support and 'copy' button on codeblocks
Jan 13, 2026
59ce106
formatting
Jan 13, 2026
40c83cc
remove comments
Jan 13, 2026
bce103f
split into two jobs so that build and deploy can be re-run independen…
Jan 13, 2026
337e5a7
Merge branch 'PyORBIT-Collaboration:feature/documentation' into featu…
woodtp Jan 13, 2026
5f422a4
Extend deploy job timeout to 1 hour
Jan 13, 2026
7a7dca0
Merge branch 'PyORBIT-Collaboration:feature/documentation' into featu…
woodtp Jan 13, 2026
0d6552e
Move doc building to a resuable workflow
Jan 13, 2026
261d759
Merge branch 'PyORBIT-Collaboration:feature/documentation' into featu…
woodtp Jan 13, 2026
cdc67ff
this needs quotes ..?
Jan 13, 2026
433c3ff
Revert "this needs quotes ..?"
Jan 13, 2026
a597e3a
Revert "Extend deploy job timeout to 1 hour"
Jan 13, 2026
a6279a1
Merge branch 'PyORBIT-Collaboration:feature/documentation' into featu…
woodtp Jan 13, 2026
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
17 changes: 10 additions & 7 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:

- name: Print Versions
run: |
.github/workflows/pip-versions.sh
.github/workflows/pip-versions.sh


centos-stream:
runs-on: ubuntu-latest
Expand All @@ -60,8 +60,8 @@ jobs:

- name: Print Versions
run: |
.github/workflows/pip-versions.sh
.github/workflows/pip-versions.sh



ubuntu:
Expand All @@ -88,7 +88,7 @@ jobs:

- name: Print Versions
run: |
.github/workflows/pip-versions.sh
.github/workflows/pip-versions.sh


conda:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:

- name: Print Versions
run: |
.github/workflows/conda-versions.sh
.github/workflows/conda-versions.sh

mpich:
runs-on: ubuntu-latest
Expand All @@ -145,4 +145,7 @@ jobs:

- name: Print Versions
run: |
.github/workflows/pip-versions.sh
.github/workflows/pip-versions.sh

build-docs:
uses: ./.github/workflows/docs-build.yml
42 changes: 42 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
workflow_call:
inputs:
upload-artifact:
required: false
type: boolean
default: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: po3
channels: conda-forge,defaults
auto-update-conda: true
environment-file: docs-environment.yml

- name: Install PyORBIT3
shell: bash -l {0}
run: |
# @woodtp -- MPI isn't required to build docs and enabling it causes Sphinx to segfault.
conda activate po3
pip install --config-settings=setup-args="-DUSE_MPI='none'" .

- name: Build Documentation
shell: bash -l {0}
run: |
conda activate po3
cd doc
make html

- name: Upload artifact
if: ${{ inputs.upload-artifact }}
uses: actions/upload-pages-artifact@v3
with:
path: './doc/build/html'
28 changes: 7 additions & 21 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy Documentation to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand All @@ -22,29 +19,18 @@ concurrency:
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
build:
uses: ./.github/workflows/docs-build.yml
with:
upload-artifact: true

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: po3
environment-file: docs-environment.yml
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "doc/"
# - name: Setup Pages
# uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './doc/build/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ PyORBIT.egg-info
*.so
.*.swp
.eggs
.venv
_autosummary/
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ The following commands may require root access.

<details>
<summary> Click for Ubuntu-based distributions</summary>

```bash
apt-get update
apt-get install -y build-essential python3 libfftw3-dev python3-venv libpython3-dev pkg-config git
```
```
</details>

<details>
<summary> Click for Redhat-based distributions</summary>

```bash
dnf group install -y "Development Tools"
dnf install -y python3-devel fftw3-devel
Expand All @@ -47,16 +47,18 @@ The following commands may require root access.

<details>
<summary> Click for Mac</summary>

Install Homebrew, make sure that homebrew programs are in the **$PATH** (optional step in Homebrew installation)

```bash
brew install pkg-config fftw
```
</details>

#### Create Python virtual environment
Make sure that you have the correct python version installed. We require python>3.9. <br>
Create virtual environment.

```
python3 -m venv .po3
. .po3/bin/activate
Expand All @@ -70,6 +72,7 @@ The following commands may require root access.

First of all make sure you have conda installed and development packages.<br>
Development packages for Ubuntu:

```
apt update -y
apt install -y curl gpg git build-essential
Expand All @@ -87,18 +90,18 @@ pip install -U meson-python setuptools setuptools-scm

## 3. Build

If you plan to modify PyORBIT's code, install it in editable mode.
If you plan to modify PyORBIT's code, install it in editable mode.
You will NOT need to rebuild after modifications to the code. [Meson](MesonBuild.md) will rebuild as necessary on import.
```
pip install --no-build-isolation --editable .
```

Alternatively if you don't plan to modify PyORBIT's code

```
pip install .
```


## 4. Run full SNS linac example

Navigate to your **examples** directory and launch tracking of SNS linac.
Expand All @@ -116,9 +119,9 @@ pip install --config-settings=setup-args="-DUSE_MPI=none" .
Above will build PyORBIT without MPI even if MPI is present. You can change that option to `mpich`, `ompi`, `none` or `auto` (default).<br>
| MPI flavor | Installation command |
|---------------|--------------|
| No MPI | `pip install --config-settings=setup-args="-DUSE_MPI=none" .` |
| The first found MPI installation if any | `pip install --config-settings=setup-args="-DUSE_MPI=auto" .` |
| OpenMPI | `pip install --config-settings=setup-args="-DUSE_MPI=ompi" .` |
| No MPI | `pip install --config-settings=setup-args="-DUSE_MPI=none" .` |
| The first found MPI installation if any | `pip install --config-settings=setup-args="-DUSE_MPI=auto" .` |
| OpenMPI | `pip install --config-settings=setup-args="-DUSE_MPI=ompi" .` |
| MPICH | `pip install --config-settings=setup-args="-DUSE_MPI=mpich" .` |

Meson uses PKG_CONFIG to discover packages. It could be useful to help it to find your MPI installation:
Expand Down
2 changes: 2 additions & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_doxygen
source/api
24 changes: 24 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile clean

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

clean:
rm -rf "$(SOURCEDIR)"/_doxygen "$(SOURCEDIR)"/api "$(SOURCEDIR)"/_autosummary
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions doc/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
File renamed without changes.
Empty file added doc/source/_templates/.gitkeep
Empty file.
78 changes: 78 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.parent / "py/"))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "PyORBIT3"
copyright = "2025, PyORBIT Collaboration"
author = "PyORBIT Collaboration"
release = "v3.0.1"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.coverage",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx_copybutton",
"myst_parser",
"breathe",
"exhale",
]

napoleon_numpy_docstring = True
autosummary_imported_members = True

templates_path = ["_templates"]
exclude_patterns = []

# -- Breathe and Exhale Options ---------------------------------------------------------
breathe_projects = {
"PyORBIT3": "./_doxygen/xml",
}
breathe_default_project = "PyORBIT3"

doxyfile = "\n".join(
[
"INPUT = ../../src",
"EXCLUDE_PATTERNS = *wrap* *_init.cc",
"PREDEFINED += DOXYGEN_SHOULD_SKIP_THIS",
'PREDEFINED += PyObject_HEAD="PyObject ob_base;"',
]
)

exhale_args = {
"containmentFolder": "./api",
"rootFileName": "pyorbit_root.rst",
"doxygenStripFromPath": "..",
"rootFileTitle": "PyORBIT3 C++ API",
"createTreeView": True,
"exhaleExecutesDoxygen": True,
"exhaleDoxygenStdin": doxyfile,
}

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "pydata_sphinx_theme"
html_static_path = ["_static"]
html_show_source_link = True
html_theme_options = {
"github_url": "https://github.com/PyORBIT-Collaboration/PyORBIT3",
"logo": {
"text": "PyORBIT3",
},
}
Loading