Skip to content

Commit

Permalink
6725 generate properties for bundle docs (#6918)
Browse files Browse the repository at this point in the history
Fixes #6725

- adding the bundle properties to
https://monai-dev.readthedocs.io/en/fixes-sphinx/mb_properties.html



### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
  • Loading branch information
wyli and KumoLiu authored Sep 1, 2023
1 parent df1779b commit e48c3e2
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ instance/
# Sphinx documentation
docs/build/
docs/source/_gen
docs/source/*_properties.csv
_build/

# PyBuilder
Expand Down
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ help:
clean:
rm -rf build/
rm -rf source/_gen
rm -rf source/*_properties.csv
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jsonschema
pynrrd
pydicom
h5py
nni
nni; platform_system == "Linux"
optuna
opencv-python-headless
onnx>=1.13.0
Expand Down
1 change: 1 addition & 0 deletions docs/source/bundle_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bundle

mb_specification
config_syntax.md
mb_properties

Detailed bundle examples and get started tutorial: https://github.com/Project-MONAI/tutorials/tree/main/bundle

Expand Down
13 changes: 12 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,18 @@

def generate_apidocs(*args):
"""Generate API docs automatically by trawling the available modules"""
module_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "monai"))

import pandas as pd
from monai.bundle.properties import TrainProperties, InferProperties, MetaProperties

csv_file = os.path.join(os.path.dirname(__file__), "train_properties.csv") # used in mb_properties.rst
pd.DataFrame.from_dict(TrainProperties, orient="index").iloc[:, :3].to_csv(csv_file)
csv_file = os.path.join(os.path.dirname(__file__), "infer_properties.csv")
pd.DataFrame.from_dict(InferProperties, orient="index").iloc[:, :3].to_csv(csv_file)
csv_file = os.path.join(os.path.dirname(__file__), "meta_properties.csv")
pd.DataFrame.from_dict(MetaProperties, orient="index").iloc[:, :3].to_csv(csv_file)

module_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "monai"))
output_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "apidocs"))
apidoc_command_path = "sphinx-apidoc"
if hasattr(sys, "real_prefix"): # called from a virtualenv
Expand Down
30 changes: 30 additions & 0 deletions docs/source/mb_properties.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
MONAI Bundle Properties
=======================


Train properties
----------------

.. csv-table::
:header-rows: 1
:file: train_properties.csv
:class: longtable
:widths: 10, 55, 5, 30

Infer properties
----------------

.. csv-table::
:header-rows: 1
:file: infer_properties.csv
:class: longtable
:widths: 10, 55, 5, 30

Meta properties
---------------

.. csv-table::
:header-rows: 1
:file: meta_properties.csv
:class: longtable
:widths: 10, 55, 5, 30

0 comments on commit e48c3e2

Please sign in to comment.