diff --git a/.gitignore b/.gitignore index 2130ba7e..833e4c93 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ .idea # Pycharm related file *.so build +docs/_build +docs/.docs_venv *.egg-info __pycache__ env diff --git a/docs/build.sh b/docs/build.sh new file mode 100755 index 00000000..c2b0957f --- /dev/null +++ b/docs/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +if [[ ! -f "../pyproject.toml" ]]; then + echo "WTF" + exit 1 +fi + +TARGET=singlehtml + +python3 -m venv .docs_venv + +echo "Installing dependencies" +.docs_venv/bin/pip install sphinx myst_parser + +echo "Installing python bindings" +.docs_venv/bin/pip install --force --no-cache .. + +echo "Building the website" +.docs_venv/bin/sphinx-build -M ${TARGET} . _build diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..ea23edbd --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,46 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import datetime + +project = "pyprecice" +author = "The preCICE developers" +copyright = f"{datetime.datetime.now().year}, {author}" + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "myst_parser", +] + +intersphinx_mapping = { + "python": ("https://docs.python.org/3/", None), + "numpy": ("https://numpy.org/doc/stable/", None), + "mpi4py": ("https://mpi4py.readthedocs.io/en/latest/", None), +} + +# exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".docs_venv"] +include_patterns = ["*.rst", "*.md"] + +html_theme = "alabaster" +html_static_path = ["_static"] + +source_suffix = { + ".rst": "restructuredtext", + ".md": "markdown", +} + +autodoc_class_signature = "separated" +autodoc_typehints = "description" +autodoc_typehints_format = "short" +autodoc_member_order = "bysource" + +suppress_warnings = ["myst.xref_missing"] + +# The cython detection relyies on a built and installed version of the package +try: + import precice +except: + raise RuntimeError("Cannot import precice. Please install pyprecice first") diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..271e3e49 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,10 @@ +The preCICE python bindings +=========================== + +.. toctree:: + :maxdepth: 1 + :caption: Contents: + + precice + MigrationGuide + ReleaseGuide diff --git a/docs/precice.rst b/docs/precice.rst new file mode 100644 index 00000000..93b58d72 --- /dev/null +++ b/docs/precice.rst @@ -0,0 +1,6 @@ +The pyprecice package +===================== + +.. automodule:: cyprecice + :members: + :undoc-members: diff --git a/setup.py b/setup.py index f3a3c2b2..2cdcf5ff 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,7 @@ def get_extensions(): extra_compile_args=compile_args, extra_link_args=link_args, define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")], + cython_directives={"embedsignature": True}, ) ]