From 7885cdced9049175e24aa00fd61604bcd4bcf150 Mon Sep 17 00:00:00 2001 From: Robin De Schepper Date: Thu, 4 Dec 2025 13:48:29 +0100 Subject: [PATCH 1/2] Added __all__ attribute to clarify re-export intentions closes #31 --- morphio/__init__.py | 105 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/morphio/__init__.py b/morphio/__init__.py index 53a3fe6b..3f6a2d04 100644 --- a/morphio/__init__.py +++ b/morphio/__init__.py @@ -56,3 +56,108 @@ vasculature, version, ) + +import platform + + +if platform.system() == "Windows": + # the plan is to leverage the h5py inclusion of hdf5 dll; this way + # there cannot be a mismatch between version, when using windows, + # and MorphIO doesn't need to build hdf5 + import h5py as _h5py + if (1, 14) != _h5py.version.hdf5_version_tuple[:2]: + raise RuntimeError(f'HDF5 library version mismatch. 1.14.x != {_h5py.version.hdf5_version}') + del _h5py + + +from ._morphio import ( + Annotation, + AnnotationType, + CellFamily, + CellLevel, + Collection, + DendriticSpine, + EndoplasmicReticulum, + GlialCell, + IDSequenceError, + IterType, + LogLevel, + MissingParentError, + MitoSection, + Mitochondria, + MitochondriaPointLevel, + MorphioError, + Morphology, + MultipleTrees, + Option, + PointLevel, + Points, + PostSynapticDensity, + Properties, + RawDataError, + Section, + SectionBuilderError, + SectionLevel, + SectionType, + Soma, + SomaError, + SomaType, + UnknownFileType, + VasculatureSectionType, + Warning, + WarningHandlerCollector, + WriterError, + mut, + ostream_redirect, + set_ignored_warning, + set_raise_warnings, + set_maximum_warnings, + vasculature, + version, +) + +__all__ = [ + "Annotation", + "AnnotationType", + "CellFamily", + "CellLevel", + "Collection", + "DendriticSpine", + "EndoplasmicReticulum", + "GlialCell", + "IDSequenceError", + "IterType", + "LogLevel", + "MissingParentError", + "MitoSection", + "Mitochondria", + "MitochondriaPointLevel", + "MorphioError", + "Morphology", + "MultipleTrees", + "Option", + "PointLevel", + "Points", + "PostSynapticDensity", + "Properties", + "RawDataError", + "Section", + "SectionBuilderError", + "SectionLevel", + "SectionType", + "Soma", + "SomaError", + "SomaType", + "UnknownFileType", + "VasculatureSectionType", + "Warning", + "WarningHandlerCollector", + "WriterError", + "mut", + "ostream_redirect", + "set_ignored_warning", + "set_raise_warnings", + "set_maximum_warnings", + "vasculature", + "version", +] From 2e357ed81a799307600a2d6bb83f37fd457b634d Mon Sep 17 00:00:00 2001 From: Robin De Schepper Date: Thu, 4 Dec 2025 20:53:47 +0100 Subject: [PATCH 2/2] Removed duplication --- morphio/__init__.py | 59 --------------------------------------------- 1 file changed, 59 deletions(-) diff --git a/morphio/__init__.py b/morphio/__init__.py index 3f6a2d04..a7af3bd3 100644 --- a/morphio/__init__.py +++ b/morphio/__init__.py @@ -1,65 +1,6 @@ import platform -if platform.system() == "Windows": - # the plan is to leverage the h5py inclusion of hdf5 dll; this way - # there cannot be a mismatch between version, when using windows, - # and MorphIO doesn't need to build hdf5 - import h5py as _h5py - if (1, 14) != _h5py.version.hdf5_version_tuple[:2]: - raise RuntimeError(f'HDF5 library version mismatch. 1.14.x != {_h5py.version.hdf5_version}') - del _h5py - - -from ._morphio import ( - Annotation, - AnnotationType, - CellFamily, - CellLevel, - Collection, - DendriticSpine, - EndoplasmicReticulum, - GlialCell, - IDSequenceError, - IterType, - LogLevel, - MissingParentError, - MitoSection, - Mitochondria, - MitochondriaPointLevel, - MorphioError, - Morphology, - MultipleTrees, - Option, - PointLevel, - Points, - PostSynapticDensity, - Properties, - RawDataError, - Section, - SectionBuilderError, - SectionLevel, - SectionType, - Soma, - SomaError, - SomaType, - UnknownFileType, - VasculatureSectionType, - Warning, - WarningHandlerCollector, - WriterError, - mut, - ostream_redirect, - set_ignored_warning, - set_raise_warnings, - set_maximum_warnings, - vasculature, - version, -) - -import platform - - if platform.system() == "Windows": # the plan is to leverage the h5py inclusion of hdf5 dll; this way # there cannot be a mismatch between version, when using windows,