forked from AIDASoft/podio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve import structure of podio to feel more pythonic (AIDASoft#484)
* Improve import structure of podio to feel more pythonic * Make sure python bindings are usable without libs * Make import of test_utils more robust * Remove test_utils from imported modules * Make Frame python bindings more robust * Keep test_utils in podio module to make tests work
- Loading branch information
1 parent
28b0644
commit 4003995
Showing
13 changed files
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""Python module for the podio EDM toolkit and its utilities""" | ||
import sys | ||
|
||
from .__version__ import __version__ | ||
|
||
from .podio_config_reader import * # noqa: F403, F401 | ||
|
||
import ROOT # pylint: disable=wrong-import-order | ||
|
||
# Track whether we were able to dynamially load the library that is built by | ||
# podio and enable certain features of the bindings only if they are actually | ||
# available. | ||
_DYNAMIC_LIBS_LOADED = False | ||
|
||
# Check if we can locate the dictionary wthout loading it as this allows us to | ||
# silence any ouptput. If we can find it, we can also safely load it | ||
if ROOT.gSystem.DynamicPathName("libpodioDict.so", True): | ||
ROOT.gSystem.Load("libpodioDict.so") | ||
from ROOT import podio | ||
|
||
_DYNAMIC_LIBS_LOADED = True | ||
|
||
if _DYNAMIC_LIBS_LOADED: | ||
from .frame import Frame | ||
from . import root_io, sio_io, reading | ||
|
||
from . import EventStore | ||
|
||
try: | ||
# For some reason the test_utils only work at (test) runtime if they are | ||
# imported with the rest of podio. Otherwise they produce a weird c++ error. | ||
# This happens even if we import the *exact* same file. | ||
from . import test_utils # noqa: F401 | ||
except ImportError: | ||
pass | ||
|
||
# Make sure that this module is actually usable as podio even though most of | ||
# it is dynamically populated by cppyy | ||
sys.modules["podio"] = podio | ||
|
||
__all__ = [ | ||
"__version__", | ||
"Frame", | ||
"root_io", | ||
"sio_io", | ||
"reading", | ||
"EventStore" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters