diff --git a/docs/.readthedocs.yaml b/docs/.readthedocs.yaml index 83426bb2..a98539d5 100644 --- a/docs/.readthedocs.yaml +++ b/docs/.readthedocs.yaml @@ -6,11 +6,19 @@ version: 2 # Set the version of Python and other tools you might need +# Note. pre-build jobs requires dwi_ml to be installed but ok; the python +# install section is launched before the pre-build. build: os: ubuntu-22.04 tools: python: "3.11" + jobs: + pre_build: + - pip install --upgrade pip setuptools wheel + - pip install . + - bash docs/build_automatic_help_docs.sh + # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py diff --git a/docs/automatic_doc/index_automatic.rst b/docs/automatic_doc/index_automatic.rst new file mode 100644 index 00000000..ef1e1d16 --- /dev/null +++ b/docs/automatic_doc/index_automatic.rst @@ -0,0 +1,31 @@ +Scripts +======= + +.. toctree:: + :caption: Scripts (--help) + + ae_train_model_help + dwiml_compute_connectivity_matrix_from_blocs_help + dwiml_compute_connectivity_matrix_from_labels_help + dwiml_compute_connectivity_score_help + dwiml_create_hdf5_dataset_help + dwiml_divide_volume_into_blocs_help + dwiml_hdf5_extract_data_help + dwiml_hdf5_print_architecture_help + dwiml_send_value_to_comet_from_log_help + dwiml_send_value_to_comet_manually_help + dwiml_visualize_logs_correlation_help + dwiml_visualize_logs_help + dwiml_visualize_noise_on_streamlines_help + l2t_resume_training_from_checkpoint_help + l2t_track_from_model_help + l2t_train_model_help + l2t_update_deprecated_exp_help + l2t_visualize_loss_help + l2t_visualize_weights_evolution_help + tt_resume_training_from_checkpoint_help + tt_track_from_model_help + tt_train_model_help + tt_update_deprecated_exp_help + tt_visualize_loss_help + tt_visualize_weights_help diff --git a/docs/build_automatic_help_docs.sh b/docs/build_automatic_help_docs.sh new file mode 100644 index 00000000..0b4f7962 --- /dev/null +++ b/docs/build_automatic_help_docs.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# This generates the automatic pages with the --help +# This is added in + +index_page=docs/automatic_doc/index_automatic.rst + +# Preparing the toctree +if [ -f $index_page ] +then + rm $index_page +fi +{ + echo "Scripts" + echo "=======" + echo " " + echo ".. toctree::" + echo " :caption: Scripts (--help)" + echo " " +} > $index_page + + +for script in src/dwi_ml/cli/*.py; +do + script_name=$(basename $script) + script_name=${script_name%.py} + + if [ $script_name != '__init__' ] + then + echo "Preparing help page for script $script_name" + + # Prepare help file + outfile="docs/automatic_doc/${script_name}_help.rst" + if [ -f $outfile ] + then + rm $outfile + fi + { + echo $script_name + echo "=========================================================" + echo "" + echo ".. code-block:: text" + echo "" + $script_name --help | sed 's/^/ /' + } > $outfile + + # Add file to toctree + echo " ${script_name}_help" >> $index_page + fi +done \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index ac4547bc..8eb7efdf 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -113,6 +113,8 @@ Page in this section explain more in details how the code is implemented in pyth - :ref:`tracking` +.. --------------------Hidden toctree: For developers--------------- + .. toctree:: :maxdepth: 3 :caption: Explanations for developers @@ -122,4 +124,14 @@ Page in this section explain more in details how the code is implemented in pyth for_developers/hdf5/advanced_hdf5_organization for_developers/training/training for_developers/data_management/index - for_developers/testing/tracking_objects \ No newline at end of file + for_developers/testing/tracking_objects + + +.. --------------------Hidden toctree: scripts --------------- + +.. toctree:: + :maxdepth: 2 + :caption: Scripts (--help) + :hidden: + + automatic_doc/index_automatic.rst