pip-tools
pip-tools copied to clipboard
Is the package name missing when pip-compiling a VCS url requirement?
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
- Mac OS X 10.15.5
- Python version: Python 3.7.7
- pip version: 20.1.1
- pip-tools version: 5.2.1
Steps to replicate
- 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.
- 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.)
Hello @andreaswachowski
Thanks for the detailed issue! Currently pip-tools doesn't support <name> @ <vcs_url> format properly, see https://github.com/jazzband/pip-tools/issues/1056#issuecomment-595192164. It would be nice to implement it.
@andreaswachowski @askurihin @andreymz
Can you please confirm that this is (would be) fixed by #1329 ?
I confirm that it is fixed by #1329!
Thank you, I can (soon) remove my setup.py hack to fix this problem.
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