From 6a2b189742b85e51ad676e8f22dcec5b123d37de Mon Sep 17 00:00:00 2001 From: Ozaq Date: Fri, 3 May 2024 13:53:11 +0200 Subject: [PATCH 1/2] Update doc dependencies --- docs/requirements.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 593ffaa972..cc5d4b0cee 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,11 +1,11 @@ -sphinx~=6.2.1 -sphinx-copybutton==0.5.1 +sphinx~=7.3.7 +sphinx-copybutton==0.5.2 sphinx-autoapi==3.0.0 -sphinx-book-theme==1.0.1 +sphinx-book-theme==1.1.2 sphinx-favicon==1.0.1 sphinx-notfound-page==1.0.0 -myst-nb @ git+https://github.com/executablebooks/MyST-NB@59854c2 -nbconvert==7.7.1 +myst-nb==1.1.0 +nbconvert==7.16.4 # notebook dependencies shapely From ec8e959959db4efe9a69b48a34fc9e1761624adf Mon Sep 17 00:00:00 2001 From: Ozaq Date: Sat, 4 May 2024 21:13:10 +0200 Subject: [PATCH 2/2] Add doc for implicit namespace packages --- .../_templates/autoapi/python/module.rst | 98 +++++++++++++++++++ docs/source/conf.py | 19 ++-- python_modules/jupedsim/jupedsim/__init__.py | 20 ++-- .../jupedsim/jupedsim/models/__init__.py | 0 4 files changed, 118 insertions(+), 19 deletions(-) create mode 100644 docs/source/_templates/autoapi/python/module.rst create mode 100644 python_modules/jupedsim/jupedsim/models/__init__.py diff --git a/docs/source/_templates/autoapi/python/module.rst b/docs/source/_templates/autoapi/python/module.rst new file mode 100644 index 0000000000..28579a976e --- /dev/null +++ b/docs/source/_templates/autoapi/python/module.rst @@ -0,0 +1,98 @@ +{% if not obj.display %} +:orphan: + +{% endif %} +:py:mod:`{{ obj.name }}` +=========={{ "=" * obj.name|length }} + +.. py:module:: {{ obj.name }} + +{% if obj.docstring %} +.. autoapi-nested-parse:: + + {{ obj.docstring|indent(3) }} + +{% endif %} + +{% block submodules %} +{% set visible_submodules = obj.submodules|selectattr("display")|list %} +{% if visible_submodules %} +Submodules +---------- +.. toctree:: + :titlesonly: + :maxdepth: 1 + +{% for submodule in visible_submodules %} + {{ submodule.short_name }}/index.rst +{% endfor %} + + +{% endif %} +{% endblock %} +{% block content %} +{% if obj.all is not none %} +{% set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %} +{% elif obj.type is equalto("package") %} +{% set visible_children = obj.children|selectattr("display")|list %} +{% else %} +{% set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %} +{% endif %} +{% if visible_children %} +{{ obj.type|title }} Contents +{{ "-" * obj.type|length }}--------- + +{% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list %} +{% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list %} +{% set visible_attributes = visible_children|selectattr("type", "equalto", "data")|list %} +{% if "show-module-summary" in autoapi_options and (visible_classes or visible_functions) %} +{% block classes scoped %} +{% if visible_classes %} +Classes +~~~~~~~ + +.. autoapisummary:: + +{% for klass in visible_classes %} + {{ klass.id }} +{% endfor %} + + +{% endif %} +{% endblock %} + +{% block functions scoped %} +{% if visible_functions %} +Functions +~~~~~~~~~ + +.. autoapisummary:: + +{% for function in visible_functions %} + {{ function.id }} +{% endfor %} + + +{% endif %} +{% endblock %} + +{% block attributes scoped %} +{% if visible_attributes %} +Attributes +~~~~~~~~~~ + +.. autoapisummary:: + +{% for attribute in visible_attributes %} + {{ attribute.id }} +{% endfor %} + + +{% endif %} +{% endblock %} +{% endif %} +{% for obj_item in visible_children %} +{{ obj_item.render()|indent(0) }} +{% endfor %} +{% endif %} +{% endblock %} diff --git a/docs/source/conf.py b/docs/source/conf.py index 0ac93f4612..5146cece57 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -54,25 +54,23 @@ "members", "undoc-members", "show-inheritance", + "show-module-summary", "imported-members", ] autoapi_ignore = [ "**/tests/**", "**/native/**", "**/internal/**", - "**/\\w.*.py", ] - -# autoapi_member_order = "groupwise" -autodoc_typehints = "both" -autoapi_python_class_content = "both" - -add_module_names = False - autoapi_add_toctree_entry = False +autoapi_python_class_content = "class" +autoapi_template_dir = "_templates/autoapi" +autoapi_member_order = "groupwise" +autoapi_python_use_implicit_namespaces = True +add_module_names = False -def skip_submodules(app, what, name, obj, skip, options): +def skip_rules(app, what, name, obj, skip, options): if what == "module": skip = True if what == "method": @@ -86,8 +84,7 @@ def skip_submodules(app, what, name, obj, skip, options): def setup(sphinx): - sphinx.connect("autoapi-skip-member", skip_submodules) - + sphinx.connect("autoapi-skip-member", skip_rules) # -- Automatic execution of jupyter notebooks -------------------------------- nb_execution_excludepatterns = [] diff --git a/python_modules/jupedsim/jupedsim/__init__.py b/python_modules/jupedsim/jupedsim/__init__.py index d0cdc93679..b923adefea 100644 --- a/python_modules/jupedsim/jupedsim/__init__.py +++ b/python_modules/jupedsim/jupedsim/__init__.py @@ -15,11 +15,6 @@ distribute_until_filled, ) from jupedsim.geometry import Geometry -from jupedsim.geometry_utils import ( - _geometry_from_coordinates, - _geometry_from_shapely, - _geometry_from_wkt, -) from jupedsim.internal.tracing import Trace from jupedsim.journey import JourneyDescription, Transition from jupedsim.library import ( @@ -64,10 +59,22 @@ ) __version__ = get_build_info().library_version +""" +The version of this module. +""" + __commit__ = get_build_info().git_commit_hash +""" +Commit id that was used to build this module. +""" + __compiler__ = ( f"{get_build_info().compiler} ({get_build_info().compiler_version})" ) +""" +Id of the compiler used to build the native portion of this module. +""" + __all__ = [ "Agent", @@ -113,9 +120,6 @@ "distribute_in_circles_by_density", "distribute_in_circles_by_number", "distribute_until_filled", - "_geometry_from_coordinates", - "_geometry_from_shapely", - "_geometry_from_wkt", "get_build_info", "set_debug_callback", "set_error_callback", diff --git a/python_modules/jupedsim/jupedsim/models/__init__.py b/python_modules/jupedsim/jupedsim/models/__init__.py new file mode 100644 index 0000000000..e69de29bb2