INNER CODE UNIT · Python
oqs_python_version
open-quantum-safe/liboqs-python · oqs/oqs.py:70
def oqs_python_version() -> Union[str, None]:
"""liboqs-python version string."""
try:
result = importlib.metadata.version("liboqs-python")
except importlib.metadata.PackageNotFoundError:
warnings.warn("Please install liboqs-python using pip install", stacklevel=2)
pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
try:
# Fallback to version specified in pyproject.toml when running from the
# source tree. This allows workflows to use the correct liboqs version
# before the package is installed.
with pyproject.open("rb") as f:
data = tomllib.load(f)
return data["project"]["version"]
except (FileNotFoundError, KeyError, tomllib.TOMLDecodeError):
warnings.warn(
"Please install liboqs-python using pip install",
stacklevel=2,