Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include __version__ at runtime #176

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion python/acquire/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
Tuple,
Union,
)

from importlib.metadata import version, PackageNotFoundError
import numpy.typing as npt

from . import acquire
from .acquire import *

try:
__version__ = version("acquire-imaging")
except PackageNotFoundError:
__version__ = "uninstalled"

__doc__ = acquire.__doc__

import logging
Expand Down
2 changes: 2 additions & 0 deletions python/acquire/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import napari # type: ignore

from .acquire import Runtime, Properties

__version__: str

def setup(
runtime: Runtime,
camera: Union[str, List[str]] = ...,
Expand Down
7 changes: 7 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ def runtime():
yield acquire.Runtime()


def test_version():
assert isinstance(acquire.__version__, str)
# this will fail if pip install -e . has not been run
# so feel free to remove this line if it's not what you want to test
assert acquire.__version__ != "uninstalled"


def test_set():
t = Trigger()
assert not t.enable
Expand Down
Loading