Skip to content

poetry add git+https:// will fail with CalledProcessError if package name includes illegal file name characters #3392

@tanj

Description

@tanj
  • 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).
  • Microsoft Windows 10 Pro: Version 10.0.18363 Build 18363:
  • Poetry version: 1.1.4:
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

I was starting a new project and adding some dependencies and came across a bug in the git clone process.

 % poetry add git+https://github.com/tanj/swissarmy.git

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 2 installs, 0 updates, 0 removals

  • Installing python-dateutil (2.8.1)
  • Installing swiss army: untility package (0.1 7e67114)

  CalledProcessError

  Command '['git', 'clone', '--recurse-submodules', 'https://github.com/tanj/swissarmy.git', 'C:\\Users\\REDACTED\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\gkeep-organizer-mzsur4FB-py3.8\\src\\swiss army: untility package']' returned non-zero exit status 128.

  at ~\.poetry\lib\poetry\utils\_compat.py:217 in run
      213│                 process.wait()
      214│                 raise
      215│             retcode = process.poll()
      216│             if check and retcode:
    → 217│                 raise CalledProcessError(
      218│                     retcode, process.args, output=stdout, stderr=stderr
      219│                 )
      220│         finally:
      221│             # None because our context manager __exit__ does not use them.


Failed to add packages, reverting the pyproject.toml file to its original content.

The issue is that my swissarmy package has a : in the package name and that is an illegal character for a windows file path.

The offending code is located at

src_dir = self._env.path / "src" / package.name

I realize that naming my package like that probably is breaking some PEP, but python itself has no issue installing and using the package...

pip freeze output for that package
-e git+https://github.com/tanj/swissarmy.git@7e671142565cb2b2aa04292ec0775c024bf47547#egg=Swiss_Army_Untility_Package

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions