Skip to content
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

VCS subdirectory information is lost in lockfiles #7366

Closed
4 tasks done
juneoh opened this issue Jan 18, 2023 · 1 comment · Fixed by #7367
Closed
4 tasks done

VCS subdirectory information is lost in lockfiles #7366

juneoh opened this issue Jan 18, 2023 · 1 comment · Fixed by #7367
Labels
area/solver Related to the dependency resolver kind/bug Something isn't working as expected

Comments

@juneoh
Copy link
Contributor

juneoh commented Jan 18, 2023

  • 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.

@juneoh juneoh added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 18, 2023
@radoering radoering added area/solver Related to the dependency resolver and removed status/triage This issue needs to be triaged labels Jan 20, 2023
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/solver Related to the dependency resolver kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants