Skip to content

Commit 02dafef

Browse files
committed
[DOC] dynamically get supported python versions + update .css
1 parent b558859 commit 02dafef

3 files changed

Lines changed: 103 additions & 35 deletions

File tree

docs/source/_static/css/custom.css

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
/* Custom CSS for Hyperactive documentation */
2-
/* Landing page styling for a mature, professional appearance */
2+
/* Purple/Violet theme matching the Hyperactive logo */
33

44
/* ============================================
55
CSS Variables for consistent theming
66
============================================ */
77
:root {
8-
--hyperactive-primary: #0eac92;
9-
--hyperactive-secondary: #2077b4;
10-
--hyperactive-accent: #4c9aff;
11-
--hyperactive-dark: #1a1a2e;
8+
/* Purple/violet colors from the Hyperactive logo */
9+
--hyperactive-primary: #5D5D7A;
10+
--hyperactive-secondary: #7070A0;
11+
--hyperactive-accent: #8080B0;
12+
--hyperactive-dark: #4A4A65;
1213
--hyperactive-light: #f8f9fa;
13-
--hyperactive-gradient: linear-gradient(135deg, #0eac92 0%, #2077b4 100%);
14-
--hyperactive-gradient-dark: linear-gradient(135deg, #0a8c76 0%, #1a5a8a 100%);
14+
--hyperactive-gradient: linear-gradient(135deg, #5D5D7A 0%, #8080B0 100%);
15+
--hyperactive-gradient-dark: linear-gradient(135deg, #4A4A65 0%, #6B6B8E 100%);
1516
--card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
1617
--card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
18+
/* Neutral separator color */
19+
--separator-color: #dee2e6;
20+
}
21+
22+
html[data-theme="dark"] {
23+
--separator-color: #3d3d4d;
1724
}
1825

1926
/* ============================================
@@ -180,11 +187,11 @@ html[data-theme="dark"] .algo-card {
180187
}
181188

182189
.optuna-card {
183-
border-left-color: #7c4dff !important;
190+
border-left-color: var(--hyperactive-accent) !important;
184191
}
185192

186193
.optuna-card:hover {
187-
border-left-color: #651fff !important;
194+
border-left-color: var(--hyperactive-primary) !important;
188195
}
189196

190197
/* ============================================
@@ -303,7 +310,7 @@ html[data-theme="dark"] .algo-card {
303310
}
304311

305312
.sd-tab-label:hover {
306-
background-color: rgba(14, 172, 146, 0.1);
313+
background-color: rgba(93, 93, 122, 0.1);
307314
}
308315

309316
input[name^="sd-tab-set"]:checked + label {
@@ -312,36 +319,27 @@ input[name^="sd-tab-set"]:checked + label {
312319
}
313320

314321
/* ============================================
315-
Section Dividers
322+
Section Separators - Full Width Horizontal Lines
316323
============================================ */
317324
hr {
318325
border: none;
319326
height: 1px;
320-
background: linear-gradient(90deg, transparent, #dee2e6, transparent);
327+
background-color: var(--separator-color);
321328
margin: 2.5rem 0;
322-
}
323-
324-
html[data-theme="dark"] hr {
325-
background: linear-gradient(90deg, transparent, #3d3d4d, transparent);
329+
width: 100%;
326330
}
327331

328332
/* ============================================
329-
Section Headers
333+
Section Headers - Clean without decorative underlines
330334
============================================ */
331335
h2 {
332336
position: relative;
333-
padding-bottom: 0.5rem;
337+
padding-bottom: 0;
334338
}
335339

340+
/* Remove the short underline pseudo-element */
336341
h2::after {
337-
content: '';
338-
position: absolute;
339-
left: 0;
340-
bottom: 0;
341-
width: 60px;
342-
height: 3px;
343-
background: var(--hyperactive-gradient);
344-
border-radius: 2px;
342+
display: none;
345343
}
346344

347345
/* ============================================
@@ -356,7 +354,7 @@ h2::after {
356354
.sd-btn-primary:hover {
357355
background: var(--hyperactive-gradient-dark) !important;
358356
transform: translateY(-1px);
359-
box-shadow: 0 4px 12px rgba(14, 172, 146, 0.4);
357+
box-shadow: 0 4px 12px rgba(93, 93, 122, 0.4);
360358
}
361359

362360
/* ============================================

docs/source/conf.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import datetime
55
import os
6+
import re
67
import sys
78
from pathlib import Path
89

@@ -18,6 +19,56 @@
1819
if not ON_READTHEDOCS:
1920
sys.path.insert(0, os.path.abspath("../.."))
2021

22+
23+
# -- Extract metadata from pyproject.toml ------------------------------------
24+
# This allows documentation to stay in sync with pyproject.toml automatically
25+
26+
def extract_pyproject_metadata():
27+
"""Extract metadata from pyproject.toml for use in documentation."""
28+
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
29+
30+
metadata = {
31+
"python_versions": [],
32+
"min_python": "3.10",
33+
"dependencies": [],
34+
"version": hyperactive.__version__,
35+
}
36+
37+
if pyproject_path.exists():
38+
content = pyproject_path.read_text()
39+
40+
# Extract Python versions from classifiers
41+
# Pattern: "Programming Language :: Python :: 3.XX"
42+
py_version_pattern = r'"Programming Language :: Python :: (3\.\d+)"'
43+
versions = re.findall(py_version_pattern, content)
44+
if versions:
45+
metadata["python_versions"] = sorted(set(versions))
46+
47+
# Extract requires-python
48+
requires_python_match = re.search(r'requires-python\s*=\s*"([^"]+)"', content)
49+
if requires_python_match:
50+
req = requires_python_match.group(1)
51+
# Extract minimum version from ">=3.10" or similar
52+
min_match = re.search(r">=\s*([\d.]+)", req)
53+
if min_match:
54+
metadata["min_python"] = min_match.group(1)
55+
56+
# Extract core dependencies
57+
deps_match = re.search(
58+
r"dependencies\s*=\s*\[(.*?)\]", content, re.DOTALL
59+
)
60+
if deps_match:
61+
deps_text = deps_match.group(1)
62+
# Extract package names (first word before any version specifier)
63+
dep_names = re.findall(r'"([a-zA-Z][a-zA-Z0-9_-]*)', deps_text)
64+
metadata["dependencies"] = dep_names
65+
66+
return metadata
67+
68+
69+
# Extract metadata once at configuration time
70+
PYPROJECT_METADATA = extract_pyproject_metadata()
71+
2172
# -- Project information -----------------------------------------------------
2273
current_year = datetime.datetime.now().year
2374
project = "hyperactive"
@@ -311,3 +362,25 @@ def adds(pth):
311362
copybutton_prompt_text = r">>> |\.\.\. |\$ "
312363
copybutton_prompt_is_regexp = True
313364
copybutton_line_continuation_character = "\\"
365+
366+
# -- RST Epilog: Make metadata available as substitutions in RST files -------
367+
# These can be used as |variable_name| in RST files
368+
369+
# Build Python versions list dynamically
370+
_py_versions = PYPROJECT_METADATA["python_versions"]
371+
if _py_versions:
372+
_py_versions_list = "\n".join(f"- Python {v}" for v in _py_versions)
373+
_py_versions_inline = ", ".join(_py_versions)
374+
_py_version_range = f"{_py_versions[0]} through {_py_versions[-1]}"
375+
else:
376+
_py_versions_list = "- Python 3.10+"
377+
_py_versions_inline = "3.10+"
378+
_py_version_range = "3.10+"
379+
380+
rst_epilog = f"""
381+
.. |version| replace:: {PYPROJECT_METADATA["version"]}
382+
.. |min_python| replace:: {PYPROJECT_METADATA["min_python"]}
383+
.. |python_versions_list| replace:: {_py_versions_inline}
384+
.. |python_version_range| replace:: {_py_version_range}
385+
.. |current_year| replace:: {current_year}
386+
"""

docs/source/installation.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Installation
55
============
66

7-
Hyperactive can be installed via pip and supports Python 3.10 through 3.14.
7+
Hyperactive can be installed via pip and supports Python |python_version_range|.
88

99
Installing Hyperactive
1010
----------------------
@@ -167,16 +167,13 @@ After installation, verify that Hyperactive is working correctly:
167167
Python Version Support
168168
----------------------
169169

170-
Hyperactive officially supports:
171-
172-
- Python 3.10
173-
- Python 3.11
174-
- Python 3.12
175-
- Python 3.13
176-
- Python 3.14 (with some optional dependency limitations)
170+
Hyperactive officially supports Python |python_versions_list|.
177171

178172
.. note::
179173

174+
The supported Python versions are automatically extracted from the project's
175+
``pyproject.toml`` classifiers.
176+
180177
Some optional integrations (sktime, PyTorch) may have more restrictive
181178
Python version requirements. Check the specific package documentation
182179
for details.

0 commit comments

Comments
 (0)