-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Support git+https / git+git style dependency in 3rdparty Python #3063
Comments
this is essentially a duplicate of pex-tool/pex#93 + a pex release and version bump. |
Also related: #2679 |
@kwlzn @cburroughs I'd like to work on this. We use pants to package Python and this has been an issue for us. Have there been any plans on how this needs to be implemented? |
@copyconstructor that'd be awesome - have heard of at least a few folks wanting this feature recently. afaict, no plans have been discussed. however, the meat of the change would happen against once this lands in a pex release, the scope of this ticket for the I can help you get the change shipped in |
@kwlzn Sorry for the dilatory response - If no one's been working on this as yet, I'd love to hop in next week when I'm on vacation and see what I can come up with. Please let me know if this is something that's up for grabs. Thanks! |
@copyconstructor definitely up for grabs - feel free. |
Just checking if this is in the works? |
@tispratik no, it isn't |
This is resolved as of pants |
Not so fast, still some work to do on the Pants side: pants/src/python/pants/python/python_requirement.py Lines 8 to 33 in acde9be
|
Having support for URL to wheel files in third party dependency would be very helpful. Lack of this support currently, has become a blocker for adoption of pants across the repo in my usecase. A gentle bump from my end to increase its priority. |
Since 2016, users have been asking for a way to install wheels from a URL, e.g. from Git. There are two approaches to VCS-style requirements: 1) Pip's proprietary syntax, e.g. `git+https://github.com/pypa/pip.git#egg=pip`. This is what most people are familiar with. https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support 2) PEP 440's standardized "direct references", e.g. `pip@ git+https://github.com/pypa/pip.git`. Turns out, ever since we upgraded to Pex 2.0, approach #2 has worked to achieve this goal. But few users knew about it (including us), and approach #1 has continued to not work. We use setuptools to parse our requirements before passing to Pex. Why? We need to normalize it to, for example, strip comments from `requirements.txt`; and because we need the parsed information to do things like create a module mapping for dependency inference. However, `pkg_resources.Requirement.parse()` chokes on Pip's VCS style, and only understands PEP 440. Both the Pip VCS and PEP 440 approaches achieve the same end goal. We could use some custom libraries like https://github.com/sarugaku/requirementslib and https://github.com/davidfischer/requirements-parser to allow for Pip's proprietary format, but that adds new complexity to our project. Nevertheless, few users are familiar with PEP 440, so we eagerly detect if they're trying to use the Pip style and have a nice error message for how to instead use PEP 440: ``` ▶ ./pants list 3rdparty/python: --no-print-exception-stacktrace 13:25:59.67 [ERROR] 1 Exception encountered: MappingError: Failed to parse 3rdparty/python/BUILD: Invalid requirement 'git+https://github.com/django/django.git#egg=django' in 3rdparty/python/requirements.txt at line 32: Parse error at "'+https:/'": Expected stringEnd It looks like you're trying to use a pip VCS-style requirement? Instead, use a direct reference (PEP 440). Instead of this style: git+https://github.com/django/django.git#egg=django git+https://github.com/django/django.git@stable/2.1.x#egg=django git+https://github.com/django/django.git@fd209f62f1d83233cc634443cfac5ee4328d98b8#egg=django Use this style, where the first value is the name of the dependency: Django@ git+https://github.com/django/django.git Django@ git+https://github.com/django/django.git@stable/2.1.x Django@ git+https://github.com/django/django.git@fd209f62f1d83233cc634443cfac5ee4328d98b8 ``` Closes #3063. ### Additional benefit: doesn't allow `--editable` With Pip VCS-style requirements, it's common to use `-e` or `--editable`, which changes how the distribution is downloaded so that the user can make edits to it. That is not sensible in Pants, and we are unlikely to ever support this feature. PEP 440 style does not support `-e`, so, when users migrate to PEP 440, they won't have the opportunity to inadvertently use `-e` and for it to not work like they expect. [ci skip-rust] [ci skip-build-wheels]
in requirements.txt
git+https://github.com/daviddrysdale/python-phonenumbers.git@daed536e4c90438f78e70f3a2b2f2f4421f0f15d#egg=python-phonenumbers
OUTPUT:
The text was updated successfully, but these errors were encountered: