Skip to content

Comments

use ipython: InteractiveShell#1

Merged
leycec merged 1 commit intobeartype:mainfrom
bollwyvl:patch-1
Apr 19, 2025
Merged

use ipython: InteractiveShell#1
leycec merged 1 commit intobeartype:mainfrom
bollwyvl:patch-1

Conversation

@bollwyvl
Copy link
Contributor

Thanks for this elegant little package!

This updates the signature of the ipython argument to be the superclass InteractiveShell, which makes things work better inside alternate runtimes than an ipython CLI, such as ipykernel, or the even more exotic pydodide-kernel.

These work today... unless one has already added beartype The Hard Way:

%pip install ipython-beartype
import beartype.claw
beartype.claw.beartype_all()
%load_ext ipython_beartype
%beartype
BeartypeCallHintParamViolation            Traceback (most recent call last)
...

BeartypeCallHintParamViolation: Function ipython_beartype.load_ipython_extension() parameter ipython=<pyodide_kernel.interpreter.Interpreter object at 0x242e728> violates type hint <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>, as <class "pyodide_kernel.interpreter.Interpreter"> <pyodide_kernel.interpreter.Interpreter object at 0x242e728> not instance of <class "IPython.terminal.interactiveshell.TerminalInteractiveShell">.

Also, of note: would love to ship this for conda-forge, but would ideally be able to use one of the following for building from source:

  • a source distribution .tar.gz on PyPI (preferred by most downstreams)
  • a tag here on GitHub

Thanks again 🐻‍❄️ !

@leycec
Copy link
Member

leycec commented Apr 19, 2025

Woohoo! Thanks so much for this awesome PR, wise bearded bear bro. Because you are both wise and bearded, you are indeed right about everything – especially:

This updates the signature of the ipython argument to be the superclass InteractiveShell...

...indeed. Totally makes sense. Not all interactive shells are terminals. Pyodide: you are the case in point.

Let's merge this ASAP. Tests are spuriously failing, which is another issue altogether. Oh, and...

a source distribution .tar.gz on PyPI (preferred by most downstreams)

ohnoes. ipython-beartype isn't even shipping tarballs? What is this profane madness!? Let's open up a separate issue about that. I'll ping you there. 🫱 🔔

@leycec leycec merged commit 4479dbf into beartype:main Apr 19, 2025
0 of 5 checks passed
@bollwyvl
Copy link
Contributor Author

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants