diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/compress_stringify_async.py b/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/compress_stringify_async.py
index 9baa6e56a..1f7e71278 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/compress_stringify_async.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/compress_stringify_async.py
@@ -20,28 +20,20 @@ async def compress_stringify_async(
) -> bytes:
"""Given a binary, compress and optionally base64 encode.
- Parameters
- ----------
+ :param input: Input binary
+ :type input: bytes
- input: bytes
- Input binary
+ :param stringify: Stringify the output
+ :type stringify: bool
- stringify: bool, optional
- Stringify the output
+ :param compression_level: Compression level, typically 1-9
+ :type compression_level: int
- compression_level: int, optional
- Compression level, typically 1-9
-
- data_url_prefix: str, optional
- dataURL prefix
-
-
- Returns
- -------
-
- bytes
- Output compressed binary
+ :param data_url_prefix: dataURL prefix
+ :type data_url_prefix: str
+ :return: Output compressed binary
+ :rtype: bytes
"""
js_module = await js_package.js_module
web_worker = js_resources.web_worker
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/parse_string_decompress_async.py b/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/parse_string_decompress_async.py
index 033217758..62052fa7c 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/parse_string_decompress_async.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify-emscripten/itkwasm_compress_stringify_emscripten/parse_string_decompress_async.py
@@ -18,22 +18,14 @@ async def parse_string_decompress_async(
) -> bytes:
"""Given a binary or string produced with compress-stringify, decompress and optionally base64 decode.
- Parameters
- ----------
+ :param input: Compressed input
+ :type input: bytes
- input: bytes
- Compressed input
-
- parse_string: bool, optional
- Parse the input string before decompression
-
-
- Returns
- -------
-
- bytes
- Output decompressed binary
+ :param parse_string: Parse the input string before decompression
+ :type parse_string: bool
+ :return: Output decompressed binary
+ :rtype: bytes
"""
js_module = await js_package.js_module
web_worker = js_resources.web_worker
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/compress_stringify.py b/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/compress_stringify.py
index fbcce227e..aad8a3f79 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/compress_stringify.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/compress_stringify.py
@@ -22,28 +22,20 @@ def compress_stringify(
) -> bytes:
"""Given a binary, compress and optionally base64 encode.
- Parameters
- ----------
+ :param input: Input binary
+ :type input: bytes
- input: bytes
- Input binary
+ :param stringify: Stringify the output
+ :type stringify: bool
- stringify: bool, optional
- Stringify the output
+ :param compression_level: Compression level, typically 1-9
+ :type compression_level: int
- compression_level: int, optional
- Compression level, typically 1-9
-
- data_url_prefix: str, optional
- dataURL prefix
-
-
- Returns
- -------
-
- bytes
- Output compressed binary
+ :param data_url_prefix: dataURL prefix
+ :type data_url_prefix: str
+ :return: Output compressed binary
+ :rtype: bytes
"""
pipeline = Pipeline(file_resources('itkwasm_compress_stringify_wasi').joinpath(Path('wasm_modules') / Path('compress-stringify.wasi.wasm')))
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/parse_string_decompress.py b/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/parse_string_decompress.py
index 7f973ff61..5a3bcbd94 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/parse_string_decompress.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify-wasi/itkwasm_compress_stringify_wasi/parse_string_decompress.py
@@ -20,22 +20,14 @@ def parse_string_decompress(
) -> bytes:
"""Given a binary or string produced with compress-stringify, decompress and optionally base64 decode.
- Parameters
- ----------
+ :param input: Compressed input
+ :type input: bytes
- input: bytes
- Compressed input
-
- parse_string: bool, optional
- Parse the input string before decompression
-
-
- Returns
- -------
-
- bytes
- Output decompressed binary
+ :param parse_string: Parse the input string before decompression
+ :type parse_string: bool
+ :return: Output decompressed binary
+ :rtype: bytes
"""
pipeline = Pipeline(file_resources('itkwasm_compress_stringify_wasi').joinpath(Path('wasm_modules') / Path('parse-string-decompress.wasi.wasm')))
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/docs/Makefile b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/Makefile
new file mode 100644
index 000000000..d4bb2cbb9
--- /dev/null
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/Makefile
@@ -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 = .
+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)
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/docs/_static/favicon.png b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/_static/favicon.png
new file mode 100644
index 000000000..bd1e535c6
Binary files /dev/null and b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/_static/favicon.png differ
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/docs/_static/logo.svg b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/_static/logo.svg
new file mode 100644
index 000000000..669a445ed
--- /dev/null
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/_static/logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/docs/conf.py b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/conf.py
new file mode 100644
index 000000000..8ce2094e9
--- /dev/null
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/conf.py
@@ -0,0 +1,55 @@
+# 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
+
+from datetime import date
+
+project = 'itkwasm-compress-stringify'
+copyright = f'{date.today().year}, NumFOCUS'
+author = 'Insight Software Consortium'
+
+extensions = [
+ 'sphinx.ext.autosummary',
+ 'autodoc2',
+ 'myst_parser',
+ 'sphinx.ext.intersphinx',
+ 'sphinx_copybutton',
+ 'sphinxext.opengraph',
+ 'sphinx_design',
+]
+
+myst_enable_extensions = ["colon_fence", "fieldlist"]
+
+templates_path = ['_templates']
+exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+
+autodoc2_packages = [
+ {
+ "path": "../itkwasm_compress_stringify",
+ "exclude_files": ["_version.py"],
+ },
+]
+autodoc2_render_plugin = "myst"
+
+intersphinx_mapping = {
+ "python": ("https://docs.python.org/3/", None),
+ "itkwasm": ("https://itkwasm.readthedocs.io/en/latest/", None),
+}
+
+html_theme = 'furo'
+html_static_path = ['_static']
+html_logo = "_static/logo.svg"
+html_favicon = "_static/favicon.png"
+html_title = f"{project}"
+
+# Furo options
+html_theme_options = {
+ "top_of_page_button": "edit",
+ "source_repository": "https://github.com/InsightSoftwareConsortium/itk-wasm",
+ "source_branch": "main",
+ "source_directory": "docs",
+}
\ No newline at end of file
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/docs/index.md b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/index.md
new file mode 100644
index 000000000..97c23b49e
--- /dev/null
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/index.md
@@ -0,0 +1,21 @@
+itkwasm-compress-stringify
+=======
+
+> Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.
+
+[![itkwasm-compress-stringify version](https://badge.fury.io/py/itkwasm_compress_stringify.svg)](https://pypi.org/project/itkwasm_compress_stringify/)
+
+## Installation
+
+```shell
+pip install itkwasm-compress-stringify
+```
+
+```{toctree}
+:hidden:
+:maxdepth: 3
+:caption: 📖 Reference
+
+apidocs/index.rst
+itkwasm docs
+```
\ No newline at end of file
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/docs/make.bat b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/make.bat
new file mode 100644
index 000000000..32bb24529
--- /dev/null
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/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/packages/compress-stringify/python/itkwasm-compress-stringify/docs/requirements.txt b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/requirements.txt
new file mode 100644
index 000000000..eaed1dc05
--- /dev/null
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/docs/requirements.txt
@@ -0,0 +1,7 @@
+sphinx
+furo
+sphinx-autodoc2
+myst-parser
+sphinx-copybutton
+sphinxext-opengraph
+sphinx-design
\ No newline at end of file
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify.py b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify.py
index 9439c33b0..6fc00fa0d 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify.py
@@ -13,28 +13,20 @@ def compress_stringify(
) -> bytes:
"""Given a binary, compress and optionally base64 encode.
- Parameters
- ----------
+ :param input: Input binary
+ :type input: bytes
- input: bytes
- Input binary
+ :param stringify: Stringify the output
+ :type stringify: bool
- stringify: bool, optional
- Stringify the output
+ :param compression_level: Compression level, typically 1-9
+ :type compression_level: int
- compression_level: int, optional
- Compression level, typically 1-9
-
- data_url_prefix: str, optional
- dataURL prefix
-
-
- Returns
- -------
-
- bytes
- Output compressed binary
+ :param data_url_prefix: dataURL prefix
+ :type data_url_prefix: str
+ :return: Output compressed binary
+ :rtype: bytes
"""
func = environment_dispatch("itkwasm_compress_stringify", "compress_stringify")
output = func(input, stringify=stringify, compression_level=compression_level, data_url_prefix=data_url_prefix)
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify_async.py b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify_async.py
index ba8e0c322..b990e9436 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify_async.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/compress_stringify_async.py
@@ -13,28 +13,20 @@ async def compress_stringify_async(
) -> bytes:
"""Given a binary, compress and optionally base64 encode.
- Parameters
- ----------
+ :param input: Input binary
+ :type input: bytes
- input: bytes
- Input binary
+ :param stringify: Stringify the output
+ :type stringify: bool
- stringify: bool, optional
- Stringify the output
+ :param compression_level: Compression level, typically 1-9
+ :type compression_level: int
- compression_level: int, optional
- Compression level, typically 1-9
-
- data_url_prefix: str, optional
- dataURL prefix
-
-
- Returns
- -------
-
- bytes
- Output compressed binary
+ :param data_url_prefix: dataURL prefix
+ :type data_url_prefix: str
+ :return: Output compressed binary
+ :rtype: bytes
"""
func = environment_dispatch("itkwasm_compress_stringify", "compress_stringify_async")
output = await func(input, stringify=stringify, compression_level=compression_level, data_url_prefix=data_url_prefix)
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress.py b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress.py
index 3ebc921e5..45eecef51 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress.py
@@ -11,22 +11,14 @@ def parse_string_decompress(
) -> bytes:
"""Given a binary or string produced with compress-stringify, decompress and optionally base64 decode.
- Parameters
- ----------
+ :param input: Compressed input
+ :type input: bytes
- input: bytes
- Compressed input
-
- parse_string: bool, optional
- Parse the input string before decompression
-
-
- Returns
- -------
-
- bytes
- Output decompressed binary
+ :param parse_string: Parse the input string before decompression
+ :type parse_string: bool
+ :return: Output decompressed binary
+ :rtype: bytes
"""
func = environment_dispatch("itkwasm_compress_stringify", "parse_string_decompress")
output = func(input, parse_string=parse_string)
diff --git a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress_async.py b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress_async.py
index 07e86a310..fc0b8a9cf 100644
--- a/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress_async.py
+++ b/packages/compress-stringify/python/itkwasm-compress-stringify/itkwasm_compress_stringify/parse_string_decompress_async.py
@@ -11,22 +11,14 @@ async def parse_string_decompress_async(
) -> bytes:
"""Given a binary or string produced with compress-stringify, decompress and optionally base64 decode.
- Parameters
- ----------
+ :param input: Compressed input
+ :type input: bytes
- input: bytes
- Compressed input
-
- parse_string: bool, optional
- Parse the input string before decompression
-
-
- Returns
- -------
-
- bytes
- Output decompressed binary
+ :param parse_string: Parse the input string before decompression
+ :type parse_string: bool
+ :return: Output decompressed binary
+ :rtype: bytes
"""
func = environment_dispatch("itkwasm_compress_stringify", "parse_string_decompress_async")
output = await func(input, parse_string=parse_string)
diff --git a/packages/core/python/itkwasm/docs/conf.py b/packages/core/python/itkwasm/docs/conf.py
index a705f0f26..16c751875 100644
--- a/packages/core/python/itkwasm/docs/conf.py
+++ b/packages/core/python/itkwasm/docs/conf.py
@@ -37,6 +37,7 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
+ "numpy": ("https://numpy.org/doc/stable", None),
}
html_theme = 'furo'
diff --git a/src/bindgen/python-resources/docs/.gitignore b/src/bindgen/python-resources/docs/.gitignore
new file mode 100644
index 000000000..1fabdc368
--- /dev/null
+++ b/src/bindgen/python-resources/docs/.gitignore
@@ -0,0 +1,2 @@
+_build/
+apidocs/
diff --git a/src/bindgen/python-resources/docs/Makefile b/src/bindgen/python-resources/docs/Makefile
new file mode 100644
index 000000000..d4bb2cbb9
--- /dev/null
+++ b/src/bindgen/python-resources/docs/Makefile
@@ -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 = .
+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)
diff --git a/src/bindgen/python-resources/docs/_static/favicon.png b/src/bindgen/python-resources/docs/_static/favicon.png
new file mode 100644
index 000000000..168ca5128
Binary files /dev/null and b/src/bindgen/python-resources/docs/_static/favicon.png differ
diff --git a/src/bindgen/python-resources/docs/_static/logo.svg b/src/bindgen/python-resources/docs/_static/logo.svg
new file mode 100644
index 000000000..669a445ed
--- /dev/null
+++ b/src/bindgen/python-resources/docs/_static/logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/bindgen/python-resources/docs/conf.py b/src/bindgen/python-resources/docs/conf.py
new file mode 100644
index 000000000..a82423015
--- /dev/null
+++ b/src/bindgen/python-resources/docs/conf.py
@@ -0,0 +1,56 @@
+# 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
+
+from datetime import date
+
+project = '@bindgenProject@'
+copyright = f'{date.today().year}, NumFOCUS'
+author = 'Insight Software Consortium'
+
+extensions = [
+ 'sphinx.ext.autosummary',
+ 'autodoc2',
+ 'myst_parser',
+ 'sphinx.ext.intersphinx',
+ 'sphinx_copybutton',
+ 'sphinxext.opengraph',
+ 'sphinx_design',
+]
+
+myst_enable_extensions = ["colon_fence", "fieldlist"]
+
+templates_path = ['_templates']
+exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+
+autodoc2_packages = [
+ {
+ "path": "../@bindgenPyPackage@",
+ "exclude_files": ["_version.py"],
+ },
+]
+autodoc2_render_plugin = "myst"
+
+intersphinx_mapping = {
+ "python": ("https://docs.python.org/3/", None),
+ "numpy": ("https://numpy.org/doc/stable", None),
+ "itkwasm": ("https://itkwasm.readthedocs.io/en/latest/", None),
+}
+
+html_theme = 'furo'
+html_static_path = ['_static']
+html_logo = "_static/logo.svg"
+html_favicon = "_static/favicon.png"
+html_title = f"{project}"
+
+# Furo options
+html_theme_options = {
+ "top_of_page_button": "edit",
+ "source_repository": "@bindgenRepository@",
+ "source_branch": "main",
+ "source_directory": "docs",
+}
\ No newline at end of file
diff --git a/src/bindgen/python-resources/docs/index.md b/src/bindgen/python-resources/docs/index.md
new file mode 100644
index 000000000..118c44206
--- /dev/null
+++ b/src/bindgen/python-resources/docs/index.md
@@ -0,0 +1,21 @@
+@bindgenProject@
+=======
+
+> @bindgenPackageDescription@
+
+[![@bindgenProject@ version](https://badge.fury.io/py/@bindgenPyPackage@.svg)](https://pypi.org/project/@bindgenPyPackage@/)
+
+## Installation
+
+```shell
+pip install @bindgenProject@
+```
+
+```{toctree}
+:hidden:
+:maxdepth: 3
+:caption: 📖 Reference
+
+apidocs/index.rst
+itkwasm docs
+```
\ No newline at end of file
diff --git a/src/bindgen/python-resources/docs/make.bat b/src/bindgen/python-resources/docs/make.bat
new file mode 100644
index 000000000..32bb24529
--- /dev/null
+++ b/src/bindgen/python-resources/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/src/bindgen/python-resources/docs/requirements.txt b/src/bindgen/python-resources/docs/requirements.txt
new file mode 100644
index 000000000..eaed1dc05
--- /dev/null
+++ b/src/bindgen/python-resources/docs/requirements.txt
@@ -0,0 +1,7 @@
+sphinx
+furo
+sphinx-autodoc2
+myst-parser
+sphinx-copybutton
+sphinxext-opengraph
+sphinx-design
\ No newline at end of file
diff --git a/src/bindgen/python.js b/src/bindgen/python.js
index a4a45737b..a572cbc0c 100644
--- a/src/bindgen/python.js
+++ b/src/bindgen/python.js
@@ -240,36 +240,26 @@ function functionModuleReturnType(interfaceJson) {
}
function functionModuleDocstring(interfaceJson) {
- let docstring = `"""${interfaceJson.description}`
- docstring += `
-
- Parameters
- ----------
-
+ let docstring = `"""${interfaceJson.description}
`
interfaceJson['inputs'].forEach((value) => {
const pythonType = interfaceJsonTypeToPythonType.get(value.type)
- docstring += ` ${snakeCase(value.name)}: ${pythonType}\n`
- docstring += ` ${value.description}\n\n`
+ docstring += `\n :param ${snakeCase(value.name)}: ${value.description}\n`
+ docstring += ` :type ${snakeCase(value.name)}: ${pythonType}\n`
})
interfaceJson['parameters'].forEach((value) => {
if (value.name === "memory-io" || value.name === "version") {
return
}
const pythonType = interfaceJsonTypeToPythonType.get(value.type)
- docstring += ` ${snakeCase(value.name)}: ${pythonType}, optional\n`
- docstring += ` ${value.description}\n\n`
+ docstring += `\n :param ${snakeCase(value.name)}: ${value.description}\n`
+ docstring += ` :type ${snakeCase(value.name)}: ${pythonType}\n`
})
- docstring += `
- Returns
- -------
-
-`
const jsonOutputs = interfaceJson['outputs']
jsonOutputs.forEach((value) => {
const pythonType = interfaceJsonTypeToPythonType.get(value.type)
- docstring += ` ${pythonType}\n`
- docstring += ` ${value.description}\n\n`
+ docstring += `\n :return: ${value.description}\n`
+ docstring += ` :rtype: ${pythonType}\n`
})
docstring += ' """'
@@ -729,7 +719,49 @@ function emscriptenPackage(outputDir, buildDir, wasmBinaries, options) {
})
}
-function pythonBindings(outputDir, buildDir, wasmBinaries, options) {
+function packageDocs(packageName, packageDir, pypackage, options) {
+ const docFiles = [
+ 'requirements.txt',
+ 'Makefile',
+ 'make.bat',
+ path.join('_static', 'logo.svg'),
+ path.join('_static', 'favicon.png'),
+ ]
+
+ const docsDir = path.join(packageDir, 'docs')
+ mkdirP(docsDir)
+ mkdirP(path.join(docsDir, '_static'))
+ docFiles.forEach((filePath) => {
+ const outputPath = path.join(docsDir, filePath)
+ if (!fs.existsSync(outputPath)) {
+ const contents = fs.readFileSync(bindgenResource(path.join('docs', filePath)), {encoding:'utf8', flag:'r'})
+ fs.writeFileSync(outputPath, contents)
+ }
+ })
+
+ const confPyPath = path.join(docsDir, 'conf.py')
+ if (!fs.existsSync(confPyPath)) {
+ let confPyContent = fs.readFileSync(bindgenResource(path.join('docs', 'conf.py')), {encoding:'utf8', flag:'r'})
+ confPyContent = confPyContent.replaceAll('@bindgenProject@', packageName)
+ confPyContent = confPyContent.replaceAll('@bindgenPyPackage@', pypackage)
+ const repository = options.repository ?? 'https://github.com/InsightSoftwareConsortium/itk-wasm'
+ confPyContent = confPyContent.replaceAll('@bindgenRepository@', repository)
+ fs.writeFileSync(confPyPath, confPyContent)
+ }
+
+ const indexPath = path.join(docsDir, 'index.md')
+ if (!fs.existsSync(indexPath)) {
+ let indexContent = fs.readFileSync(bindgenResource(path.join('docs', 'index.md')), {encoding:'utf8', flag:'r'})
+ indexContent = indexContent.replaceAll('@bindgenProject@', packageName)
+ indexContent = indexContent.replaceAll('@bindgenPyPackage@', pypackage)
+ indexContent = indexContent.replaceAll('@bindgenPackageDescription@', options.packageDescription)
+ const repository = options.repository ?? 'https://github.com/InsightSoftwareConsortium/itk-wasm'
+ indexContent = indexContent.replaceAll('@bindgenRepository@', repository)
+ fs.writeFileSync(indexPath, indexContent)
+ }
+}
+
+function dispatchPackage(outputDir, buildDir, wasmBinaries, options) {
const packageName = options.packageName
const packageDir = path.join(outputDir, packageName)
mkdirP(packageDir)
@@ -744,6 +776,7 @@ function pythonBindings(outputDir, buildDir, wasmBinaries, options) {
const async = true
const sync = true
packageDunderInit(outputDir, buildDir, wasmBinaries, packageName, options.packageDescription, packageDir, pypackage, async, sync)
+ packageDocs(packageName, packageDir, pypackage, options)
wasmBinaries.forEach((wasmBinaryName) => {
const { interfaceJson } = wasmBinaryInterfaceJson(outputDir, buildDir, wasmBinaryName)
@@ -753,7 +786,7 @@ function pythonBindings(outputDir, buildDir, wasmBinaries, options) {
}
function bindgen (outputDir, buildDir, filteredWasmBinaries, options) {
- pythonBindings(outputDir, buildDir, filteredWasmBinaries, options)
+ dispatchPackage(outputDir, buildDir, filteredWasmBinaries, options)
wasiPackage(outputDir, buildDir, filteredWasmBinaries, options)
emscriptenPackage(outputDir, buildDir, filteredWasmBinaries, options)
}
diff --git a/src/bindgen/typescript.js b/src/bindgen/typescript.js
index 58cb9663d..4244d000e 100644
--- a/src/bindgen/typescript.js
+++ b/src/bindgen/typescript.js
@@ -566,7 +566,7 @@ function bindgen (outputDir, buildDir, filteredWasmBinaries, options) {
const packageName = options.packageName
readme += `# ${packageName}\n`
readme += `\n[![npm version](https://badge.fury.io/js/${packageName.replace('/', '%2F')}.svg)](https://www.npmjs.com/package/${packageName})\n`
- readme += `\n${options.packageDescription}\n`
+ readme += `\n> ${options.packageDescription}\n`
readme += `\n## Installation\n
\`\`\`sh
npm install ${packageName}