-
Notifications
You must be signed in to change notification settings - Fork 38
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
poetry in org-mode babel #24
Comments
I gave a quick try to your snippet and it works fine for me. The only thing is that I had to restart the babel session (the one you named 'default'). |
I have a very similar question :)
Is this feasible? I have not figured it out yet (specifically the third point) |
I have figured this out, in case some people are interested in the process here is a link to the reddit question for more details.
This is the easy part, I just used basic
With babel functionalities, again, pretty straight forward with the documentation.
The trickiest part: a session must first be spawned in the corresponding virtual env with:
Then following python blocks will execute in this virtual env session:
Now I can dev in org files and use literate programming functionalities while being able to test the code in the foreign virtual environment with the right dependencies before tangling everything in its corresponding |
Nice ! If having to write the entire virtualenv path annoys you, this block :
could be replaced with this simpler one:
It will select the adequate virtualenv automatically. Maybe even simpler, you could use property lines and just add this line at the top of your org file:
This will automatically activate the poetry virtualenv when opening your org file. |
Very interesting, thank you for the tips! I also noticed that I don't need to define a session for the code block activating the virtual env: simply running |
I'm having difficulties getting python blocks to execute with a virtual environment activated. My setup, in doom emacs, seems to be fully functional with poetry.el otherwise, including lsp. The org file is in the same directory with the python code.
When I look at
sys.path
I see this:The text was updated successfully, but these errors were encountered: