-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lock file contains an absolute path when using extras #9128
Comments
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 :-) |
Hi! Please also see #5273 and pypa/pip#9127. I think that we can add a new option to use relatives paths |
From reading the issues, it seems like it needs to use the absolute 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: proj2: [tool.poetry.dependencies]
python = "^3.8"
[tool.poetry.group.example]
optional = true
[tool.poetry.group.example.dependencies]
proj3 = {path = "../proj3"} proj1: [tool.poetry.dependencies]
python = "^3.8"
proj2 = {path = "../proj2"} How can I specify in proj1 that it should include the optional group |
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. |
Thank you! I will take a look at those |
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. |
Description
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.I created a simple reproduction example here https://github.com/FelixDQ/poetry-lock-file-repro which contains 3 projects.
proj2 pyproject.toml:
proj1 pyprojct.toml:
This results in the following getting added to the lock file for proj1:
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 wellWorkarounds
Not as far as i know.
Poetry Installation Method
pipx
Operating System
MacOs
Poetry Version
1.8.0
Poetry Configuration
Python Sysconfig
No response
Example pyproject.toml
No response
Poetry Runtime Logs
.
The text was updated successfully, but these errors were encountered: