Skip to content

Commit fb1053a

Browse files
Added dynamic verisoning to RSMetaCheck report #73
1 parent 2f14719 commit fb1053a

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/rsmetacheck/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
1+
import importlib.metadata
2+
3+
try:
4+
__version__ = importlib.metadata.version("rsmetacheck")
5+
except importlib.metadata.PackageNotFoundError:
6+
try:
7+
import tomllib
8+
from pathlib import Path
9+
_pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
10+
with open(_pyproject_path, "rb") as _f:
11+
__version__ = tomllib.load(_f)["tool"]["poetry"]["version"]
12+
except Exception:
13+
__version__ = "unknown"
14+
115
from .detect_pitfalls_main import main
216
from .cli import cli

src/rsmetacheck/utils/json_ld_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from typing import Dict, List
88
from urllib.error import HTTPError, URLError
99

10+
from rsmetacheck import __version__ as rsmetacheck_version
11+
1012

1113
def _fetch_gitlab_commit_id(host: str, project_path: str) -> str:
1214
"""
@@ -723,7 +725,7 @@ def create_pitfall_jsonld(somef_data: Dict, pitfall_results: List[Dict], file_na
723725
"@type": "schema:SoftwareApplication",
724726
"name": "RSMetacheck",
725727
"@id": "https://w3id.org/rsmetacheck",
726-
"softwareVersion": "0.2.1"
728+
"softwareVersion": rsmetacheck_version
727729
},
728730
"checks": []
729731
}

0 commit comments

Comments
 (0)