diff --git a/pyproject.toml b/pyproject.toml index f257735f..6efc781a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,6 +113,7 @@ ignore_missing_imports = true [tool.coverage.run] omit = [ "python/outlines_core/_version.py", + "python/outlines_core/__init__.py", "tests/*", ] branch = true diff --git a/python/outlines_core/__init__.py b/python/outlines_core/__init__.py index ed2d5a9c..03df0bb7 100644 --- a/python/outlines_core/__init__.py +++ b/python/outlines_core/__init__.py @@ -1,4 +1,12 @@ """Outlines is a Generative Model Programming Framework.""" +from importlib.metadata import PackageNotFoundError, version + import outlines_core.models +try: + __version__ = version("outlines_core") +except PackageNotFoundError: + pass + + __all__ = ["models"]