Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken imports #893

Open
fabcor-maxiv opened this issue Mar 19, 2024 · 3 comments
Open

Broken imports #893

fabcor-maxiv opened this issue Mar 19, 2024 · 3 comments

Comments

@fabcor-maxiv
Copy link
Contributor

Building the documentation with sphinx-build seems to uncover a whole range of broken imports. Some seem to be due to missing dependencies (see: #885), but some other seem to be due to bugs in the code (or abandoned code). Those need to be investigated, and hopefully fixed.

@fabcor-maxiv
Copy link
Contributor Author

I put here an excerpt of the console output for sphinx.build, that contains examples (but it also contains a bunch of other things not related to broken import, we should sort this all out):

/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.BM14EnergyScan.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'BM14EnergyScan'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ModuleNotFoundError: No module named 'ESRFEnergyScan'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.BlissTurret.
Possible hints:
* ModuleNotFoundError: No module named 'bliss'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'BlissTurret'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.BlissVolpi.
Possible hints:
* ModuleNotFoundError: No module named 'bliss'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'BlissVolpi'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ESRFMD2SC3.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ESRFMD2SC3'
* ImportError: cannot import name 'Sample' from 'mxcubecore.HardwareObjects.abstract.AbstractSampleChanger' (/home/fabcor/workspace/mxcube/mxcubecore/mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py)
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ESRFSC3.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ESRFSC3'
* ImportError: cannot import name 'Sample' from 'mxcubecore.HardwareObjects.abstract.AbstractSampleChanger' (/home/fabcor/workspace/mxcube/mxcubecore/mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py)
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ESRFXRFSpectrum.
Possible hints:
* ModuleNotFoundError: No module named 'PyMca5'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ESRFXRFSpectrum'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID231BeamCmds.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID231BeamCmds'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.BeamCmds'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID232BeamCmds.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID232BeamCmds'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.BeamCmds'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID232BeamDefiner.
Possible hints:
* ModuleNotFoundError: No module named 'bliss'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID232BeamDefiner'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID232MultiCollect.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ImportError: cannot import name 'PixelDetector' from 'mxcubecore.HardwareObjects.ESRF.ESRFMultiCollect' (/home/fabcor/workspace/mxcube/mxcubecore/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py)
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID232MultiCollect'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID232PhotonFlux.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'TangoKeithleyPhotonFlux'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID232PhotonFlux'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID23PhotonFlux.
Possible hints:
* ModuleNotFoundError: No module named 'calc_flux'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID23PhotonFlux'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID29BeamCmds.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID29BeamCmds'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.BeamCmds'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID29MultiCollect.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID29MultiCollect'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ImportError: cannot import name 'PixelDetector' from 'mxcubecore.HardwareObjects.ESRF.ESRFMultiCollect' (/home/fabcor/workspace/mxcube/mxcubecore/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py)
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID29PhotonFlux.
Possible hints:
* ModuleNotFoundError: No module named 'calc_flux'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID29PhotonFlux'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID29XRFSpectrum.
Possible hints:
* ModuleNotFoundError: No module named 'PyMca5'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID29XRFSpectrum'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID30A1MultiCollect.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID30A1MultiCollect'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ImportError: cannot import name 'FixedEnergy' from 'mxcubecore.HardwareObjects.ESRF.ESRFMultiCollect' (/home/fabcor/workspace/mxcube/mxcubecore/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py)
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID30A3BeamCmds.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.BeamCmds'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID30A3BeamCmds'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID30A3MultiCollect.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID30A3MultiCollect'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ImportError: cannot import name 'FixedEnergy' from 'mxcubecore.HardwareObjects.ESRF.ESRFMultiCollect' (/home/fabcor/workspace/mxcube/mxcubecore/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py)
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID30BBeamCmds.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID30BBeamCmds'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.BeamCmds'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID30BXRFSpectrum.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID30BXRFSpectrum'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ModuleNotFoundError: No module named 'qt'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID30Controller.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID30Controller'
* ModuleNotFoundError: No module named 'bliss'
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError: 
/home/fabcor/workspace/mxcube/mxcubecore/docs/source/dev/autosummary/mxcubecore.HardwareObjects.ESRF.rst:26: WARNING: autosummary: failed to import mxcubecore.HardwareObjects.ESRF.ID30SC3.
Possible hints:
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'ID30SC3'
* ImportError: cannot import name 'Sample' from 'mxcubecore.HardwareObjects.abstract.AbstractSampleChanger' (/home/fabcor/workspace/mxcube/mxcubecore/mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py)
* AttributeError: module 'mxcubecore.HardwareObjects.ESRF' has no attribute 'mxcubecore'
* ModuleNotFoundError: No module named 'mxcubecore.HardwareObjects.ESRF.mxcubecore'
* ImportError:

@marcus-oscarsson
Copy link
Member

marcus-oscarsson commented Mar 19, 2024

What we have said in the past is that each institute handles their dependencies for site specific code. This as versioning and even availability of certain modules outside of the institute might not be easily handled. This creates a problem for a tool like sphinx that needs to import the modules in order to function.

When we used sphinx in the past we said that we would not run it on site specific code (as far as I remember), which I agree is a bit of a pity. I guess the problem could partially be solved by using try/except for those imports but I would personally not like that. Is there no mode in sphinx that can extract the docstrings without import that can be used for site specific code ?

One solution would perhaps, orthwise, be to add a section in the pyproject.toml for each institute with the site specific dependencies, and if there is no section we exclude that site specific code from the documentation.

@fabcor-maxiv
Copy link
Contributor Author

fabcor-maxiv commented Mar 19, 2024

When we used sphinx in the past we said that we would not run it on site specific code

Ah, that's an idea I have not considered. Maybe that is a solution for things that can not be solved in a cleaner way (by fixing the code). But I do not know if Sphinx can be configured easily to ignore some sub packages. Seems like it is an allow-list, rather than a blocklist.

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

No branches or pull requests

2 participants