Embedding Xonsh #5260
-
What's the advice for embedding xonsh these days? That is, I have a Python project, and I would like to write some of it in Xonsh instead of Python. EDIT: I'm currently doing this:
but I don't know if that's current best practice and will correctly handle things like environment isolation. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Start from the cheatsheet. |
Beta Was this translation helpful? Give feedback.
-
Here is the full and correct embedding, I think: import xonsh.built_ins
import xonsh.execer
import xonsh.imphooks
execer = xonsh.execer.Execer()
xonsh.built_ins.XSH.load(execer=execer)
xonsh.imphooks.install_import_hooks(execer=execer) Given the level of init going on, I'm guessing this doesn't read xonshrc or similar. But that's just conjecture. I might hop on my personal account and submit this as a PR. |
Beta Was this translation helpful? Give feedback.
Here is the full and correct embedding, I think:
Given the level of init going on, I'm guessing this doesn't read xonshrc or similar. But that's just conjecture.
I might hop on my personal account and submit this as a PR.