Skip to content

Commit

Permalink
Include __version__ at runtime (#176)
Browse files Browse the repository at this point in the history
This PR adds a `__version__` attribute to the top level module
  • Loading branch information
tlambert03 authored Mar 8, 2024
1 parent df846c7 commit 23a3edd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
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

0 comments on commit 23a3edd

Please sign in to comment.