python-poetry / python-poetry/poetry
poetry should not prepend `sys.path` with `__vendor_site__`
@Secrus is already working on this.
Since Apr 22, 2024.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
Problem Description
poetry-core currently prepends its _vendor directory (__vendor_site__) to sys.path here. This causes poetry plugins to pick up whatever dependency version poetry has vendored, which may not be compatible with what the plugin requires / states in its dependencies.
For example, here's what we get after trying to update our poetry plugin to pydantic 2.0, which imports TypeAliasType from typing_extensions. Poetry's 1.6.1 vendored copy does not include TypeAliasType, so every poetry command crashes immediately:
$ poetry help
cannot import name 'TypeAliasType' from 'typing_extensions' (/home/user/venv/lib/python3.11/site-packages/poetry/core/_vendor/typing_extensions.py)
This could be fixed by vendoring similar to how pip does it, i.e. without modifying sys.path but by explictly importing from poetry.core._vendor.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.