From 0654da02c57728fdf4197fcb4c3e937cce4d7c9c Mon Sep 17 00:00:00 2001 From: Adrien Berchet Date: Tue, 23 Apr 2024 16:16:11 +0200 Subject: [PATCH 1/2] Add __version__ attribute --- neurom/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neurom/__init__.py b/neurom/__init__.py index 2bc7e4ab..04422b3b 100644 --- a/neurom/__init__.py +++ b/neurom/__init__.py @@ -55,6 +55,8 @@ >>> mapping = lambda n : len(n.points) >>> n_points = [n for n in nm.iter_neurites(pop, mapping, filter)] """ +from importlib.metadata import version + from neurom.core.dataformat import COLS from neurom.core.morphology import graft_morphology, iter_neurites, iter_sections, iter_segments from neurom.core.types import NEURITES as NEURITE_TYPES @@ -68,3 +70,5 @@ AXON = NeuriteType.axon SOMA = NeuriteType.soma ANY_NEURITE = NeuriteType.all + +__version__ = version(__package__) From afbe4ee948f4f36498cb793511945708e8d9410e Mon Sep 17 00:00:00 2001 From: Adrien Berchet Date: Tue, 23 Apr 2024 16:22:13 +0200 Subject: [PATCH 2/2] Move __version__ before other imports --- neurom/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neurom/__init__.py b/neurom/__init__.py index 04422b3b..4a8c5242 100644 --- a/neurom/__init__.py +++ b/neurom/__init__.py @@ -57,6 +57,8 @@ """ from importlib.metadata import version +__version__ = version(__package__) + from neurom.core.dataformat import COLS from neurom.core.morphology import graft_morphology, iter_neurites, iter_sections, iter_segments from neurom.core.types import NEURITES as NEURITE_TYPES @@ -70,5 +72,3 @@ AXON = NeuriteType.axon SOMA = NeuriteType.soma ANY_NEURITE = NeuriteType.all - -__version__ = version(__package__)