You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lock file contains an absolute path when using extras #9128
When a path dependency uses extras with another path dependency, the resulting lock files contains an absolute path even though all the paths in pyproject.toml are relative.
This results in the following getting added to the lock file for proj1:
[package.extras]
example = ["proj3 @ file:///Users/felix/Projects/tmrow/poetry-lock-file-repro/proj3"]
This causes problems for us because the lock file is updated every time a developer runs poetry lock—- no-update even though nothing has changed. I would expect the file path to be relative as well
From reading the issues, it seems like it needs to use the absolute file:/// URL to be compatible with PEP 508. The poetry commands however seem to still work just fine after manually changes the path to a relative one.
Would it be possible for us to create a poetry plugin or similar that converts the path to a relative one?
As noted, this is intentional, and this is not specific at all to extras. If you are not intending to build distributable content (wheels) from this package, I suggest you instead use dependency groups, which do not create metadata.
If you intend to create wheels and install them on another system, then you need to refer to the other package by name, even if you have a locally available copy on disk.
If it's not quite either of those (that is, you want a path dependency during development and a dependency by name at build time), this is a duplicate of #1168.
Thank you @neersighted! I guess that we've only seen this in our lockfiles after we started using extras. We don't intend to distribute wheels. We have a monorepo setup and would just like better control over which dependencies we are including in different projects.
Maybe I'm misunderstanding dependency groups, but is there a way to install optional ones when importing the project in another project. For example:
Ah, you are correct in that there is no mechanism for this; indeed, not creating metadata means that (without Poetry-specific mechanics) there is no way to communicate that dependency information across the monorepo using Poetry alone.
This is instead a duplicate of #2270; please see some solutions there, as well as linked issues with several design proposals for Poetry itself.
Activity
FelixDQ commentedon Mar 7, 2024
I found this PR, so I'm a bit unsure if this is actually a bug as it seems like it was changed to this intentionally: python-poetry/poetry-core#512
I would appreciate any workarounds for not having the lockfile change depending on the users absolute path :-)
eamanu commentedon Mar 9, 2024
Hi!
Please also see #5273 and pypa/pip#9127.
I think that we can add a new option to use relatives paths
FelixDQ commentedon Mar 11, 2024
From reading the issues, it seems like it needs to use the absolute
file:///URL to be compatible with PEP 508. The poetry commands however seem to still work just fine after manually changes the path to a relative one.Would it be possible for us to create a poetry plugin or similar that converts the path to a relative one?
neersighted commentedon Mar 13, 2024
As noted, this is intentional, and this is not specific at all to extras. If you are not intending to build distributable content (wheels) from this package, I suggest you instead use dependency groups, which do not create metadata.
If you intend to create wheels and install them on another system, then you need to refer to the other package by name, even if you have a locally available copy on disk.
If it's not quite either of those (that is, you want a path dependency during development and a dependency by name at build time), this is a duplicate of #1168.
FelixDQ commentedon Mar 13, 2024
Thank you @neersighted! I guess that we've only seen this in our lockfiles after we started using extras. We don't intend to distribute wheels. We have a monorepo setup and would just like better control over which dependencies we are including in different projects.
Maybe I'm misunderstanding dependency groups, but is there a way to install optional ones when importing the project in another project. For example:
proj2:
proj1:
How can I specify in proj1 that it should include the optional group
exampleand thereby installproj3?neersighted commentedon Mar 13, 2024
Ah, you are correct in that there is no mechanism for this; indeed, not creating metadata means that (without Poetry-specific mechanics) there is no way to communicate that dependency information across the monorepo using Poetry alone.
This is instead a duplicate of #2270; please see some solutions there, as well as linked issues with several design proposals for Poetry itself.
FelixDQ commentedon Mar 13, 2024
Thank you! I will take a look at those
github-actions commentedon Apr 13, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.