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

wide-midnight-78598

04/04/2023, 8:19 PM
In BUILD files, is there a way to take an explicit dependency on something like "uvicorn[standard]" - or would I need to individually add each dep?
r

refined-addition-53644

04/04/2023, 8:47 PM
It should work as long as you are defining the dependency using
python_requirement(s)
.
w

wide-midnight-78598

04/04/2023, 9:09 PM
Yeah, no dice unfortunately.
Requirements:
Copy code
fastapi
firebase-admin
jinja2
sendgrid
sqlalchemy
uvicorn[standard]
Trying to use
//:reqs#uvicorn[standard]
Copy code
ValueError: The explicit dependency `//:reqs#uvicorn[standard]` of the target at `backend/apigateway:apigateway` does not provide enough address parameters to identify which parametrization of the dependency target should be used.
Target `//:reqs` can be addressed as:
  * //:reqs
  * //:reqs#fastapi
  * //:reqs#firebase-admin
  * //:reqs#jinja2
  * //:reqs#sendgrid
  * //:reqs#sqlalchemy
  * //:reqs#uvicorn
  * //requirements.txt:reqs
p

proud-dentist-22844

04/04/2023, 10:12 PM
Have you tried
//:reqs#uvicorn
? I believe the extra is implicit - if the requirements.txt specifies an extra, then anything that uses that package will depend on that package with the extra.
The
uvicorn[standard]
line in your requirements file is basically like defining:
Copy code
python_requirement(name="uvicorn", requirement="uvicorn[standard]")
w

wide-midnight-78598

04/04/2023, 10:16 PM
So, that's what I had hoped - but I'm getting strange results. I see in stack traces a couple times that I'm using
uvloop
as expected, but other times, it's
asyncio
- really bizarre stuff. I'm putting dollars to doughnuts that I've got some bad caching in this pipeline somewhere