__init__.py 884 B

12345678910111213141516171819202122232425262728293031
  1. # Adapted from https://github.com/colmap/colmap/blob/1ec758f2eb028049129b852d4d020d7542c866c9/python/pycolmap/__init__.py
  2. import textwrap
  3. from typing import TYPE_CHECKING
  4. from .utils import import_module_symbols
  5. try:
  6. from . import _core
  7. except ImportError as e:
  8. raise RuntimeError(
  9. textwrap.dedent("""
  10. Cannot import the C++ backend poselib._core.
  11. Make sure that you successfully install the package with
  12. $ python -m pip install .
  13. or build it with
  14. $ python setup.py build_ext --inplace
  15. """)
  16. ) from e
  17. # Type checkers cannot deal with dynamic manipulation of globals.
  18. # Instead, we use the same workaround as PyTorch.
  19. if TYPE_CHECKING:
  20. from ._core import * # noqa F403
  21. __all__ = import_module_symbols(
  22. globals(), _core, exclude=set()
  23. )
  24. __all__.extend(["__version__"])
  25. __version__ = _core.__version__