Skip to content

Poetry 1.2.0 doesn't seem to like shortened git commit hashes #6455

@dasm-tmlt

Description

@dasm-tmlt
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Mac OS 12.3

  • Poetry version: 1.2.0

  • Link of a Gist with the contents of your pyproject.toml file: [https://gist.github.com/dasm-tmlt/28b714320c663ae87df3f262a64916d1]

Issue

I'm the first person on my team using poetry 1.2.0, and noticed that one of our existing dependencies stopped working (I've verified that it works fine under 1.1.15). The gist above is a minimal example that demonstrates the problem - trying to run poetry lock returns Failed to clone https://github.com/ryan112358/private-pgm.git at 'e9ea5fc', verify ref exists on remote., but that commit definitely exists. Replacing the shortened version of the commit hash (e9ea5fc) with the full commit hash (e9ea5fcac62e2c5b92ae97f7afe2648c04432564) fixes the problem, so there is a workaround, but this does seem like a regression.

Note that debugging this problem was rather difficult because once the first failure has occurred, poetry doesn't attempt to re-download the dependency. Running poetry lock a second time will yield a different error:

Unable to determine package info for path: /Users/dasm/test/.venv/src/private-pgm

Command ['/var/folders/1g/g0wb8wcn2ys55jkc69z0xs3r0000gn/T/tmp53lmvcsc/.venv/bin/python', '-'] errored with the following return code 1, and output: 
Traceback (most recent call last):
  File "<stdin>", line 13, in <module>
  File "/var/folders/1g/g0wb8wcn2ys55jkc69z0xs3r0000gn/T/tmp53lmvcsc/.venv/lib/python3.7/site-packages/build/__init__.py", line 208, in __init__
    _validate_source_directory(srcdir)
  File "/var/folders/1g/g0wb8wcn2ys55jkc69z0xs3r0000gn/T/tmp53lmvcsc/.venv/lib/python3.7/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 /Users/dasm/test/.venv/src/private-pgm does not appear to be a Python project: no pyproject.toml or setup.py
input was : import build
import build.env
import pep517

source = '/Users/dasm/test/.venv/src/private-pgm'
dest = '/var/folders/1g/g0wb8wcn2ys55jkc69z0xs3r0000gn/T/tmp53lmvcsc/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.

If instead you switch to the full commit hash after a failure with the short hash, poetry lock fails silently (there is error output when running with -vvv) rather than downloading the right dependency. Only if you remove the mostly empty directory (it contains a single .git file) at .venv/src/private-pgm does it start working properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/uxFeatures and improvements related to the user experiencearea/vcsRelated to support for VCS dependencies (Git and Dulwich)status/confirmedIssue is reproduced and confirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions