-
Notifications
You must be signed in to change notification settings - Fork 893
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
Alias IPython extension #1763
Comments
I love this! This would be a great UX improvement. Might I suggest that it's
|
@yetudada that won't work because we don't have a package called So |
@AntonyMilneQB Would Currently we have |
I think As for removing The reason I say it would _probably be good to remove Overall, I think:
|
@AntonyMilneQB I think To your 2nd point, I agree it's not something we should do now, a separate issue to keep this discussion alive is ideal👍🏼 |
Yeah, in this case I don't think it's a problem that the import is triggered whenever we import anything from |
I'm fed up of (mis)typing
%load_ext kedro.extras.extensions.ipython
. Let's make everyone's lives a bit easier and alias it.Previously we had said that
%load_ext kedro.ipython
would be an improvement, but I'm going to make a drastic suggestion and go even further to suggest%load_ext kedro
. If you're doing%load_ext
anyway then you know it's an IPython extension so theipython
part is just unnecessary extra characters.How?
Really just one line of code in
kedro/__init__.py
that says:This should turn the module
kedro
into an IPython extension without affecting any of the existing kedro functionality.Is that it?
No! This is the important part. As per discussion we had as part of #712 we need to make sure that this
import
doesn't have undesired side effects, since the above line of code will run every time anyone imports anything fromkedro
. This means that any imports in theextras -> extensions -> ipython
import chain will also be executed.There are three possible risks here:
import
tries to import something that is not a core dependency of kedro and the user doesn't have (which includes IPython!)import
imports loads of things that exist but makes things very slowimport
has side effects that we don't want to be executed (e.g. importingfrom kedro.framework.project import LOGGING
actually configures logging)All three risks here should be mitigated against because in #1761 I already hid all the non-standard library imports inside functions as a guard. So, unless I missed something, what you need to do is write some tests to ensure that this does not get accidentally broken in the future. Something like these (will need some cunning mocking):
import kedro
does not try to importIPython
import kedro
does not do imports likefrom kedro.framework.project import LOGGING
Obviously manually test all this too, but the important thing here is writing the automated tests so it doesn't break in future if someone moves an import to be unguarded at the top level of the ipython.py file.
Anything else to do?
Yes! Update all mentions in the codebase of
kedro.extras.extensions.ipython
tokedro
. This is probably just docs and thekedro ipython/jupyter
commands and should be easy. The hard thing here is the writing the tests.The text was updated successfully, but these errors were encountered: