-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
- Poetry version: 1.3.2
- Python version: 3.11.1
- OS version and name: Ubuntu 20.04
- pyproject.toml: (described in Issue section)
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.
Issue
First and foremost, thanks for the great tool!
I found an edge case with multiple private package sources hosted on git. When my poetry project (package A) requires another poetry project (package B), and that project in turn has a Git dependency (package C) with a subdirectory, the subdirectory information is lost during writing the lock file, resulting errors like below for subsequent installs or adds:
Unable to determine package info for path: REDACTED
Command ['/tmp/tmpmsqyswsj/.venv/bin/python', '-'] errored with the following return code 1, and output:
Traceback (most recent call last):
File "<stdin>", line 9, in <module>
File "/tmp/tmpmsqyswsj/.venv/lib/python3.11/site-packages/build/__init__.py", line 208, in __init__
_validate_source_directory(srcdir)
File "/tmp/tmpmsqyswsj/.venv/lib/python3.11/site-packages/build/__init__.py", line 109, in _validate_source_directory
raise BuildException(f'Source {srcdir} does not appear to be a Python project: no pyproject.toml or setup.py')
build.BuildException: Source REDACTED does not appear to be a Python project: no pyproject.toml or setup.py
input was : import build
import build.env
import pep517
source = 'REDACTED'
dest = '/tmp/tmpmsqyswsj/dist'
with build.env.IsolatedEnvBuilder() as env:
builder = build.ProjectBuilder(
srcdir=source,
scripts_dir=env.scripts_dir,
python_executable=env.executable,
runner=pep517.quiet_subprocess_runner,
)
env.install(builder.build_system_requires)
env.install(builder.get_requires_for_build('wheel'))
builder.metadata_path(dest)
No fallback setup.py file was found to generate egg_info.
The above error indicates that Poetry is trying to install at the root directory of package C, whereas it is inside a subdirectory instead. poetry.lock
looks like this:
[package.dependencies]
REDACTED = {git = "REDACTED", tag = "REDACTED"}
The subdirectory is gone, whereas package B's pyproject.toml
states:
[tool.poetry.dependencies]
REDACTED = {git = "REDACTED", subdirectory="REDACTED", tag = "REDACTED"}
This is because poetry.packages.locker.Locker._dump_package()
's VCSDependency
case lacks the handling of the subdirectory.