- add __version__ for python
This commit is contained in:
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@@ -172,7 +172,7 @@ jobs:
|
|||||||
publish \
|
publish \
|
||||||
--workspace \
|
--workspace \
|
||||||
--all-features \
|
--all-features \
|
||||||
--allow-branch HEAD \
|
--allow-branch "main" \
|
||||||
--no-confirm \
|
--no-confirm \
|
||||||
--no-verify \
|
--no-verify \
|
||||||
--execute
|
--execute
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tiffwrite"
|
name = "tiffwrite"
|
||||||
version = "2024.10.9"
|
version = "2024.11.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Wim Pomp <w.pomp@nki.nl>"]
|
authors = ["Wim Pomp <w.pomp@nki.nl>"]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from importlib.metadata import version
|
||||||
from itertools import product
|
from itertools import product
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, Sequence
|
from typing import Any, Callable, Sequence
|
||||||
@@ -16,6 +17,10 @@ from . import tiffwrite_rs as rs # noqa
|
|||||||
|
|
||||||
__all__ = ['IJTiffFile', 'IJTiffParallel', 'FrameInfo', 'Tag', 'tiffwrite']
|
__all__ = ['IJTiffFile', 'IJTiffParallel', 'FrameInfo', 'Tag', 'tiffwrite']
|
||||||
|
|
||||||
|
try:
|
||||||
|
__version__ = version(Path(__file__).parent.name)
|
||||||
|
except Exception: # noqa
|
||||||
|
__version__ = "unknown"
|
||||||
|
|
||||||
Tag = rs.Tag
|
Tag = rs.Tag
|
||||||
FrameInfo = tuple[ArrayLike, int, int, int]
|
FrameInfo = tuple[ArrayLike, int, int, int]
|
||||||
@@ -172,10 +177,11 @@ def tiffwrite(file: str | Path, data: np.ndarray, axes: str = 'TZCXY', dtype: DT
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from parfor import ParPool, Task
|
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
from parfor import ParPool, Task
|
||||||
|
|
||||||
|
|
||||||
class Pool(ParPool):
|
class Pool(ParPool):
|
||||||
def __init__(self, ijtifffile: IJTiffFile, parallel: Callable[[Any], Sequence[FrameInfo]]):
|
def __init__(self, ijtifffile: IJTiffFile, parallel: Callable[[Any], Sequence[FrameInfo]]):
|
||||||
@@ -225,4 +231,4 @@ try:
|
|||||||
self.pool.close()
|
self.pool.close()
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
IJTiffPool = None
|
IJTiffParallel = None
|
||||||
|
|||||||
Reference in New Issue
Block a user