-
-
Save jthorniley/fba81c62a9d45c723777c7205ff96481 to your computer and use it in GitHub Desktop.
USER vscode | |
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - --version=0.12.17 | |
ENV PATH "/home/vscode/.poetry/bin:$PATH" |
@bearrito
What I do is I set the config to create the virtualenv in the project directory, which also makes it no longer ephemeral with the container.
You can accomplish this using RUN /home/vscode/.local/bin/poetry config virtualenvs.in-project true
. I just find it easier for my workflow to have the environment in project tree.
poetry update
is then called in the terminal on vscode. As for dealing with the interpreter and whatnot, because the virtualenv is inside the project, there is a clear path for it in /workspace/vscode/[project]/.venv/bin/[util]
which you can set in your .vscode/settings.json
or in .devcontainer/devcontainer.json
.
I've seen people set virtualenvs.create false
and then use RUN /home/vscode/.local/bin/poetry install
in the Dockerfile
too. I would imagine that would get rid of the need to separately set the location of your paths. If you want to avoid having to specify all of the path for each time you run poetry
in your Dockerfile
, I believe you should be able to accomplish that via multi-stage builds, but I am a creature of habit and never tried it.
You can set "postCreateCommand": "poetry update"
in .devcontainer/devcontainer.json
.
You could also set the variable in the local poetry config file poetry.toml
:
[virtualenvs]
in-project = true
Or using the CLI:
poetry config virtualenvs.in-project true --local
This is an old post, but how do you have your poetry workflow inside the app?
Where do you call
poetry update
? How are you handling the interpreter/pylint/pylance path issues?