python - Poetry configuration for installing local and remote package versions together - Stack Overflow

admin2025-04-18  3

I want to create a Poetry configuration that installs my local package during development and installs my package from PyPI for other users.

I try to create fake localdev optional dependency that requires the local package and exclude PyPI package. Installing without localdev extra is correct. Installing with localdev extra excludes PyPI package but does not install the local package.

[project]
...
dynamic = ['dependencies']
dependencies = [
    "my-package (>=0.0.1); extra != 'localdev'"
]

[project.optional-dependencies]
localdev = []

[tool.poetry.dependencies]
my-package = [
    { markers = "extra == 'localdev'", path = "../my-package", develop = true },
]
转载请注明原文地址:http://www.anycun.com/QandA/1744930496a89644.html