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

Fix documentation #1410

Merged
merged 2 commits into from
May 4, 2024
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
10 changes: 5 additions & 5 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
98 changes: 98 additions & 0 deletions docs/source/_templates/autoapi/python/module.rst
Original file line number Diff line number Diff line change
@@ -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 %}
19 changes: 8 additions & 11 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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 = []
Expand Down
20 changes: 12 additions & 8 deletions python_modules/jupedsim/jupedsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Empty file.
Loading