-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: fix current version fetching in workflow and Makefile; fix test …
…for pyproject.toml; add fetch_version.py and __version__.py target to fix: issue #256
- Loading branch information
1 parent
635aea0
commit 41c44f6
Showing
6 changed files
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from policyengine_core.__version__ import __version__ | ||
|
||
|
||
def fetch_version(): | ||
try: | ||
return __version__ | ||
except Exception as e: | ||
print(f"Error fetching version: {e}") | ||
return None | ||
|
||
|
||
if __name__ == "__main__": | ||
print(fetch_version()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#! /usr/bin/env bash | ||
|
||
git tag `python setup.py --version` | ||
git tag `python .github/fetch_version.py` | ||
git push --tags || true # update the repository version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import importlib.metadata | ||
import tomli | ||
|
||
try: | ||
with open("pyproject.toml", "rb") as f: | ||
pyproject = tomli.load(f) | ||
__version__ = pyproject["project"]["version"] | ||
except Exception as e: | ||
__version__ = importlib.metadata.version("policyengine_core") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters