Skip to content

Commit 42f6e8f

Browse files
committed
Add dynamic version display in docs, VQC sensitivity experiment, and minor improvements
- Add MkDocs hook to read package version from setuptools-scm at build time, replacing the hardcoded v0.1 on the docs homepage. The hook falls back to importing from the installed package for non-editable CI installs, and to "dev" if neither source is available. - Add fetch-depth: 0 to the CI docs job so setuptools-scm can resolve version from git tags (matching deploy-docs.yml). - Add VQC hyperparameter sensitivity analysis experiment (Stage 6a.5) with grid search over learning rates and variational layers. - Add comprehensive tests for the sensitivity analysis pipeline. - Add paper/ to .gitignore for private drafts. - Switch PyPI badge to shields.io in README. - Improve instantiation consistency test with batched timings.
1 parent c4e3886 commit 42f6e8f

10 files changed

Lines changed: 2657 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ jobs:
150150
steps:
151151
- name: Checkout code
152152
uses: actions/checkout@v4
153+
with:
154+
fetch-depth: 0
153155

154156
- name: Set up Python
155157
uses: actions/setup-python@v5

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ experiments/plotting_journal.py
7171
# Verification folder (temporary)
7272
verification/
7373

74+
# Paper (private drafts)
75+
paper/
76+
7477
# OS
7578
.DS_Store
7679
Thumbs.db

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**The comprehensive library for quantum data encodings in machine learning**
66

7-
[![PyPI version](https://badge.fury.io/py/encoding-atlas.svg)](https://pypi.org/project/encoding-atlas/)
7+
[![PyPI version](https://img.shields.io/pypi/v/encoding-atlas.svg)](https://pypi.org/project/encoding-atlas/)
88
[![Python versions](https://img.shields.io/pypi/pyversions/encoding-atlas.svg)](https://pypi.org/project/encoding-atlas/)
99
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1010
[![CI](https://img.shields.io/github/actions/workflow/status/encoding-atlas/quantum-encoding-atlas/ci.yml?branch=master&logo=github&label=CI)](https://github.com/encoding-atlas/quantum-encoding-atlas/actions/workflows/ci.yml)

docs/hooks/version_hook.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""MkDocs hook to inject the package version into template context."""
2+
3+
from __future__ import annotations
4+
5+
import re
6+
from pathlib import Path
7+
8+
9+
def _read_version() -> str:
10+
"""Read version from _version.py or the installed package."""
11+
# Try 1: Read from source tree (editable install / local dev)
12+
version_file = (
13+
Path(__file__).resolve().parents[2] / "src" / "encoding_atlas" / "_version.py"
14+
)
15+
if version_file.exists():
16+
match = re.search(
17+
r'__version__\s*=\s*version\s*=\s*["\']([^"\']+)["\']',
18+
version_file.read_text(),
19+
)
20+
if match:
21+
return match.group(1)
22+
23+
# Try 2: Import from installed package (non-editable pip install in CI)
24+
try:
25+
from encoding_atlas._version import __version__
26+
27+
return __version__
28+
except ImportError:
29+
pass
30+
31+
return "dev"
32+
33+
34+
def on_config(config, **kwargs):
35+
"""Inject package_version into extra config for Jinja2 templates."""
36+
config["extra"]["package_version"] = _read_version()
37+
return config

0 commit comments

Comments
 (0)