Embedding Xonsh #5260
Answered
by
jamie-at-arkifi
jamie-at-arkifi
asked this question in
Q&A
-
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.
Answered by
jamie-at-arkifi
Jan 11, 2024
Replies: 2 comments 3 replies
-
Start from the cheatsheet. |
Beta Was this translation helpful? Give feedback.
1 reply
-
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.
2 replies
Answer selected by
anki-code
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.