https://pantsbuild.org/ logo
#general
Title
# general
j

jolly-oyster-17014

10/17/2022, 7:55 PM
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

hundreds-father-404

10/17/2022, 7:56 PM
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

jolly-oyster-17014

10/17/2022, 8:01 PM
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

hundreds-father-404

10/17/2022, 8:01 PM
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

jolly-oyster-17014

10/17/2022, 8:33 PM
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

hundreds-father-404

10/17/2022, 8:34 PM
hm, that seems like a bug. thanks for the report!
in the meantime, is the PEP 440 style working as a workaround?
👀 1
j

jolly-oyster-17014

10/17/2022, 9:25 PM
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

hundreds-father-404

10/17/2022, 9:32 PM
hm, would you mind please opening a GitHub ticket, including the stacktrace of the failures?
j

jolly-oyster-17014

10/17/2022, 9:35 PM
sure.
d

dazzling-dress-95246

03/30/2023, 10:55 PM
@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

hundreds-father-404

03/30/2023, 11:10 PM
cc @happy-kitchen-89482, I think you added support for this style of requirement a few months ago?
d

dazzling-dress-95246

03/30/2023, 11:11 PM
I can open a new github issue if that would help!
h

happy-kitchen-89482

03/30/2023, 11:39 PM
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

dazzling-dress-95246

03/31/2023, 3:56 AM
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

happy-kitchen-89482

03/31/2023, 5:14 PM
Surprised it works with pip, what project name does it assume?
d

dazzling-dress-95246

03/31/2023, 7:42 PM
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
5 Views