Skip to content

Commit 32c048f

Browse files
committed
python docs should now appear in mdBook
1 parent 41422cb commit 32c048f

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

.github/workflows/deploy-book.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "docs/**"
99
- ".github/workflows/deploy-book.yaml"
1010
- "README.md"
11+
- "python/**"
1112

1213
# Allows you to run this workflow manually from the Actions tab
1314
workflow_dispatch:
@@ -33,11 +34,18 @@ jobs:
3334
MDBOOK_VERSION: 0.4.21
3435
steps:
3536
- uses: actions/checkout@v3
36-
- name: Install mdBook
37+
- name: Install mdBook and supporting dependencies
3738
run: |
3839
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
3940
rustup update
4041
cargo install --version ${MDBOOK_VERSION} mdbook
42+
- name: Build python docs
43+
run:
44+
sudo apt update
45+
sudo apt install pipx
46+
pipx ensurepath
47+
pipx install pydoc-markdown
48+
pydoc-markdown -I python/ -p fastsim --render-toc > docs/src/python_docs.md
4149
- name: Setup Pages
4250
id: pages
4351
uses: actions/configure-pages@v3

docs/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
- [Documentation](./doc.md)
55
- [Rust API](./doc/rust.md)
66
- [Rail Network](./doc/rail-network.md)
7+
- [Python API](./doc/python-doc.md)
78
- [Press Releases](./press-releases.md)
89
- [How to Update This Book](./how-to-update.md)

docs/src/doc.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# Documentation
1+
# Documentation
2+
3+
## [Python](./doc/python-doc.md)
4+
5+
## [Rust](./doc/rust.md)

docs/src/doc/python-doc.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Python API Documentation

docs/src/how-to-update.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@
44

55
## Setup
66

7-
1. If not already done, [install mdbook](https://rust-lang.github.io/mdBook/guide/installation.html)
7+
If not already done, [install mdbook](https://rust-lang.github.io/mdBook/guide/installation.html)
88

9-
## Publishing
109

10+
## Serving locally
11+
Run th following in the repository root directory:
12+
1. If any python files were modified,
13+
1. Install [pipx](https://github.com/pypa/pipx#install-pipx)
14+
1. Install [pydoc-markdown](https://niklasrosenstein.github.io/pydoc-markdown/#installation-)
15+
1. run `pydoc-markdown -I python/ -p fastsim --render-toc > docs/src/python_docs.md`. Do not modify this file manually.
16+
1. Run `mdbook serve --open docs/`
17+
18+
19+
## Publishing
1120
1. Update `book.toml` or files in `docs/src/`
12-
1. Make sure the docs look good locally: `mdbook build docs/ --open`
21+
1. Make sure the docs look good locally by running the steps in [Serving Locally](#serving-locally)
1322
1. Commit files and push to `main` branch
1423

1524
After that, a GitHub action will build the book and publish it [here](https://pages.github.nrel.gov/MBAP/mbap-computing/)

0 commit comments

Comments
 (0)