Skip to content

Commit 5660370

Browse files
committed
Fix versioning
1 parent 9ba0c3e commit 5660370

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Version Check and population of PROJECT_VERSION var
4040
run: |
41-
PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
41+
PROJECT_VERSION=$(uv run python -c "import importlib.metadata; print(importlib.metadata.version('asyncapi-python'))")
4242
TAG=$(git describe HEAD --tags --abbrev=0)
4343
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
4444
echo "Project version: $PROJECT_VERSION"

src/asyncapi_python/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""AsyncAPI Python - Generate type-safe async Python applications from AsyncAPI 3 specifications."""
2+
3+
from importlib.metadata import version
4+
5+
try:
6+
__version__ = version("asyncapi-python")
7+
except Exception:
8+
# Fallback for development/uninstalled packages
9+
__version__ = "unknown"
10+
11+
__all__ = ["__version__"]

src/asyncapi_python_codegen/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
from .parser import extract_all_operations, load_document_info
55
from .cli import app
66

7-
__version__ = "0.1.0"
7+
from importlib.metadata import version
8+
9+
try:
10+
__version__ = version("asyncapi-python")
11+
except Exception:
12+
# Fallback for development/uninstalled packages
13+
__version__ = "unknown"
814
__all__ = ["CodeGenerator", "extract_all_operations", "load_document_info", "app"]

0 commit comments

Comments
 (0)