diff options
author | 2023-08-24 17:18:42 -0700 | |
---|---|---|
committer | 2023-08-24 17:18:42 -0700 | |
commit | fecc462ed64ca1bae1f8de13d277a2ea678b12c2 (patch) | |
tree | b75909f473759949faa6feb4787e892ce15ca432 /Python/pywarpx/__init__.py | |
parent | 201099c6f784a4ea04ef752c73e2ad7e8daf684e (diff) | |
download | WarpX-fecc462ed64ca1bae1f8de13d277a2ea678b12c2.tar.gz WarpX-fecc462ed64ca1bae1f8de13d277a2ea678b12c2.tar.zst WarpX-fecc462ed64ca1bae1f8de13d277a2ea678b12c2.zip |
Fix: WarpX Version (#4218)
* Fix: WarpX Version
Fix the WarpX version info.
* Fix Version: pyWarpX
* Version: More Python __version__
Diffstat (limited to 'Python/pywarpx/__init__.py')
-rw-r--r-- | Python/pywarpx/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/pywarpx/__init__.py b/Python/pywarpx/__init__.py index f0f4177d4..8b57f60fb 100644 --- a/Python/pywarpx/__init__.py +++ b/Python/pywarpx/__init__.py @@ -40,10 +40,16 @@ from .WarpX import warpx from ._libwarpx import libwarpx # This is a circular import and must happen after the import of libwarpx -from . import picmi # isort:skip +from . import picmi # isort:skip + +# intentionally query the value - only set once sim dimension is known +def __getattr__(name): + # https://stackoverflow.com/a/57263518/2719194 + if name == '__version__': + return libwarpx.__version__ + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") # TODO -#__version__ = cxx.__version__ #__doc__ = cxx.__doc__ #__license__ = cxx.__license__ #__author__ = cxx.__author__ |