🌐 AI搜索 & 代理 主页
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pythonnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
_LOADED: bool = False


try:
import importlib.metadata
__version__ = importlib.metadata.version("pythonnet")
except Exception:
try:
import pkg_resources # part of setuptools
__version__ = pkg_resources.require("pythonnet")[0].version
except Exception:
try:
with open(Path(__file__).parent.parent / "version.txt") as f:
__version__ = f.read().strip()
except Exception:
__version__ = "unknown"


def set_runtime(runtime: Union[clr_loader.Runtime, str], **params: str) -> None:
"""Set up a clr_loader runtime without loading it

Expand Down