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

Add option to use custom Outstream in kernel app #302

Closed
eendebakpt opened this issue Jun 21, 2021 · 4 comments · Fixed by #305
Closed

Add option to use custom Outstream in kernel app #302

eendebakpt opened this issue Jun 21, 2021 · 4 comments · Fixed by #305
Milestone

Comments

@eendebakpt
Copy link
Contributor

Using a custom Outstream allows us to set the isatty option that was introduced in ipython/ipykernel#683. Setting the isatty to True allows packages like rich and colorama to have colored output in Spyder.

Also see jupyter/qtconsole#486

@ccordoba12

@peendebak
Copy link

@ccordoba12 I looked into the code of spyder-kernels, but could not find where the Outstream is constructed. Could you give a pointer?

@eendebakpt
Copy link
Contributor Author

@ccordoba12 Could it be that the OutStream is created here: https://github.com/ipython/ipykernel/blob/36d6a91639b3ec09502b5454d30751ad81ffab27/ipykernel/inprocess/ipkernel.py#L155 ?

In that case we would require another PR to ipykernel to allow setting the isatty option

@real-yfprojects
Copy link
Contributor

In this message @ccordoba12 pointed to the kernelapp.IPKernelApp class. I think the Outstream instance is created here:

https://github.com/ipython/ipykernel/blob/7ed57cb4a03e719074c373029cf9f2e6dfd2c6de/ipykernel/kernelapp.py#L421

Here the DottedObjectName in outsream_class is imported and then used as sys.stdout.

@eendebakpt
Copy link
Contributor Author

@real-yfprojects @ccordoba12 Thanks for the hint. There are various ways to make sure spyder uses a different Outstream class. I opted for one without any changes to the upstream ipykernel and one with minimal patching of the original SpyderKernelApp. Could you have a look at #305

@ccordoba12 ccordoba12 added this to the v2.1.0 milestone Jul 28, 2021
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 a pull request may close this issue.

4 participants