diff --git a/CMakeLists.txt b/CMakeLists.txt index 84299a75a24e093527305f41c39c973e92cd7377..8fba9c3a691810e151bfe10dbe06b20d5abab0ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ option(BUILD_TESTS "Uses googletest to build tests" OFF) option(BUILD_INTEGRATION_TESTS "Include integration tests (CMAKE >3.7 is needed)" OFF) option(BUILD_DOCS "Uses doxygen to build the documentaion" OFF) option(BUILD_BROKER "Build broker" OFF) +option(BUILD_PYTHON_DOCS "Uses sphinx to build the Python documentaion" OFF) option(BUILD_WORKER_TOOLS "Build worker tools" OFF) option(BUILD_EXAMPLES "Build examples" OFF) @@ -93,4 +94,13 @@ if(BUILD_DOCS) include(doxygen) endif() + +if(BUILD_PYTHON_DOCS) + add_subdirectory (sphinx) +endif() + + + + + include(prepare_version) \ No newline at end of file diff --git a/producer/api/python/setup.py.in b/producer/api/python/setup.py.in index 81fa3e5a0289f328993058039d895132e241b7e1..180039026505919394e2739dbb3e070a4e4c97c1 100644 --- a/producer/api/python/setup.py.in +++ b/producer/api/python/setup.py.in @@ -14,7 +14,7 @@ module = Extension("asapo_producer", ["asapo_producer.pyx"], language="c++", ) -ext_modules = cythonize([module]) +ext_modules = cythonize([module],compiler_directives={'embedsignature': True}) setup(ext_modules = ext_modules, setup_requires=["numpy","cython>=0.28"], diff --git a/sphinx/CMakeLists.txt b/sphinx/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c5bab3f11c1cb145a4c790a974fdf825d7192f4 --- /dev/null +++ b/sphinx/CMakeLists.txt @@ -0,0 +1,12 @@ +file(COPY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + + +add_custom_target( + pydoc ALL + COMMAND + make html VERBATIM + WORKING_DIRECTORY sphinx +) + +add_dependencies(pydoc python-lib2-producer) +add_dependencies(pydoc python-lib2) diff --git a/sphinx/source/conf.py b/sphinx/source/conf.py new file mode 100644 index 0000000000000000000000000000000000000000..8964c048c0b7532e8a346e6b94eaa8793bfe31e3 --- /dev/null +++ b/sphinx/source/conf.py @@ -0,0 +1,168 @@ +# -*- coding: utf-8 -*- +# +# ASAP::O documentation build configuration file, created by +# sphinx-quickstart on Fri Aug 30 13:31:57 2019. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# 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. +# +import os +import sys + +sys.path.insert(0, '/home/yakubov/projects/asapo/cmake-build-debug/worker/api/python') +sys.path.insert(0, '/home/yakubov/projects/asapo/cmake-build-debug/producer/api/python') + + +import asapo_producer + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.ifconfig'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'ASAP::O' +copyright = u'2019, DESY IT' +author = u'DESY IT' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'' +# The full version, including alpha/beta/rc tags. +release = asapo_producer.__version__ + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'classic' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +html_show_sourcelink = False + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'ASAPOdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'ASAPO.tex', u'ASAP::O Documentation', + u'DESY IT', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'asapo', u'ASAP::O Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'ASAPO', u'ASAP::O Documentation', + author, 'ASAPO', 'One line description of project.', + 'Miscellaneous'), +] + + + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} diff --git a/sphinx/source/consumer.rst b/sphinx/source/consumer.rst new file mode 100644 index 0000000000000000000000000000000000000000..4bda1c1a0f323091a120ed025b110a4790c7d53b --- /dev/null +++ b/sphinx/source/consumer.rst @@ -0,0 +1,9 @@ +################## +Consumer +################## + + +.. automodule:: asapo_worker + :members: + :undoc-members: + :show-inheritance: diff --git a/sphinx/source/index.rst b/sphinx/source/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..f1f36e7b36a75a74106ed51381dfd58f913773e1 --- /dev/null +++ b/sphinx/source/index.rst @@ -0,0 +1,17 @@ +.. ASAP::O documentation + +ASAP::O documentation +=================================== + +ASAPO::O + + +Python API +=================================== + +.. toctree:: + consumer + +.. toctree:: + producer + diff --git a/sphinx/source/producer.rst b/sphinx/source/producer.rst new file mode 100644 index 0000000000000000000000000000000000000000..acbbf6a8e3244c2e25dc194cfe6adaeb4f8326d9 --- /dev/null +++ b/sphinx/source/producer.rst @@ -0,0 +1,9 @@ +################## +Producer +################## + + +.. automodule:: asapo_producer + :members: + :undoc-members: + :show-inheritance: diff --git a/worker/api/python/asapo_worker.pyx.in b/worker/api/python/asapo_worker.pyx.in index 059307c2b4227be19dc05227e8cd021d90d72937..e543c02da61a83e8144b1dcf3116d9def6cd0d0a 100644 --- a/worker/api/python/asapo_worker.pyx.in +++ b/worker/api/python/asapo_worker.pyx.in @@ -172,7 +172,7 @@ cdef class PyDataBroker: del meta['_id'] return meta, None -cdef class PyDataBrokerFactory: +cdef class __PyDataBrokerFactory: cdef DataBrokerFactory c_factory def __cinit__(self): with nogil: @@ -198,7 +198,12 @@ cdef class PyDataBrokerFactory: return broker,None def create_server_broker(server_name,source_path,beamtime_id,stream,token,timeout): - factory = PyDataBrokerFactory() + """ + :param server_name: Handler to this. + :type server_name: String + :param source_path: The network this node belongs to. + """ + factory = __PyDataBrokerFactory() return factory.create_server_broker(_bytes(server_name),_bytes(source_path),_bytes(beamtime_id),_bytes(stream),_bytes(token),timeout) diff --git a/worker/api/python/setup.py.in b/worker/api/python/setup.py.in index 6d61825cfe2fd12b06616132409605cd204ffcfd..b2815861f2983e18f31171082368afaf5bb51383 100644 --- a/worker/api/python/setup.py.in +++ b/worker/api/python/setup.py.in @@ -14,6 +14,7 @@ module = Extension("asapo_worker", ["asapo_worker.pyx"], language="c++", ) -ext_modules = cythonize([module]) + +ext_modules = cythonize([module],compiler_directives={'embedsignature': True}) setup(ext_modules = ext_modules)