File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1- import openapi_schema_validator
1+ import sys
2+ from pathlib import Path
3+ import re
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 )
220
321project = "openapi-schema-validator"
422copyright = "2023, Artur Maciag"
523author = "Artur Maciag"
624
7- release = openapi_schema_validator . __version__
25+ release = _read_project_version ()
826
927extensions = [
1028 "sphinx.ext.autodoc" ,
You can’t perform that action at this time.
0 commit comments