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

freezing-area-97131

04/14/2022, 9:14 PM
Hi , how do I deal with
Copy code
ERROR: Could not find a version that satisfies the requirement myproject.common==1.0
ERROR: No matching distribution found for myproject.common==1.0
This is a package that only used in my org. How do I add the path of the file? Back in the days there was a
repository
field to specify the path.
Copy code
python_requirement(
    name='myproject.common', 
    dependencies=[':salt', ':pymysql'],
    requirements=[
        'myproject.common==1.0',
    ],)
f

freezing-area-97131

04/14/2022, 9:22 PM
But if it is a tar.gz file in the project directory, how do I specify the path?
h

hundreds-father-404

04/14/2022, 9:23 PM
I think that I'm not following. How did you do this in V1?
f

freezing-area-97131

04/14/2022, 9:29 PM
In v1, it was like this:
Copy code
python_requirement_library(
    name='myproject.common',
    requirements=[
        python_requirement(
           name='myproject.common', 
           requirement='myproject.common==1.0', 
           repository='3rdparty/python'),
    ],
)
h

hundreds-father-404

04/14/2022, 9:31 PM
@witty-crayon-22786 does this ring a bell?
w

witty-crayon-22786

04/14/2022, 9:44 PM
…it doesn’t. let me see.
yea, i don’t see a
repository
argument in v1. did you maybe have custom macros for this?
Screen Shot 2022-04-14 at 14.46.03.png
f

freezing-area-97131

04/14/2022, 9:47 PM
hmmm let me check
w

witty-crayon-22786

04/14/2022, 9:47 PM
as Eric mentioned though, v2 has two different strategies for this: can either set a local repository, or use a local requirement
f

freezing-area-97131

04/14/2022, 9:48 PM
ok then I think I will just use a local requirement
So I have to write something like this:
Copy code
Django @ file:///Users/pantsbuild/prebuilt_wheels/django-3.1.1-py3-none-any.whl
in which file? BUILD or requirement.txt?
h

hundreds-father-404

04/14/2022, 10:12 PM
You can either write that in requirements.txt, or use a python_requirement target in a build file. It does not matter for pants. Using requirements.txt is only a short hand
f

freezing-area-97131

04/14/2022, 11:46 PM
I think I fixed all those issues now! Thx so much~
🙌 1
❤️ 1
e

enough-analyst-54434

04/14/2022, 11:57 PM
FWIW on V1, that screen shot shows off the issue. The repository argument was in the python_requirment object - which has no help. It was not on the python_requirement_library container.
👍 1