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

Is the package name missing when pip-compiling a VCS url requirement? #1165

Open
andreaswachowski opened this issue Jun 18, 2020 · 4 comments
Labels
enhancement Improvements to functionality PR wanted Feature is discussed or bug is confirmed, PR needed vcs Related to VCS requirements

Comments

@andreaswachowski
Copy link

andreaswachowski commented Jun 18, 2020

A requirement of the form package @ git+https://... is converted by pip-compile to git+https://....

Running pip install -e . with such a line inside requirements.txt works with pip 20.0.2, but not with pip 20.1.1 anymore. It does however work after manually prefixing the VCS URL with the package identifier again.

I am only beginning to grasp the complexities of Python package management, and I am not sure whether this is an issue with pip, pip-tools, or anything in between. Having said that, I noticed
that in https://www.python.org/dev/peps/pep-0440/#direct-references, all examples are of the form package name @ VCS URL, so perhaps it has to be included in pip-compile's output?

I'd appreciate any hint on how best to proceed with this. Thanks!

Environment Versions

  1. Mac OS X 10.15.5
  2. Python version: Python 3.7.7
  3. pip version: 20.1.1
  4. pip-tools version: 5.2.1

Steps to replicate

  1. Create the following files. This is already prepared in the repo https://github.com/andreaswachowski/pip-problem/, so you can just clone it.

1.1. requirements.in:

colormath @ git+https://github.com/gtaylor/python-colormath.git@6cb12bf#egg=colormath@https://github.com/gtaylor/python-colormath/tarball/6cb12bf

1.2. setup.py:

import pip
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements
from setuptools import find_packages, setup

install_requires_g = parse_requirements("requirements.txt", session=PipSession())

if tuple(map(int, pip.__version__.split("."))) >= (20, 1):
    install_requires = [str(ir.requirement) for ir in install_requires_g]
else:
    install_requires = [str(ir.req) for ir in install_requires_g]

setup(
    name="pkg",
    install_requires=install_requires,
    version="0.1.0",
    packages=find_packages(),
)

1.3. An empty pkg/__init__.py file.

  1. Execute the following steps:
python3 -m venv venv
source venv/bin/activate
pip install pip==20.1.1
pip install pip-tools==5.2.1
pip-compile requirements.in > requirements.txt
pip install -e .

Expected result

pip install -e . executes without error.

Actual result

pip install -e . returns an error:

    error in pkg setup command: 'install_requires' must be a string or list of
    strings containing valid project/version requirement specifiers; Invalid
    requirement, parse error at "'+https:/'"
    ----------------------------------------

(Edit: Make error description self-reliant, without depending on an external repository.)

@atugushev
Copy link
Member

atugushev commented Jun 19, 2020

Hello @andreaswachowski

Thanks for the detailed issue! Currently pip-tools doesn't support <name> @ <vcs_url> format properly, see #1056 (comment). It would be nice to implement it.

@atugushev atugushev added enhancement Improvements to functionality PR wanted Feature is discussed or bug is confirmed, PR needed vcs Related to VCS requirements labels Jun 19, 2020
@AndydeCleyre
Copy link
Contributor

@andreaswachowski @askurihin @AndreyMZ

Can you please confirm that this is (would be) fixed by #1329 ?

@askurihin
Copy link

I confirm that it is fixed by #1329!

Thank you, I can (soon) remove my setup.py hack to fix this problem.

@AndydeCleyre
Copy link
Contributor

This seems to be working in the latest release for me

Package       Version Editable project location
------------- ------- ---------------------------
click         8.0.3
colormath     3.0.0
networkx      2.6.3
numpy         1.22.2
pep517        0.12.0
pip           22.0.3
pip-tools     6.5.1
pkg           0.1.0   /home/andy/Code/pip-problem
pkg_resources 0.0.0
setuptools    44.1.1
tomli         2.0.1
wheel         0.37.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to functionality PR wanted Feature is discussed or bug is confirmed, PR needed vcs Related to VCS requirements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants