From 18833776fc938e1dba8d578d0e4c7d0f0c4b6813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Thu, 30 Oct 2025 16:40:31 +0100 Subject: [PATCH 1/5] Add cython signatures --- setup.py | 1 + 1 file changed, 1 insertion(+) 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}, ) ] From b591c866fa739e654f0b94c51d7bee8b34d51029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Thu, 30 Oct 2025 16:56:06 +0100 Subject: [PATCH 2/5] Ignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) 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 From cd78b09d584ec7f6631bee99fe0b67060221b7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Thu, 30 Oct 2025 16:56:25 +0100 Subject: [PATCH 3/5] Add index and precice module page --- docs/index.rst | 10 ++++++++++ docs/precice.rst | 6 ++++++ 2 files changed, 16 insertions(+) create mode 100644 docs/index.rst create mode 100644 docs/precice.rst 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: From 65548078a4131cb8b3fc1a41e64e1b59a9b4ded9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Thu, 30 Oct 2025 17:01:38 +0100 Subject: [PATCH 4/5] Add configuration --- docs/conf.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 docs/conf.py 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") From ec79ef9636b7f27bdf70d063a0713e36e723d20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Thu, 30 Oct 2025 17:01:51 +0100 Subject: [PATCH 5/5] Add isolated build of the docs --- docs/build.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 docs/build.sh 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