Different git links when installing from tar.gz vs whl

Open
#5,024 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start with the pyproject.toml dependency definition and the metadata produced by poetry build for the tar.gz and whl artifacts. Compare how the git dependency's subdirectory and branch information are serialized, then reproduce installation from both artifacts with pip. Done means the wheel no longer adds @master to the subdirectory URL and installs the dependency successfully.

Written by the indexing model from the issue text.

Description

area/build-system status/triage
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Issue

This builds off of #4380. I wanted to add a dependency that was a git link rooted in a subfolder. To do this, as discussed in #4567, I used poetry-core from master since I needed python-poetry/poetry-core#192.

Relevant lines in pyproject.toml:

[build-system]
requires = ["poetry-core @ git+https://github.com/python-poetry/poetry-core.git"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = ">=3.7.1,<4.0"
pycocotools = {git = "https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"}

This works for installing the package from source and from tar.gz file but not from whl and the only difference seems to be a branch tag added at the end of the git link while installing from whl. I've attached the relevant lines below

The tar.gz and whl files were created via poetry build

  • From tar.gz
Collecting pycocotools@ git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI
  Cloning https://github.com/ashnair1/cocoapi.git to /tmp/pip-install-ylghq7w3/pycocotools_04a986d205554860a5a783224ef1f8d8
  Running command git clone --filter=blob:none -q https://github.com/ashnair1/cocoapi.git /tmp/pip-install-ylghq7w3/pycocotools_04a986d205554860a5a783224ef1f8d8
  Resolved https://github.com/ashnair1/cocoapi.git to commit 2ab05524360647addb03d0d347288cda2b41b392
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
  • From whl
Collecting pycocotools@ git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI@master
  Cloning https://github.com/ashnair1/cocoapi.git to /tmp/pip-install-z7v4apwo/pycocotools_16adbb699d6243728216a980f2c8a477
  Running command git clone --filter=blob:none -q https://github.com/ashnair1/cocoapi.git /tmp/pip-install-z7v4apwo/pycocotools_16adbb699d6243728216a980f2c8a477
  Resolved https://github.com/ashnair1/cocoapi.git to commit 2ab05524360647addb03d0d347288cda2b41b392
ERROR: pycocotools@ git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI@master from git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI@master (from coco-assistant==0.4.0) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

As you can see while installing from tar.gz there is no branch tag (@master)

Collecting pycocotools@ git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI

whereas while installing from whl there is

Collecting pycocotools@ git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI@master

So my question is whether it is possible to not have the @master tag while installing from whl? (assuming this is the cause of the error)

Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-poetry/poetry

All issues in python-poetry/poetry

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.