Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6725 generate properties for bundle docs #6918

Merged
merged 4 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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