Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipeMaia committed Jan 4, 2024
1 parent 51fa6a6 commit aed7dcc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme
pip install sphinx sphinx_rtd_theme h5py h5writer mpi4py numpy pexpect pint PyQt5 pyqtgraph pytz pyzmq scipy tornado
- name: Sphinx build
run: |
sphinx-build docs _build
Expand Down
25 changes: 25 additions & 0 deletions docs/API/backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,28 @@ hummingbird.backend.lcls
:members:
:undoc-members:
:show-inheritance:


hummingbird.backend.euxfel
--------------------------

.. automodule:: hummingbird.backend.euxfel
:members:
:undoc-members:
:show-inheritance:

hummingbird.backend.flash
-------------------------

.. automodule:: hummingbird.backend.flash
:members:
:undoc-members:
:show-inheritance:

hummingbird.backend.swissfel
----------------------------

.. automodule:: hummingbird.backend.swissfel
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/API/ui.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ui
==

.. automodule:: interface.ui
.. automodule:: hummingbird.interface.ui

.. autoclass:: hummingbird.interface.ui.DataWindow
:members:
Expand Down
25 changes: 15 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('../'))

# Make sure NOT to write bytecode. ReadTheDocs does not clean the build directory
# before every checkout so leftover pyc files can cause import problems if they
# cause name clashes, or other unforseen problems.
sys.dont_write_bytecode = True

import glob
files = glob.glob('../src/analysis/*.pyc')
files += glob.glob('../src/backend/*.pyc')
files += glob.glob('../src/interface/*.pyc')
files += glob.glob('../src/ipc/*.pyc')
files += glob.glob('../src/plotting/*.pyc')
files += glob.glob('../src/utils/*.pyc')
files = glob.glob('../hummingbird/*.pyc')
files = glob.glob('../hummingbird/analysis/*.pyc')
files += glob.glob('../hummingbird/backend/*.pyc')
files += glob.glob('../hummingbird/interface/*.pyc')
files += glob.glob('../hummingbird/interface/ui/*.pyc')
files += glob.glob('../hummingbird/ipc/*.pyc')
files += glob.glob('../hummingbird/plotting/*.pyc')
files += glob.glob('../hummingbird/utils/*.pyc')
for f in files:
os.remove(f)

# Try to use mock modules to be able to build documentation even it's not
# possible to import certain modules
try:
from mock import Mock as MagicMock
from unittest.mock import Mock as MagicMock

class Mock(MagicMock):
"""
Expand All @@ -51,8 +53,10 @@ class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()
# def __iter__(self):
# return iter([])

MOCK_MODULES = ['PyQt4','psana','sip','numpy', 'numpy.random','scipy','scipy.sparse', 'zmq','zmq.eventloop','zmq.eventloop.zmqstream','pyqtgraph', 'pytz', 'h5py']
MOCK_MODULES = ['psana', 'karabo_bridge', 'sfdata', 'camp', 'camp.pah', 'camp.pah.h5filedataaccess', 'camp.pah.beamtimedaqaccess']

sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
except ImportError:
Expand Down Expand Up @@ -87,7 +91,8 @@ def __getattr__(cls, name):

# General information about the project.
project = u'Hummingbird'
copyright = u'2015, FXIhub'
import datetime
copyright = u'2015-%d, FXIhub' % (datetime.date.today().year)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down

0 comments on commit aed7dcc

Please sign in to comment.