Skip to content

Commit 777b38b

Browse files
committed
chore: update Sphinx documentation build process and dependencies in pyproject.toml
1 parent 4e77841 commit 777b38b

File tree

3 files changed

+61
-21
lines changed

3 files changed

+61
-21
lines changed

.github/workflows/docs.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ jobs:
3030
3131
- name: Build Sphinx Documentation
3232
run: |
33-
# Generate RST files from source if they don't exist
34-
uv run sphinx-apidoc -o docs/ src/tether/
35-
# Build the HTML
36-
cd docs && uv run make html
33+
cd docs
34+
mkdir -p source/_static
35+
uv run sphinx-build -M html source build -W
3736
37+
deploy:
38+
environment:
39+
name: github-pages
40+
url: ${{ steps.deployment.outputs.page_url }}
41+
runs-on: ubuntu-latest
42+
needs: build
43+
steps:
3844
- name: Deploy to GitHub Pages
39-
uses: JamesIves/github-pages-deploy-action@v4
40-
with:
41-
folder: docs/_build/html # The folder the action should deploy.
42-
branch: gh-pages # The branch the action should deploy to.
45+
id: deployment
46+
uses: actions/deploy-pages@v4

docs/conf.py

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
11
import os
22
import sys
33
# Ensure Sphinx can find the source code
4-
sys.path.insert(0, os.path.abspath('../src'))
4+
sys.path.insert(0, os.path.abspath("../src"))
5+
6+
7+
def get_project_metadata():
8+
import pathlib
9+
import sys
10+
11+
pyproject_path = pathlib.Path(__file__).parents[2] / "pyproject.toml"
12+
if sys.version_info >= (3, 11):
13+
import tomllib
14+
15+
with open(pyproject_path, "rb") as f:
16+
data = tomllib.load(f)
17+
else:
18+
try:
19+
import tomli
20+
21+
with open(pyproject_path, "rb") as f:
22+
data = tomli.load(f)
23+
except ImportError:
24+
return {}
25+
project = data.get("project", {})
26+
author = project.get("authors", [{}])[0].get("name", "")
27+
copyright_year = re.search(r"\\d{4}", project.get("version", ""))
28+
copyright_str = f"{copyright_year.group(0) if copyright_year else ''}, {author}"
29+
return {
30+
"project": project.get("name", "SheetWise"),
31+
"author": author,
32+
"release": project.get("version", "0.0.0"),
33+
"copyright": copyright_str,
34+
}
35+
36+
37+
meta = get_project_metadata()
538

639
project = 'Tether'
740
copyright = '2025, Khushiyant'
8-
author = 'Khushiyant'
9-
release = '0.0.1'
41+
author = meta.get("author", "Khushiyant")
42+
release = meta.get("release", "0.6.0")
1043

1144
extensions = [
1245
'sphinx.ext.autodoc', # Core library for html generation from docstrings
@@ -20,10 +53,12 @@
2053
templates_path = ['_templates']
2154
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
2255

23-
# Use the Read the Docs theme
24-
html_theme = 'sphinx_rtd_theme'
25-
html_static_path = ['_static']
56+
html_static_path = ["_static"]
57+
html_theme = "furo"
2658

27-
# Napoleon settings to handle your current docstring style
28-
napoleon_google_docstring = False
29-
napoleon_numpy_docstring = True
59+
# Optional: Furo specific customization
60+
html_theme_options = {
61+
"source_repository": "https://github.com/Khushiyant/tenso",
62+
"source_branch": "main",
63+
"source_directory": "docs/source/",
64+
}

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ build-backend = "hatchling.build"
1414
[project.optional-dependencies]
1515
dev = ["pytest>=9.0.2"]
1616
docs = [
17-
"sphinx>=7.0.0",
18-
"sphinx-rtd-theme>=2.0.0",
19-
"myst-parser>=2.0.0", # For Markdown support
20-
"sphinx-autodoc-typehints"
17+
"sphinx>=8.1.3",
18+
"sphinx-autodoc-typehints>=3.0.1",
19+
"sphinx-rtd-theme>=3.0.0",
20+
"myst-parser>=4.0.1",
21+
"furo>=2025.9.25",
2122
]
2223

2324
[tool.hatch.build.targets.wheel]

0 commit comments

Comments
 (0)