Skip to content
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

Customizable hook for pinfo (?) akin to _ipython_display_ #13217

Closed
b3m2a1 opened this issue Oct 11, 2022 · 4 comments
Closed

Customizable hook for pinfo (?) akin to _ipython_display_ #13217

b3m2a1 opened this issue Oct 11, 2022 · 4 comments

Comments

@b3m2a1
Copy link

b3m2a1 commented Oct 11, 2022

Problem

I often want ? to provide me with much richer information that it does. I'd like the ability to hook nice widgets/interactive information modules info the ? interface. For now, I can display them with _ipython_display_ but I'd like if there were a similar hook I could use to do things like

?SomeExampleClass(...)

<displays a little object explorer>

or

?SomeExampleClass

<displays interactive examples>

Proposed Solution

Add a magic method like __pinfo_display__ that can be used to generate informative displays through the pinfo method

Additional context

Here's an example of what I imagine this looking like (the app is just a random sample app; the real deal would be much more help oriented)

Screen Shot 2022-10-11 at 3 01 26 AM

I can make that app no issue and make it nicely interactive but I can't figure out how to hook it into the help system

@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label Oct 11, 2022
@JasonWeill
Copy link
Contributor

Triage notes:

@Carreau is building papyri-lab (see also papyri) that may add similar functionality.

Modifying the ? behavior should probably go first into an ipykernel issue; JupyterLab would then display the output of ipykernel interactively, as you describe.

Can you please take a look at the links above? If your idea is different and you would like to keep the proposal open, please also open an issue against ipykernel and link it here.

@b3m2a1
Copy link
Author

b3m2a1 commented Oct 14, 2022

Opened ipython/ipykernel#1005

@b3m2a1
Copy link
Author

b3m2a1 commented Oct 14, 2022

See my further comments there for a way to monkey patch this in while I wait for it to be integrated into the system

As an example:

Screen.Recording.2022-10-15.at.3.14.24.AM.mov

@JasonWeill JasonWeill removed status:Needs Info status:Needs Triage Applied to new issues that need triage labels Oct 20, 2022
@krassowski
Copy link
Member

Closing as this cannot be solved by JupyterLab - this is an IPython enhancement request.

FYI recent versions of IPython introduced as MIME hook for customising the pinfo output, for reference see

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

No branches or pull requests

3 participants