Add specified directories to the PYTHONPATH
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
Poetry is a very useful tool, not just for developing Python packages, but also for managing Python dependencies when developing in general (as a replacement tool for requirements.txt
for example).
In developing environments, a very useful tool is to be able to append permanently to the PYTHONPATH
.
For example, when working with Jupyter (standard in data science projects), the code is being executed from the folder where the Jupyter notebook is, so if it isn’t in the project’s root directory, importing code from your own code will fail. See a detailed example in my SO question.
The feature I am suggesting is equivalent to virtualenvwrapper add2virtualenv so it will be possible to permanently add to the PYTHONPATH
of poetry-managed environments.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
I suspect that’s because of the interpreter used by your notebook kernel. If you set it to your project’s virtualenv, it should work.
You could also try adding jupyter as a dev dependency so that when you run
poetry run jupyter
the default interpreter is your project’s.Otherwise, it will reuse the system-wide install of jupyter and whatever python instance it discovers.
@abn
Seems to work as written in SO, I wanted to write a small version of the real problem but guess that didn’t work well. The real problem, is when you have a Jupyter notebook inside a directory which is not root, lets say
and you’ll open your notebook (even if you launch the Jupyter server with
poetry run jupyter notebook
) when you will try to import fromsrc
it will fail. It happens across my company all the time and that is the problem I want to solve