-
Notifications
You must be signed in to change notification settings - Fork 576
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
Resolve name conflict between function and module. #417
Conversation
This doesn't solve the circular import issue because you still need to import from each of the exporter classes. I don't know if this is really a good long term solution to this problem which seems more architectural in nature. The issue is that right now getting an exporter requires telling it where all the exporters are located, but sometimes the function of getting the exporter requires relying on the same code that tells it where it's located. I vote against merging this though it solves he ambiguity issue. It does so by further obscuring this underlying problem of a circular logical dependency not just a circular namespace dependency. That said I'm having difficulty seeing thinking through how to redesign this at all let alone without breaking API. That said if it requires breaking API it's a good thing that a major version is about to come out. :) |
AFAIU the circular import is also due to us exporting function One solution is to release 5.0 soon, even with this weird API, and to make a 6.0 which is Python 3 only later ? (though, notebook server rely on nbconvert so unsure about that) |
nbconvert.exporters.export could be resolved either as a function or a midule. `ExporterNameError` would also trigger some circular imports, so moved it one level higher. Should Fix jupyter#415 # Conflicts: # nbconvert/exporters/export.py
58cd641
to
e5b68df
Compare
AFAIU so long as we have anything where we need to import a function (such as The solution to that (right now) is something like we currently have where we have to put the import inside the function or class that needs it, and that way it will only be imported after the entire module has been loaded. The question is whether we want to continue doing that or if we want to have Note: what i'm suggesting isn't an alternative to fixing the ambiguous name issue…that's why I included the "or whatever replaces it" because we probably should also rework that. But that requires two new modules rather than one in my solution. |
let's try to do that, using both |
them as an nbconvert.exporter entrypoint. | ||
""" | ||
return sorted(entrypoints.get_group_named('nbconvert.exporters')) | ||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed.
I wasn't entirely sure how to incorporate the underscore naming for privateness when most everything is remaining public API. I'm not totally happy with it (as I mention in the notes), but a first pass at what I was thinking is in #423. |
should i close this then? |
nbconvert.exporters.export could be resolved either as a function or a
midule.
ExporterNameError
would also trigger some circular imports, somoved it one level higher.
Should Fix #415
CC @michaelpacer
We should audit our imports.