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

Better error for non-existing modules in submodules #288

Open
Carreau opened this issue Sep 21, 2023 · 0 comments
Open

Better error for non-existing modules in submodules #288

Carreau opened this issue Sep 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Carreau
Copy link
Member

Carreau commented Sep 21, 2023

Config files allow to define unlisted submodules for which to gather docs, example from scikit-image:

[global]
submodules = [ "morphology", "color", "data", "draw", "exposure", "io", "graph", "segmentation", "transform", "util", "viewer",]

If a submodule does not exists, there is a generic error that does not point to it being from the configuration (example "viewer" from above)

Traceback (most recent call last):
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/bin/papyri", line 8, in <module>
    sys.exit(app())
             ^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/typer/main.py", line 328, in __call__
    raise e
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/typer/main.py", line 311, in __call__
    return get_command(self)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/typer/core.py", line 778, in main
    return _main(
           ^^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/typer/core.py", line 216, in _main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/miniforge3/envs/papyri/lib/python3.11/site-packages/typer/main.py", line 683, in wrapper
    return callback(**use_params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/dev/papyri/papyri/__init__.py", line 460, in gen
    gen_main(
  File "/Users/bussonniermatthias/dev/papyri/papyri/gen.py", line 550, in gen_main
    g.collect_api_docs(target_module_name, limit_to=limit_to)
  File "/Users/bussonniermatthias/dev/papyri/papyri/gen.py", line 1902, in collect_api_docs
    collector: DFSCollector = self._get_collector()
                              ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bussonniermatthias/dev/papyri/papyri/gen.py", line 1770, in _get_collector
    nx = __import__(name)
         ^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'skimage.viewer'

Maybe we should special case that with a better error message.

@melissawm melissawm added the enhancement New feature or request label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants