%profile magic is deprecated but still in the documentation #10693

Closed
jni opened this Issue Jul 7, 2017 · 6 comments

Comments

Projects
None yet
3 participants

jni commented Jul 7, 2017

If I try to display my current profile using %profile, I get a nice deprecation warning:

In [1]: %profile
UsageError: The `%profile` magic has been deprecated since IPython 2.0. and removed in IPython 6.0. Please use the value of `get_ipython().profile` instead to see current profile in use. Perhaps you meant to use `%prun` to profile code?

This is all well and good, except the only reason I tried it is because of the current docs. Should I submit a PR removing that line?

Incidentally, I came across this while trying to execute my profile within ptipython. So any suggestions for doing that are welcome!

Carreau added this to the 5.5 milestone Jul 7, 2017

Owner

Carreau commented Jul 7, 2017

This is all well and good, except the only reason I tried it is because of the current docs. Should I submit a PR removing that line?

Ooops, yes please !

ncidentally, I came across this while trying to execute my profile within ptipython. So any suggestions for doing that are welcome!

I'm unsure I understand this question. You want to find the ~/.ipython/profile_whaever/ipython_config.py file ?

jni commented Jul 8, 2017

@Carreau yes, yes I do, because ptipython doesn't seem to load it automatically.

jni commented Jul 8, 2017

But I would like it to be programmatic, rather than hardcoding the path.

Owner

takluyver commented Jul 10, 2017

Try get_ipython().profile_dir.location - that works in regular IPython, but I'm not sure where it gets set, so it might not be right in ptipython.

jni commented Jul 11, 2017

It is indeed set in ptipython (yay!), but c = get_config() fails when I try to run it. (boo.) A quick Google search didn't help me understand how to run get_config outside of the configuration file loading — or whether it is even remotely advisable.

Owner

takluyver commented Jul 11, 2017

get_config() only makes sense as part of the config file loading - it gets the config object which the rest of the file modifies.

This may be a bit tricky, unfortunately, because our config system is designed to be used with our application framework from traitlets, which I suspect ptipython doesn't use. The config needs to be loaded while the application is starting up, and passed to the IPython objects as they are instantiated.

Unfortunately, I don't have time at the moment to look into the ptipython code to see where it could be integrated.

@Carreau Carreau added a commit to Carreau/ipython that referenced this issue Jul 20, 2017

@Carreau Carreau Document magic profile as deprecated
Closes #10693
206018e

takluyver closed this in #10707 Jul 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment