Skip to content

Commit a8b5396

Browse files
committed
Add version and other config for docs
1 parent f4859df commit a8b5396

File tree

2 files changed

+49
-12
lines changed

2 files changed

+49
-12
lines changed

docs/source/conf.py

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
import sys
33

4+
from pyfracval import __version__, _authors
5+
46
# Adjust the path to go up two levels from docs/source/ to the project root
57
sys.path.insert(0, os.path.abspath("../../"))
68

@@ -12,9 +14,11 @@
1214
# -- Project information -----------------------------------------------------
1315
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1416

15-
project = "pyfracval"
16-
copyright = "2025, aetherspritee, arunoruto"
17-
author = "aetherspritee, arunoruto"
17+
18+
project = name = "PyFracVAL"
19+
author = _authors
20+
copyright = f"2025, {_authors}"
21+
version, release = __version__, __version__.split("+")[0]
1822

1923
# -- General configuration ---------------------------------------------------
2024
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -51,27 +55,39 @@
5155
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
5256

5357
# html_theme = "alabaster"
54-
html_theme = "furo"
58+
# html_theme = "furo"
59+
html_theme = "pydata_sphinx_theme"
5560
# html_logo = "_static/logo.png" # Optional: Add a logo file to _static/
5661
# html_favicon = "_static/favicon.ico" # Optional: Add a favicon
5762
html_static_path = ["_static"]
5863

5964
# Napoleon config
60-
napoleon_google_docstring = True
61-
napoleon_numpy_docstring = True # Can set one to False if you only use one style
62-
napoleon_include_init_with_doc = True # Include __init__ docstrings
65+
# napoleon_google_docstring = True
66+
napoleon_numpy_docstring = True
67+
napoleon_include_init_with_doc = False # Include __init__ docstrings
6368
napoleon_include_private_with_doc = False # Usually False
6469
napoleon_include_special_with_doc = True
6570
napoleon_use_admonition_for_examples = False
6671
napoleon_use_admonition_for_notes = False
6772
napoleon_use_admonition_for_references = False
68-
napoleon_use_ivar = False
69-
napoleon_use_param = True
70-
napoleon_use_rtype = True
73+
# napoleon_use_ivar = False
74+
# napoleon_use_param = True
75+
# napoleon_use_rtype = True
7176
napoleon_preprocess_types = False # Let sphinx-autodoc-typehints handle types
7277
napoleon_type_aliases = None
7378
napoleon_attr_annotations = True
7479

80+
# autodoc
81+
autoclass_content = "class"
82+
autodoc_typehints = "none"
83+
autodoc_default_options = {
84+
"members": True,
85+
"member-order": "bysource",
86+
"undoc-members": True,
87+
"show-inheritance": True,
88+
}
89+
inheritance_alias = {}
90+
7591
# autoapi
7692
autoapi_dirs = ["../../pyfracval"]
7793
autoapi_options = [
@@ -94,11 +110,12 @@
94110
# Process return type hints
95111
typehints_document_rtype = True
96112
# Don't use napoleon rtype processing, let extension handle it
97-
typehints_use_rtype = False
113+
# typehints_use_rtype = False
98114
# Show default values after comma, 'braces' is other option
99-
typehints_defaults = "comma"
115+
# typehints_defaults = "comma"
100116
# Optional: Simplify representation of complex types like Union[str, Path]
101117
# typehints_formatter = lambda annotation, config: repr(annotation)
118+
always_use_bars_union = True
102119

103120
## BibTeX Configuration: Tell the extension where your .bib file is:
104121
bibtex_bibfiles = ["references.bib"] # Assumes references.bib is in docs/source/

pyfracval/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
"""Core package for PyFracVAL, a fractal aggregate generator."""
2+
3+
import tomllib
4+
from pathlib import Path
5+
6+
__version__ = ""
7+
_authors = ""
8+
9+
project_root = Path(__file__).parent.parent
10+
with open(project_root / "pyproject.toml", "rb") as f:
11+
data = tomllib.load(f)
12+
13+
if "version" in data["project"]:
14+
__version__ = data["project"]["version"]
15+
else:
16+
raise ValueError("Version not found in pyproject.toml")
17+
18+
if "authors" in data["project"]:
19+
_authors = ",".join([x["name"] for x in data["project"]["authors"]])
20+
else:
21+
raise ValueError("Version not found in pyproject.toml")

0 commit comments

Comments
 (0)