Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions python/doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions python/doc/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
58 changes: 58 additions & 0 deletions python/doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'CutCells'
copyright = '2024, ONERA'
author = 'Susanne Claus'
release = '0.2.0'
import cutcells

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['sphinx.ext.autodoc',
'sphinx.ext.imgmath',
'sphinx.ext.autosummary',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx_copybutton',
# "autoapi.extension",
]

templates_path = ['_templates']
exclude_patterns = []

# Napoleon settings
napoleon_google_docstring = True
napoleon_numpy_docstring = False

autoclass_content = 'both' # this concatenates the class.doc + __init__.doc
autodoc_typehints = "description" # typehints are nicely placed

todo_include_todos = True
todo_link_only = True

# alternatively, could use autoapi:
# # autoapi coonfiguration:
# package_dir = next(x for x in nanobind_example.__path__ if "site-packages" in x)
# autoapi_dirs = [f"{package_dir}/"]
# # https://github.com/readthedocs/sphinx-autoapi/issues/405
# #autoapi_ignore = ["*__init__.py*"]
# autoapi_member_order = "groupwise"
# # autoapi_generate_api_docs = False



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

#html_theme = 'furo'
html_theme = 'nature'
html_static_path = ['_static']
47 changes: 47 additions & 0 deletions python/doc/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. nanobind_example documentation master file, created by
sphinx-quickstart on Tue Dec 17 14:55:35 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

cutcells documentation
======================

To build this module and documentation::

pip install . && ( cd doc; make html; )


.. todo::

Complete requirements.txt


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

reference


.. todolist::




.. note::

Some feedback about Sphinx

These are nice Cheat Sheets for reST format to use with Sphinx:

- `Restructured Text (reST) and Sphinx CheatSheet <http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html>`_

- `Sphinx and RST syntax guide <https://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html>`_

- `reStructuredText specifications <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_ and its `abridged version <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_

Docstrings Google Style is recommended to document the module:

- `sphinx.ext.napoleon documentation <http://www.sphinx-doc.org/en/master/ext/napoleon.html>`_

- `Google style docstring examples <http://www.sphinx-doc.org/en/master/ext/example_google.html#example-google>`_
60 changes: 60 additions & 0 deletions python/doc/source/reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
==================
Module reference
==================

.. sidebar:: Version information

:Release: |release|
:Date: |today|

.. contents::
:local:



Nanobind autosummary example
****************************

.. currentmodule:: cutcells
.. autosummary::

CellType
CutCell_float32


Cutcells automodule example
***************************

The module provides ...

.. automodule:: cutcells
:members:
:imported-members:
:undoc-members:
:show-inheritance:

.. todo::

* cleanup the doc


Cutcells autofunction example
*****************************

.. comment
no-index are in this section because it'd make duplicates with the previous section

Explicitly asking for the doc of a specific function works:

.. autofunction:: cutcells.cut
:no-index:


.. note::

I could write something here.




.. literalinclude:: /../../demo/cut_triangle/cut_triangle.py
14 changes: 14 additions & 0 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# surely
numpy
nanobind

scikit_build_core
Sphinx
sphinx-autoapi
sphinx-autodoc-typehints
sphinx-copybutton
sphinx_design
sphinx_mdinclude

# maybe
typing_extensions