We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 776bc6b commit 587eb94Copy full SHA for 587eb94
src/gitfetch/__init__.py
@@ -7,7 +7,15 @@
7
8
9
def _get_version() -> str:
10
- """Get version from pyproject.toml."""
+ """Get version from package metadata or pyproject.toml."""
11
+ try:
12
+ # Try to get version from package metadata
13
+ from importlib import metadata
14
+ return metadata.version("gitfetch")
15
+ except (ImportError, metadata.PackageNotFoundError):
16
+ pass
17
+
18
+ # Fallback: try to read from pyproject.toml (works in development)
19
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
20
try:
21
with open(pyproject_path, "r", encoding="utf-8") as f:
0 commit comments