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

modern-wolf-36228

09/21/2021, 9:06 PM
uvicorn.run("<module>:<app variable>", reload=True)
f

full-keyboard-92367

09/22/2021, 6:19 AM
Dependency is not resolved when trying this ie if I try
Copy code
from project1.main import app

uvicorn.run(app)
it will resolve dependencies and work But
Copy code
uvicorn.run("project1.main:app")
will fail with "Cannot Import project1.main"
m

modern-wolf-36228

09/22/2021, 6:21 AM
you need to add
project1
to the
dependencies=
on the BUILD file
but it seems using
--loop
on pants is the way to go here
reload in code doesn't work on uvicorn if the first argument is not a string
f

full-keyboard-92367

09/22/2021, 6:27 AM
you need to add
project1
to the
dependencies=
on the BUILD file
ya i tried that right now, uvicorn reload doesn't work even if its set to
True
, I guess, because pants run on a sandbox, what I'm changing locally doesn't affect the sandbox. But uvicorn does detect changes in my file and reloads itself, never gets reflected though.
👍 1
7 Views