Skip to content

Expose submodules from top-level orbit namespace - #158

Open
austin-hoover wants to merge 9 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:imports
Open

austin-hoover wants to merge 9 commits into
PyORBIT-Collaboration:mainfrom
austin-hoover:imports

Conversation

@austin-hoover

@austin-hoover austin-hoover commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Old:

from orbit.teapot import TEAPOT_Lattice
lattice = TEAPOT_Lattice()

New:

import orbit
lattice = orbit.teapot.TEAPOT_Lattice()

@austin-hoover

Copy link
Copy Markdown
Contributor Author

Current errors:

==================================== ERRORS ====================================
________ ERROR collecting tests/py/orbit/bunch_utils/test_serialize.py _________
ImportError while importing test module '/Users/runner/work/PyORBIT3/PyORBIT3/tests/py/orbit/bunch_utils/test_serialize.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15/lib/python3.15/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/py/orbit/bunch_utils/test_serialize.py:1: in <module>
    from orbit.core.bunch import Bunch
.po3/lib/python3.15/site-packages/orbit/__init__.py:27: in <module>
    from . import matching
.po3/lib/python3.15/site-packages/orbit/matching/__init__.py:10: in <module>
    from .matching import Optics, EnvelopeSolver
.po3/lib/python3.15/site-packages/orbit/matching/matching.py:4: in <module>
    from scipy import constants, optimize
E   ModuleNotFoundError: No module named 'scipy'. Did you mean: 'copy'?
________________ ERROR collecting tests/py/orbit/test_import.py ________________
ImportError while importing test module '/Users/runner/work/PyORBIT3/PyORBIT3/tests/py/orbit/test_import.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15/lib/python3.15/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/py/orbit/test_import.py:1: in <module>
    import orbit
.po3/lib/python3.15/site-packages/orbit/__init__.py:27: in <module>
    from . import matching
.po3/lib/python3.15/site-packages/orbit/matching/__init__.py:10: in <module>
    from .matching import Optics, EnvelopeSolver
.po3/lib/python3.15/site-packages/orbit/matching/matching.py:4: in <module>
    from scipy import constants, optimize
E   ModuleNotFoundError: No module named 'scipy'. Did you mean: 'copy'?
=========================== short test summary info ============================
ERROR tests/py/orbit/bunch_utils/test_serialize.py
ERROR tests/py/orbit/test_import.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 2 errors in 0.47s ===============================
Traceback (most recent call last):
  File "/Users/runner/work/PyORBIT3/PyORBIT3/examples/SNS_Linac/pyorbit3_linac_model/pyorbit3_sns_linac_mebt_hebt2.py", line 37, in <module>
    from orbit.py_linac.linac_parsers import SNS_LinacLatticeFactory
  File "/Users/runner/work/PyORBIT3/PyORBIT3/.po3/lib/python3.15/site-packages/orbit/__init__.py", line 27, in <module>
    from . import matching
  File "/Users/runner/work/PyORBIT3/PyORBIT3/.po3/lib/python3.15/site-packages/orbit/matching/__init__.py", line 10, in <module>
    from .matching import Optics, EnvelopeSolver
  File "/Users/runner/work/PyORBIT3/PyORBIT3/.po3/lib/python3.15/site-packages/orbit/matching/matching.py", line 4, in <module>
    from scipy import constants, optimize
ModuleNotFoundError: No module named 'scipy'. Did you mean: 'copy'?
Error: Process completed with exit code 1.

@austin-hoover

Copy link
Copy Markdown
Contributor Author

@azukov it looks like the GitHub workflows are failing because of orbit.matching module which imports scipy.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant