-
Notifications
You must be signed in to change notification settings - Fork 165
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
Fix imports on the management/__init__.py file #235
Conversation
… import Hooks' is possible
It looks like the use of the Anyway, yesterday I added a new entity to the client, and I noticed if not directly importing that file (as in your second snippet), you could use the |
Hi @lbalmaceda , I appreciate the feedback and merge.
If you look at the highest rated answer below the "Accepted" answer on that SO question (handy link here) you'll see an important caveat that Python 3.3+ supports implicit module imports ONLY if the That said I'm also a bit unclear on the exact implications of that. I used docker to build/install the library and test imports in a shell and ran four scenarios using Python 3.8.3:
Of all of these, scenario 1 was the only one in which I was able to successfully import the Theoretically, per those SO answers it seems one should be able to allow the module to be implicitly imported, but in my limited testing I can't seem to find the correct set of circumstances to make that happen. I hope that helps, let me know if there's any other context I can offer or questions I can answer |
Thanks for trying that and sharing your scenarios. I guess we will have to keep adding those in the file then. I'll add an internal note so the next person that maintains the SDK remembers to add that import line in the file. |
Changes
Very simple PR, more of a client developer quality-of-life change than anything, feel free to disregard if not important or wanted.
Currently, importing
Hooks
from themanagement
module like so is not possible:This is because in management's
__init__.py
,Hooks
is not imported. It is still possible to importHooks
with the following code:But when so much else is available at the
management
module level its kind of a pain.Testing
This is a minute change without any implications on functionality, as mentioned above just a quality of life change. Automated testing seems inappropriate, and building the package and verifying that
from auth0.v3.management import Hooks
is a valid line of code should be sufficient (if even that's necessary, since it follows the pattern of many other modules withinmanagement
.Checklist