Hi I have a question about VCS-style requirements....
# general
j
Hi I have a question about VCS-style requirements. A bit confused on this part of the docs how and where do i specify these requirements? it seems like
python_requirement
expects only a pip-requirement string eg.
setuptools==65.5.0
and doesn't parse something like
'git+<https://github.com/facebookresearch/pytorch3d.git@stable>'
h
Hi! Are you getting an error when using the pip style? We added code in 2.12 I want to say that gets things working with other the PEP-440 style or the pip style
j
Yup with the pip style. I can try the pep-440 style but so far I've tried two things: • adding it as a requirement in the 3rdparty BUILD file:
Copy code
python_requirement(
    name="pytorch3d",
    requirements=["git+<https://github.com/facebookresearch/pytorch3d.git@stable>"],
)
• adding
'git+<https://github.com/facebookresearch/pytorch3d.git@stable>'
straight into the requirements.txt both seem to fail to parse
h
what's the error message? what pants version?
(fyi shouldn't make a difference whether it's in requirements.txt vs directly in a
python_requirement
target in a BUILD file. The
python_requirements()
target generator is solely for boilerplate reduction and creates a
python_requirement
target for each line in your
requirements.txt
)
j
pants version = 2.13.0
Copy code
InvalidFieldException: Invalid requirement 'git+<https://github.com/facebookresearch/pytorch3d.git@stable>' in the 'requirements' field for the target 3rdparty/python:pytorch3d: Parse error at "'+https:/'": Expected stringEnd

ValueError: Invalid requirement 'git+<https://github.com/facebookresearch/pytorch3d.git@stable>' in 3rdparty/python/requirements.txt at line 445: Parse error at "'+https:/'": Expected stringEnd
👀 1
h
hm, that seems like a bug. thanks for the report!
in the meantime, is the PEP 440 style working as a workaround?
👀 1
j
seems that it still errors out with the pep440 style
1
i thought the commit hash did the trick but it seems like branch / tag / commit hash work for certain repos, and some not.. haha works for Django. Doesn't particularly work for the repo I've been trying to pull from source
Copy code
'git+<https://github.com/facebookresearch/pytorch3d.git>'
h
hm, would you mind please opening a GitHub ticket, including the stacktrace of the failures?
j
sure.
d
@jolly-oyster-17014 was this ticketed? if so, could you point me to the github issue?
@hundreds-father-404 So I'm starting to test out pants on my org's monorepo, and I see this issue:
Copy code
22:47:27.72 [WARN] An error occurred when validating `docker/security_scanner_test/requirements.txt`: Invalid requirement 'git+<https://github.com/medicode/snapshottest.git>' in docker/security_scanner_test/requirements.txt at line 4: Parse error at "'+https:/'": Expected string_end.
when I run:
Copy code
/root/bin/pants tailor docker/processing
h
cc @happy-kitchen-89482, I think you added support for this style of requirement a few months ago?
d
I can open a new github issue if that would help!
h
which pants version is this?
An issue with as much reproduction detail as possible would be great
Oh, I see that your requirement doesn't have an
#egg=<project name>
fragment, so no wonder
Does that work outside of Pants?
d
Oh interesting, I didn’t know about the egg fragment. And yeah it works fine using pip install with a requirements file containing that vcs link
I’ll try with an egg fragment tomorrow and report back! Thanks for the help
h
Surprised it works with pip, what project name does it assume?
d
is there an easy command to see what pip thinks it is?
otherwise the requirements.txt just has
Copy code
...
git+<https://github.com/google/python-fire.git@v0.1.3>
kubernetes==12.0.0
...
and in our dockerfile we run
Copy code
pip install --no-cache-dir -r requirements.txt