Skip to content

Accept dotted-paths of the form path.to.module:object1.object2 #66

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

Closed
pawamoy opened this issue Sep 26, 2020 · 1 comment
Closed

Accept dotted-paths of the form path.to.module:object1.object2 #66

pawamoy opened this issue Sep 26, 2020 · 1 comment
Labels
error-handling Improvements to error handling feature New feature or request module:loader

Comments

@pawamoy
Copy link
Member

pawamoy commented Sep 26, 2020

Is your feature request related to a problem? Please describe.
When importing an object with only dots in its path, it is hard to know what is a module and what is an object. It leads to confusing tracebacks: #53, mkdocstrings/mkdocstrings#127

Describe the solution you'd like
To ease the process of importing the object, and to be able to return better error messages, we could support having a colon in the object's path. This colon would delimit the last submodule from the first object. We wouldn't need to try and import the whole path, going up one level each time, to find the deepest submodule. An import error happening in the deepest submodule would be reraised as is, clearly showing what the problem is to the user in mkdocstrings logs.

Describe alternatives you've considered
Additional checks as proposed in this comment.

@pawamoy pawamoy added feature New feature or request module:loader error-handling Improvements to error handling labels Sep 26, 2020
@pawamoy
Copy link
Member Author

pawamoy commented Sep 28, 2020

Implemented in a0b677c, published in version 0.9.0.

@pawamoy pawamoy closed this as completed Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-handling Improvements to error handling feature New feature or request module:loader
Projects
None yet
Development

No branches or pull requests

1 participant