import os
import sys
from pathlib import Path
from datetime import date
import subprocess
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib
pyproject_path = Path(__file__).parent.parent / "pyproject.toml"
with open(pyproject_path, "rb") as f:
pyproject_data = tomllib.load(f)
project_meta = pyproject_data.get("project", {})
project = project_meta.get("name", "scarf_python")
version = project_meta.get("version", "0.1.0")
release = version
authors_list = project_meta.get("authors", [])
author = (
", ".join([a.get("name", "") for a in authors_list if "name" in a])
or "Unknown"
)
copyright = f"{date.today().year}, {author}"
def gen_stubs():
source_dir = Path(__file__).parent.parent
stubs_dir = source_dir / "_stubs"
stubs_dir.mkdir(parents=True, exist_ok=True)
global STUBS_DIR
STUBS_DIR = stubs_dir
file_dir = Path(__file__)
run_dir = file_dir.parent.parent
subprocess.run(
["maturin", "generate-stubs", "-o", str(stubs_dir)],
cwd=run_dir,
check=True,
)
extensions = ["sphinx_rtd_theme", "sphinx_design"]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
html_context = {
"display_github": True, "github_user": "Aidan-McNay", "github_repo": "scarf", "github_version": "main", "conf_py_path": "/scarf-python/docs/", }
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
html_css_files = ["css/property.css", "css/link.css"]
def setup(app):
pass