From 9fe58e7502b8d7ed52704acfd30df2b181bd58e6 Mon Sep 17 00:00:00 2001 From: Yashas Ambati Date: Tue, 15 Apr 2025 17:49:25 -0400 Subject: [PATCH 1/5] Trigger doxygen generation in cibuildwheel --- .github/scripts/python_wheels/cibw_before_all.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/scripts/python_wheels/cibw_before_all.sh b/.github/scripts/python_wheels/cibw_before_all.sh index 2398877a8..1906ede89 100644 --- a/.github/scripts/python_wheels/cibw_before_all.sh +++ b/.github/scripts/python_wheels/cibw_before_all.sh @@ -14,7 +14,7 @@ export PYTHON="python${PYTHON_VERSION}" if [ "$(uname)" == "Linux" ]; then # manylinux2014 is based on CentOS 7, so use yum to install dependencies - yum install -y wget + yum install -y wget doxygen # Install Boost from source wget https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz --quiet @@ -24,7 +24,7 @@ if [ "$(uname)" == "Linux" ]; then ./b2 install --prefix=/opt/boost --with=all cd .. elif [ "$(uname)" == "Darwin" ]; then - brew install wget cmake boost + brew install wget cmake boost doxygen fi $(which $PYTHON) -m pip install -r $PROJECT_DIR/python/dev_requirements.txt @@ -48,11 +48,14 @@ cmake $PROJECT_DIR \ -DGTSAM_PYTHON_VERSION=$PYTHON_VERSION \ -DPYTHON_EXECUTABLE:FILEPATH=$(which $PYTHON) \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V43=OFF \ - -DCMAKE_INSTALL_PREFIX=$PROJECT_DIR/gtsam_install + -DCMAKE_INSTALL_PREFIX=$PROJECT_DIR/gtsam_install \ + -DGTSAM_GENERATE_DOC_XML=1 -cd $PROJECT_DIR/build/python +# Generate Doxygen XML documentation +doxygen build/doc/Doxyfile # Install the Python wrapper module and generate Python stubs +cd $PROJECT_DIR/build/python if [ "$(uname)" == "Linux" ]; then make -j $(nproc) install make -j $(nproc) python-stubs From 2d043579528d3abab7d6308d5d6f37ebcff0c5a7 Mon Sep 17 00:00:00 2001 From: Yashas Ambati Date: Wed, 16 Apr 2025 12:06:23 -0400 Subject: [PATCH 2/5] Set GTWRAP_ADD_DOCSTRINGS to ON --- .github/scripts/python_wheels/cibw_before_all.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/scripts/python_wheels/cibw_before_all.sh b/.github/scripts/python_wheels/cibw_before_all.sh index 1906ede89..eab6481c6 100644 --- a/.github/scripts/python_wheels/cibw_before_all.sh +++ b/.github/scripts/python_wheels/cibw_before_all.sh @@ -49,7 +49,8 @@ cmake $PROJECT_DIR \ -DPYTHON_EXECUTABLE:FILEPATH=$(which $PYTHON) \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V43=OFF \ -DCMAKE_INSTALL_PREFIX=$PROJECT_DIR/gtsam_install \ - -DGTSAM_GENERATE_DOC_XML=1 + -DGTSAM_GENERATE_DOC_XML=1 \ + -DGTWRAP_ADD_DOCSTRINGS=ON # Generate Doxygen XML documentation doxygen build/doc/Doxyfile From 0db2a0d16bea88680573ca748daaa1e6ef2cbead Mon Sep 17 00:00:00 2001 From: Yashas Ambati Date: Wed, 16 Apr 2025 12:35:10 -0400 Subject: [PATCH 3/5] Supress boost output --- .github/scripts/python_wheels/cibw_before_all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/python_wheels/cibw_before_all.sh b/.github/scripts/python_wheels/cibw_before_all.sh index eab6481c6..d0cfc996d 100644 --- a/.github/scripts/python_wheels/cibw_before_all.sh +++ b/.github/scripts/python_wheels/cibw_before_all.sh @@ -21,7 +21,7 @@ if [ "$(uname)" == "Linux" ]; then tar -xzf boost_1_87_0.tar.gz cd boost_1_87_0 ./bootstrap.sh --prefix=/opt/boost - ./b2 install --prefix=/opt/boost --with=all + ./b2 install --prefix=/opt/boost --with=all -d0 cd .. elif [ "$(uname)" == "Darwin" ]; then brew install wget cmake boost doxygen From 7f62e8c65e8df0b1bcd9287161f49866fe7d2bda Mon Sep 17 00:00:00 2001 From: Yashas Ambati Date: Wed, 16 Apr 2025 13:48:24 -0400 Subject: [PATCH 4/5] Fix errors in xml_parser and rerun --- wrap/gtwrap/xml_parser/xml_parser.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wrap/gtwrap/xml_parser/xml_parser.py b/wrap/gtwrap/xml_parser/xml_parser.py index 9920027ac..e133b4882 100644 --- a/wrap/gtwrap/xml_parser/xml_parser.py +++ b/wrap/gtwrap/xml_parser/xml_parser.py @@ -56,9 +56,14 @@ class XMLDocParser: documenting_index = self.determine_documenting_index( cpp_class, cpp_method, method_args_names, member_defs) + if member_defs: + self.print_if_verbose( + f"Extracted {len(member_defs)} member definitions for {cpp_class}.{cpp_method}." + ) + # Extract the docs for the function that matches cpp_class.cpp_method(*method_args_names). return self.get_formatted_docstring(member_defs[documenting_index], - ignored_params) + ignored_params) if member_defs else "" def get_member_defs(self, xml_folder: str, cpp_class: str, cpp_method: str): @@ -95,7 +100,7 @@ class XMLDocParser: return "" # Create the path to the file with the documentation for cpp_class. - xml_class_file = xml_folder_path / class_index.attrib['refid'] + '.xml' + xml_class_file = xml_folder_path / f"{class_index.attrib['refid']}.xml" # Parse the class file class_tree = self.parse_xml(xml_class_file) From f6ff9745a120276b490964cd1f30f8bb0e0e855d Mon Sep 17 00:00:00 2001 From: Yashas Ambati Date: Wed, 16 Apr 2025 20:13:01 -0400 Subject: [PATCH 5/5] Remove unnecessary change --- wrap/gtwrap/xml_parser/xml_parser.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/wrap/gtwrap/xml_parser/xml_parser.py b/wrap/gtwrap/xml_parser/xml_parser.py index e133b4882..c73b80c4e 100644 --- a/wrap/gtwrap/xml_parser/xml_parser.py +++ b/wrap/gtwrap/xml_parser/xml_parser.py @@ -56,11 +56,6 @@ class XMLDocParser: documenting_index = self.determine_documenting_index( cpp_class, cpp_method, method_args_names, member_defs) - if member_defs: - self.print_if_verbose( - f"Extracted {len(member_defs)} member definitions for {cpp_class}.{cpp_method}." - ) - # Extract the docs for the function that matches cpp_class.cpp_method(*method_args_names). return self.get_formatted_docstring(member_defs[documenting_index], ignored_params) if member_defs else ""