Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 2 additions & 14 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,18 @@
import re
import sys
from pathlib import Path
import tomllib
from importlib.metadata import version

DOCS_DIR = Path(__file__).resolve().parent
ROOT_DIR = DOCS_DIR.parent

sys.path.append(str(ROOT_DIR))
sys.path.append(str(ROOT_DIR / "src"))


def _read_release() -> str:
pyproject_file = ROOT_DIR / "pyproject.toml"
data = tomllib.loads(pyproject_file.read_text(encoding="utf-8"))

try:
return data["project"]["version"]
except KeyError as exc:
raise RuntimeError(
f"Could not determine khisto version from {pyproject_file}"
) from exc

project = 'khisto-python'
copyright = '2026, The Khiops Team'
author = 'The Khiops Team'
release = _read_release()
release = version("khisto")
Comment thread
popescu-v marked this conversation as resolved.
Outdated

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "khisto"
version = "0.2.0"
version = "0.3.0"
description = "Optimal histogram visualization using the Khiops algorithm"
readme = "README.md"
license = "BSD-3-Clause-Clear"
Expand Down Expand Up @@ -80,6 +80,7 @@ dev = [
{include-group = "test"},
{include-group = "lint"},
{include-group = "docs"},
"tomli>=2.0.0; python_version < '3.11'" # TODO : Remove on Python 3.10 EOL
]

[build-system]
Expand Down
17 changes: 14 additions & 3 deletions src/khisto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

ROOT_DIR = Path(os.path.dirname(os.path.abspath(__file__))).parent.absolute()

ROOT_DIR = Path(__file__).resolve().parent.parent
KHISTO_BIN_DIR = os.environ.get("KHISTO_BIN_DIR", "khisto")

__version__ = version("khisto")
if (ROOT_DIR / "pyproject.toml").exists():
Comment thread
popescu-v marked this conversation as resolved.
# TODO : Remove on Python 3.10 EOL
try:
import tomllib as tomli
except ModuleNotFoundError:
import tomli

with open(ROOT_DIR / "pyproject.toml", "rt") as f:
__version__ = tomli.load(f)["project"]["version"]
else:
Comment thread
popescu-v marked this conversation as resolved.
from importlib.metadata import version # noqa: E402

__version__ = version("khisto")

from .array import histogram # noqa: E402
from .core import HistogramResult # noqa: E402
Expand Down
Loading