From ca105485332d1e68b4b03ddb55eafa4994f6cbae Mon Sep 17 00:00:00 2001 From: Popescu V <136721202+popescu-v@users.noreply.github.com> Date: Fri, 6 Mar 2026 19:31:33 +0100 Subject: [PATCH 1/5] chore: add Sphinx-generated build scripts --- docs/Makefile | 20 ++++++++++++++++++++ docs/make.bat | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/make.bat diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/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/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..32bb245 --- /dev/null +++ b/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 From dfd8d8c0f0368831159d9edff61ada370e1b5886 Mon Sep 17 00:00:00 2001 From: Popescu V <136721202+popescu-v@users.noreply.github.com> Date: Fri, 6 Mar 2026 19:31:57 +0100 Subject: [PATCH 2/5] chore: add Sphinx configuration file Edited to add extensions and customizations. --- docs/conf.py | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 docs/conf.py diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..7b9672c --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,101 @@ +# 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 +import os +import sys +from pathlib import Path + +sys.path.append("..") +sys.path.append(os.path.join("..", "src")) + +project = 'khisto-python' +copyright = '2026, The Khiops Team' +author = 'The Khiops Team' +release = "0.1.0" # TODO: use pyproject metadata here + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration +# Be strict about any broken references +nitpicky = True + +# To avoid using qualifiers like :class: to reference objects within the same context +default_role = "obj" + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "numpydoc", + "sphinx_copybutton", +] + +## Numpydoc extension config +numpydoc_show_class_members = False + +## Autodoc extension config +autodoc_default_options = { + "members": True, + "inherited-members": False, + "private-members": False, + "show-inheritance": True, + "special-members": False, +} + +## Intersphinx extension config +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "numpy": ("https://numpy.org/doc/stable", None), + "matplotlib": ("https://matplotlib.org/stable", None), +} + +templates_path = ['_templates'] +exclude_patterns = ['_templates', '_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 = 'furo' +html_theme_options = { + "light_css_variables": { + "color-brand-primary": "#FF7900", + "color-brand-content": "#F16E00", + "color-brand-visited": "#FF7900", + "color-sidebar-background": "#FFFFFF", + "color-highlighted-background": "#FFD200", + "color-admonition-title--note": "#FF7900", + "color-admonition-title-background--note": "#FFF0E2", + "font-stack": "Helvetica Neue, Helvetica, sans-serif", + }, + "dark_css_variables": { + "color-brand-primary": "#FF7900", + "color-brand-content": "#F16E00", + "color-brand-visited": "#FF7900", + "color-sidebar-background": "#000000", + "color-highlighted-background": "#FFD200", + "color-admonition-title--note": "#FF7900", + "color-admonition-title-background--note": "#CC6100", + "font-stack": "Helvetica Neue, Helvetica, sans-serif", + }, + # Sets the Github Icon (the SVG is embedded, copied from furo's repo) + "footer_icons": [ + { + "name": "GitHub", + "url": "https://github.com/khiopsml/khisto-python", + "html": """ + + + + """, + "class": "", + }, + ], +} +html_title = f"
{project} {release}
" +html_static_path = ['_static'] +html_css_files = ["css/custom.css"] From 231f073be23e3459d7b8a96ceab889a6d4e94159 Mon Sep 17 00:00:00 2001 From: Popescu V <136721202+popescu-v@users.noreply.github.com> Date: Fri, 6 Mar 2026 19:32:33 +0100 Subject: [PATCH 3/5] docs: add custom CSS file (copied from khiops-python) --- docs/_static/css/custom.css | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/_static/css/custom.css diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css new file mode 100644 index 0000000..9868fd3 --- /dev/null +++ b/docs/_static/css/custom.css @@ -0,0 +1,24 @@ +/* Custom header sizes */ +h1 { + font-size: 1.85em; +} + +h2 { + font-size: 1.55em; +} + +h3 { + font-size: 1.30em; +} + +h4 { + font-size: 1.10em; +} + +h5 { + font-size: 0.90em; +} + +img.sidebar-logo { + width: 40px; +} From 17f1e53fa9e8d6cb7757a779ad820e948d0160b5 Mon Sep 17 00:00:00 2001 From: Popescu V <136721202+popescu-v@users.noreply.github.com> Date: Fri, 6 Mar 2026 19:33:16 +0100 Subject: [PATCH 4/5] docs: add Sphinx documentation index --- docs/array/histogram/index.rst | 14 ++++++++++++++ docs/core/index.rst | 14 ++++++++++++++ docs/index.rst | 22 ++++++++++++++++++++++ docs/matplotlib/index.rst | 14 ++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 docs/array/histogram/index.rst create mode 100644 docs/core/index.rst create mode 100644 docs/index.rst create mode 100644 docs/matplotlib/index.rst diff --git a/docs/array/histogram/index.rst b/docs/array/histogram/index.rst new file mode 100644 index 0000000..112f3f6 --- /dev/null +++ b/docs/array/histogram/index.rst @@ -0,0 +1,14 @@ +====================== +khisto.array.histogram +====================== + +.. automodule:: khisto.array.histogram + +Main Modules +============ +.. autosummary:: + :toctree: generated + :recursive: + :nosignatures: + + api diff --git a/docs/core/index.rst b/docs/core/index.rst new file mode 100644 index 0000000..f6c205c --- /dev/null +++ b/docs/core/index.rst @@ -0,0 +1,14 @@ +============ +khisto.core +============ + +.. automodule:: khisto.core + +Main Modules +============ +.. autosummary:: + :toctree: generated + :recursive: + :nosignatures: + + cli_adapter diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..4381586 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,22 @@ +.. khisto-python documentation master file, created by + sphinx-quickstart on Fri Mar 6 17:40:33 2026. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +khisto-python documentation +=========================== + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: API Reference + :hidden: + + Histograms + Core + Matplotlib + diff --git a/docs/matplotlib/index.rst b/docs/matplotlib/index.rst new file mode 100644 index 0000000..c5224d8 --- /dev/null +++ b/docs/matplotlib/index.rst @@ -0,0 +1,14 @@ +================= +khisto.matplotlib +================= + +.. automodule:: khisto.matplotlib + +Main Modules +============ +.. autosummary:: + :toctree: generated + :recursive: + :nosignatures: + + hist From c13c39b64966647646313fddf2e4785b0bb8836f Mon Sep 17 00:00:00 2001 From: Popescu V <136721202+popescu-v@users.noreply.github.com> Date: Fri, 6 Mar 2026 19:43:11 +0100 Subject: [PATCH 5/5] fix: hard-code khisto version Otherwise, Sphinx cannot find the khisto package metadata, because khisto itself is not installed. TODO: Use this version in pyproject.toml itself as well. --- src/khisto/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khisto/__init__.py b/src/khisto/__init__.py index 58cc91f..5fb002f 100644 --- a/src/khisto/__init__.py +++ b/src/khisto/__init__.py @@ -14,7 +14,7 @@ KHISTO_BIN_DIR = os.environ.get("KHISTO_BIN_DIR", "khisto") -__version__ = version("khisto") +__version__ = "0.1.0" from .array import histogram # noqa: E402 from .core import HistogramResult # noqa: E402