Skip to content

Commit 5deb3c2

Browse files
authored
Merge pull request #271 from python-openapi/fix/readthedocs-build-fix
Readthedocs build fix
2 parents 353a0f3 + 66ab8c4 commit 5deb3c2

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

.github/workflows/docs-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323

2424
- name: Set up poetry
2525
uses: Gr1N/setup-poetry@v9
26+
with:
27+
poetry-version: "2.1.1"
2628

2729
- name: Configure poetry
2830
run: poetry config virtualenvs.in-project true

.readthedocs.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ sphinx:
66
formats: all
77

88
build:
9-
os: ubuntu-20.04
9+
os: ubuntu-24.04
1010
tools:
1111
python: "3.10"
1212
jobs:
1313
post_create_environment:
14-
- pip install poetry
14+
- pip install "poetry==2.1.1"
1515
- poetry config virtualenvs.create false
1616
post_install:
17-
- poetry install --with docs
17+
- poetry install --with docs --no-interaction --no-ansi
18+
- python -m pip install --no-cache-dir "sphinx-immaterial>=0.11,<0.14"

docs/conf.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
import openapi_schema_validator
1+
import re
2+
import sys
3+
from pathlib import Path
4+
5+
ROOT_DIR = Path(__file__).resolve().parents[1]
6+
sys.path.insert(0, str(ROOT_DIR))
7+
8+
9+
def _read_project_version() -> str:
10+
pyproject_path = ROOT_DIR / "pyproject.toml"
11+
pyproject_content = pyproject_path.read_text(encoding="utf-8")
12+
match = re.search(
13+
r"\[tool\.poetry\][\s\S]*?^version\s*=\s*\"([^\"]+)\"",
14+
pyproject_content,
15+
re.MULTILINE,
16+
)
17+
if match is None:
18+
return "unknown"
19+
return match.group(1)
20+
221

322
project = "openapi-schema-validator"
423
copyright = "2023, Artur Maciag"
524
author = "Artur Maciag"
625

7-
release = openapi_schema_validator.__version__
26+
release = _read_project_version()
827

928
extensions = [
1029
"sphinx.ext.autodoc",

0 commit comments

Comments
 (0)