Skip to content

poetry should not prepend sys.path with __vendor_site__ #8157

@mhils

Description

@mhils

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.

Metadata

Metadata

Assignees

Labels

area/coreRelated to the poetry-core libraryarea/depsRelated to representing and locking dependencieskind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions