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

Xonsh support #63

Closed
anki-code opened this issue Mar 10, 2023 · 16 comments
Closed

Xonsh support #63

anki-code opened this issue Mar 10, 2023 · 16 comments

Comments

@anki-code
Copy link

Hi! Thank you for the awesome tool!
Is there a way to use xonsh shell language in the cells?
Thanks!

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@joouha
Copy link
Owner

joouha commented Mar 14, 2023

Hi,

This should "just work" by installing xonsh's Jupyter kernel and selecting the "xonsh" kernel in euporie.

However, it looks like there is currently an unresolved bug in the xonsh kernel which prevents it from working properly in the latest version of xonsh.

@joouha
Copy link
Owner

joouha commented Mar 16, 2023

With xonsh_jupyter fixed as per xonsh/xontrib-jupyter#10, if you change your kernel to xonsh, you can run xonsh in euporie:

image

However, testing this has thrown up a couple of bugs in euporie:

  • The xonsh pygments lexer is not shipped with pygments, which caused an error (fixed here: 4227b4d)
  • The kernel fails to start if the xonsh kernel is selected at startup rather than if it is switched to from a python kernel. I'm not sure what's causing this, I'll have to look into it.

@anki-code
Copy link
Author

Wow! Looks awesome! Thanks! I will share this to the xonsh community.

@anki-code
Copy link
Author

anki-code commented Mar 16, 2023

@joouha feel free to add xonsh or/and xontrib topics to the repository settings.

@joouha
Copy link
Owner

joouha commented Mar 16, 2023

Wow! Looks awesome! Thanks! I will share this to the xonsh community.

Thanks! It won't work out-of-the-box just yet, I still need to fix some bugs and make a new release, but I'll update here when everything works as expected.

@anki-code
Copy link
Author

Ok! I will wait the next release. Thanks!

@anki-code
Copy link
Author

I've added:

Todo:

  • When you push the next release I'll announce the Euporia to the community.

Thank you for your efforts to support xonsh!

@joouha
Copy link
Owner

joouha commented Mar 22, 2023

I've made a new release v2.3.2 which has all the fixes mentioned above.

With the fixes to xontrib-jupyter-shell, xonsh now works really nicely in euporie 🏆

@joouha joouha closed this as completed Mar 22, 2023
@anki-code
Copy link
Author

I've posted news:

  1. to the xonsh channel on gitter:

image

  1. to our new account on mastodon:

image

@anki-code
Copy link
Author

Mentioned Euporie in xonsh 0.14 release.

@joouha if you have time please test xontrib-jupyter. I tried to run it with Euporie and sometimes when I run just ls in the cell I have no result in output.

@joouha
Copy link
Owner

joouha commented May 22, 2023

You'll notice that xonsh commands implemented in Python return output, while there is no output from external commands.

This is because the xonsh kernel isn't capturing the stdout of subprocesses spawned by xonsh properly.

@joouha
Copy link
Owner

joouha commented May 22, 2023

I've had a quick look, and it looks like xonsh transforms subproc-mode input lines into uncaptured subprocess calls, which get sent to stdout and are not captured by the kernel.

If you set the XONSH_CAPTURE_ALWAYS environment variable to True, it will work as expected.

I'll make a PR to set this be default in the xonsh kernel.

@anki-code
Copy link
Author

Thanks! XONSH_CAPTURE_ALWAYS is False by made decision and PR is not needed. We just need to add this to docs around jupyter xontrib.

@joouha
Copy link
Owner

joouha commented May 22, 2023

It looks to me like the current default value of XONSH_CAPTURE_ALWAYS is False - it HAS to be True for xonsh kernel to capture subprocess output properly, so I think the PR is needed.

@anki-code
Copy link
Author

anki-code commented May 23, 2023

Ah, you mean PR into xontrib-jupyter. Yep, agree. Thanks!

@joouha
Copy link
Owner

joouha commented May 23, 2023

Yes, I meant this one:

xonsh/xontrib-jupyter#21

:-)

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

No branches or pull requests

2 participants