poetry
poetry copied to clipboard
Multiple dependencies pointing to one git repo creates git lockfile error
- Poetry version: 1.7.0
- Python version: 3.9
-
OS version and name: Whatever is used by docker image
python:3.9-slim
Disclaimer: I do not have enough time to sanitize the real code behind the error I encountered or create a reproducible example.
Issue
When two different dependencies point at different sub-directories and tags for the same git repository an error is produced by poetry install as it tries to use the same cloned repository for both tags simultaneously. The error does not occur when the maximum number of workers for poetry install is set to 1.
FileExistsError
[Errno 17] File exists: b'/poetry-build/.venv/src/<repo-name>/.git/refs/heads/master.lock'
at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/dulwich/file.py:148 in __init__
144│ self._lockfilename = self._filename + b".lock"
145│ else:
146│ self._lockfilename = self._filename + ".lock"
147│ try:
→ 148│ fd = os.open(
149│ self._lockfilename,
150│ os.O_RDWR | os.O_CREAT | os.O_EXCL | getattr(os, "O_BINARY", 0),
151│ mask,
152│ )
In this case there are multiple python packages in a single mono-repo that a service includes as dependencies. Versioning is handled by git tags. For any service that specifies more than one package from the mono-repo as dependencies (using git+ssh) the error occurs.