-
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 Kedro IPython extension to kedro.ipython #1837
Conversation
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
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.
Thanks! I think %load_ext kedro.ipython
is a better solution.
After hustling with the original proposal %load_ext kedro
, I think we should be very careful about any top-level import alias i.e. import kedro
. I am now more cautious about the idea in #712, due to the way that Python Import system works, it's very dangerous to put things in the top-level. It now make more sense to me why Django do django.shortcuts
instead of just django
.
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.
Great work and thanks for explaining so clearly why just kedro
as alias isn't such a good solution after all @noklam @AntonyMilneQB 👍
Should we keep one test to check %load_ext kedro.extras.extensions.ipython
still works until it's deprecated?
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
@MerelTheisenQB good thinking, done in 645ce1f! Actually I've just found out that most of the tests in this file haven't really doing anything useful for a long time. The mocking is all wrong and so not testing much... I'm going to make a new ticket to fix this up properly. |
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Nok <[email protected]>
This reverts commit 72c7e0b.
I found
|
Signed-off-by: Nok <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
…eat/alias-kedro-ipython Signed-off-by: Antony Milne <[email protected]> Signed-off-by: Antony Milne <[email protected]>
Signed-off-by: Antony Milne <[email protected]>
@@ -62,21 +63,13 @@ def my_register_pipeline(): | |||
return_value=my_register_pipeline, | |||
) | |||
mocker.patch("kedro.framework.startup.configure_project") |
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.
mocker.patch("kedro.framework.startup.configure_project") | |
mocker.patch("kedro.ipython.configure_project") |
This is the wrong patch that causing most of the confusion. @AntonyMilneQB
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.
Ahh, if I change this then can I remove the no pragma
and the tests pass?
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.
Let's address this altogether at #1839
Signed-off-by: nickolasrm <[email protected]>
Description
Closes #1763.
With many apologies to @noklam for the original work done in #1794 trying to alias
kedro.extras.extensions.ipython
to justkedro
, it turns out to be much better to alias askedro.ipython
as we originally thought. The pattern%load_ext name.ipython
seems to be about as common as%load_ext name
. Its only disadvantage is a few extra characters. The main advantage is that it feels cleaner, there's no breaking import linter contracts, and there's no danger that importing kedro could possibly import IPython or have other undesired side-effects like setting up logging.Note to reviewers
I recommend reviewing this commit by commit since I moved a lot of code from one file to another. This will make it clear when it's just code that's moved or where I've actually changed something. The only real change to code itself is in 637053e, where the definition of the line magic and imports and moved to top level.
Development notes
Tested:
kedro.extras.extensions.ipython
Note that doing the imports this way round (
kedro.extras.extensions.ipython
importskedro.ipython
and not vice versa) is much neater because it will allow us to remove the file fromdevelop
straight away. This way, as we modify the IPython extension going forward, the file we'll be modifying is the new correct one rather than the old deprecated one.Checklist
RELEASE.md
file