Skip to content

Commit

Permalink
Updated modules configuration for docstrings API documentation
Browse files Browse the repository at this point in the history
Signed-off-by: manuelhsantana <[email protected]>
  • Loading branch information
manuelhsantana committed Jul 9, 2024
1 parent deca2ff commit 14a8deb
Show file tree
Hide file tree
Showing 15 changed files with 239 additions and 10 deletions.
29 changes: 28 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
# import sphinxcontrib.napoleon # NOQA:E800

extensions = [
'sphinx.ext.napoleon',
'sphinx_rtd_theme',
'sphinx.ext.autosectionlabel',
'sphinx.ext.napoleon',
'sphinx-prompt',
'sphinx_substitution_extensions',
'sphinx.ext.ifconfig',
Expand Down Expand Up @@ -70,6 +70,33 @@
# Config the returns section to behave like the Args section
napoleon_custom_sections = [('Returns', 'params_style')]

# This code extends Sphinx's GoogleDocstring class to support 'Keys', 'Attributes',
# and 'Class Attributes' sections in docstrings. Allows for more detailed and structured
# documentation of Python classes and their attributes.
from sphinx.ext.napoleon.docstring import GoogleDocstring

# Define new sections and their corresponding parse methods
new_sections = {
'keys': 'Keys',
'attributes': 'Attributes',
'class attributes': 'Class Attributes'
}

# Add new sections to GoogleDocstring class
for section, title in new_sections.items():
setattr(GoogleDocstring, f'_parse_{section}_section',
lambda self, section: self._format_fields(title, self._consume_fields()))

# Patch the parse method to include new sections
def patched_parse(self):
for section in new_sections:
self._sections[section] = getattr(self, f'_parse_{section}_section')
self._unpatched_parse()

# Apply the patch
GoogleDocstring._unpatched_parse = GoogleDocstring._parse
GoogleDocstring._parse = patched_parse

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Training of statistical models may be done with any deep learning framework, suc
Looking for the Open Flash Library project also referred to as OpenFL? Find it [here](https://www.openfl.org/)!

.. toctree::
:maxdepth: 1
:maxdepth: 2
:caption: Contents:

manual
Expand All @@ -38,4 +38,5 @@ Indices and tables

* :ref:`genindex`
* :ref:`modindex`

.. * :ref:`search`
20 changes: 12 additions & 8 deletions docs/openfl_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ Welcome to the |productName| API reference:
:template: custom-module-template.rst
:recursive:

openfl.component.aggregator
openfl.component.assigner
openfl.component.collaborator
openfl.component.director
openfl.component.envoy
openfl.component.straggler_handling_functions

- :doc:`openfl.component`
- :doc:`source/api/openfl_component`
- :doc:`source/api/openfl_cryptography`
- :doc:`source/api/openfl_databases`
- :doc:`source/api/openfl_experimental`
- :doc:`source/api/openfl_federated`
- :doc:`source/api/openfl_interface`
- :doc:`source/api/openfl_native`
- :doc:`source/api/openfl_pipelines`
- :doc:`source/api/openfl_plugins`
- :doc:`source/api/openfl_protocols`
- :doc:`source/api/openfl_transport`
- :doc:`source/api/openfl_utilities`
20 changes: 20 additions & 0 deletions docs/source/api/openfl_component.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Component Module
*************************************************

Component modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.component.aggregator
openfl.component.assigner
openfl.component.collaborator
openfl.component.director
openfl.component.envoy
openfl.component.straggler_handling_functions
16 changes: 16 additions & 0 deletions docs/source/api/openfl_cryptography.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Cryptography Module
*************************************************

Cryptography modules reference:

.. autosummary::
:toctree: _autosummary
:recursive:

openfl.cryptography.ca
openfl.cryptography.io
openfl.cryptography.participant
16 changes: 16 additions & 0 deletions docs/source/api/openfl_databases.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Databases Module
*************************************************

Databases modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.databases

18 changes: 18 additions & 0 deletions docs/source/api/openfl_experimental.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Experimental Module
*************************************************

Experimental modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.experimental.interface
openfl.experimental.placement
openfl.experimental.runtime
openfl.experimental.utilities
16 changes: 16 additions & 0 deletions docs/source/api/openfl_federated.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Federated Module
*************************************************

Federated modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.federated

16 changes: 16 additions & 0 deletions docs/source/api/openfl_interface.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Interface Module
*************************************************

Interface modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.interface

16 changes: 16 additions & 0 deletions docs/source/api/openfl_native.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Native Module
*************************************************

Native modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.native

16 changes: 16 additions & 0 deletions docs/source/api/openfl_pipelines.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Pipelines Module
*************************************************

Pipelines modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.pipelines

16 changes: 16 additions & 0 deletions docs/source/api/openfl_plugins.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Plugins Module
*************************************************

Plugins modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.plugins

16 changes: 16 additions & 0 deletions docs/source/api/openfl_protocols.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Protocols Module
*************************************************

Protocols modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.protocols

15 changes: 15 additions & 0 deletions docs/source/api/openfl_transport.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Transport Module
*************************************************

Transport modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.transport
16 changes: 16 additions & 0 deletions docs/source/api/openfl_utilities.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. # Copyright (C) 2020-2024 Intel Corporation
.. # SPDX-License-Identifier: Apache-2.0
*************************************************
Utilities Module
*************************************************

Utilities modules reference:

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

openfl.utilities

0 comments on commit 14a8deb

Please sign in to comment.