From a716373b639e1c30c44b2f3e32e01ca9d1a6057c Mon Sep 17 00:00:00 2001 From: "Mario Sieg (Neo)" Date: Fri, 24 Jan 2025 18:22:22 +0100 Subject: [PATCH] Add sphnix doc generator --- python/.gitignore | 3 +++ python/docs/conf.py | 30 ++++++++++++++++++++++++++++++ python/docs/index.rst | 17 +++++++++++++++++ python/docs/make.bat | 35 +++++++++++++++++++++++++++++++++++ python/requirements.txt | 3 +++ 5 files changed, 88 insertions(+) create mode 100644 python/.gitignore create mode 100644 python/docs/conf.py create mode 100644 python/docs/index.rst create mode 100644 python/docs/make.bat diff --git a/python/.gitignore b/python/.gitignore new file mode 100644 index 0000000..aef5466 --- /dev/null +++ b/python/.gitignore @@ -0,0 +1,3 @@ +docs/_build +docs/_static +docs/_templates \ No newline at end of file diff --git a/python/docs/conf.py b/python/docs/conf.py new file mode 100644 index 0000000..8f743b1 --- /dev/null +++ b/python/docs/conf.py @@ -0,0 +1,30 @@ +# 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 = 'magnetron' +copyright = '2025, Mario Sieg' +author = 'Mario Sieg' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = ['sphinx.ext.autodoc', 'autoapi.extension'] +autoapi_dirs = ['../magnetron_framework/magnetron'] +autodoc_typehints = 'description' +#autoapi_ignore = ['*/_*.py'] +#suppress_warnings = ['autoapi.python_import_resolution'] +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] diff --git a/python/docs/index.rst b/python/docs/index.rst new file mode 100644 index 0000000..f111b7d --- /dev/null +++ b/python/docs/index.rst @@ -0,0 +1,17 @@ +.. magnetron documentation master file, created by + sphinx-quickstart on Fri Jan 24 18:05:55 2025. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +magnetron documentation +======================= + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + diff --git a/python/docs/make.bat b/python/docs/make.bat new file mode 100644 index 0000000..954237b --- /dev/null +++ b/python/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +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 diff --git a/python/requirements.txt b/python/requirements.txt index cd6e8bd..8401701 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -5,3 +5,6 @@ pytest numpy matplotlib cycler +sphinx +sphinx-autoapi +sphinx-rtd-theme