important-psychiatrist-39230
10/04/2022, 4:35 PMuvicorn
usage over to a pex/pants friendly world and would like some thoughts. I'm worried that our usage of dramatiq
are going to hit even more sever issues when I get that far.
Previous to trying out pants we evoke uvicorn
via the cli. Evocation looking something like
uvicorn --port 3001 --no-access-log --proxy-headers swizzler:app
I tried for a while to get it so the pex_binary
target would be doing this basic thing for me. However I couldn't find anyway to both execute a cli as my entry point -and- give it options. I've gotten into a decent spot by instantiating unicorn programmatically, but I am concerned that for something like dramatiq
I will need to be able to use the CLI with arguments.
Is there a reasonable way to achieve that (or does anyone know if I can start dramatiq
programmatically?)bitter-ability-32190
10/04/2022, 4:36 PMHowever I couldn't find anyway to both execute a cli as my entry point -and- give it options.Can you elaborate? Is
./pants run path/to/dir:target -- --port 3001 ...
not working?important-psychiatrist-39230
10/04/2022, 4:39 PMuvicorn
and dramatiq
are executables provided by the packages of the same name.bitter-ability-32190
10/04/2022, 4:40 PMimportant-psychiatrist-39230
10/04/2022, 4:40 PMdramatiq swizzler.tasks:redis_broker -p 1 -t 8
enough-analyst-54434
10/04/2022, 4:48 PM./pants run path/to/dir:target -- --port 3001 --no-access-log --proxy-headers swizzler:app
Where path/to/dir/BUILD has:
pex_binary(
name="target",
script="uvicorn",
...
)
What would be nice is to be able to seal in the swizzler:app
argument to the PEX binary such that it always ran your swizzler:app
via uvicorn
without you having to type that. That feature idea is tracked here but it's had no one yet motivated to actually add the feature: https://github.com/pantsbuild/pex/issues/987bitter-ability-32190
10/04/2022, 4:50 PM./pants run <pex_binary> -- script1 --arg1
as well as ./pants run <pex_binary> -- script2 --arg1
enough-analyst-54434
10/04/2022, 4:51 PMPEX_SCRIPT=script_name ...
or PEX_MODULE=entry:point ...
aren't appealing, there is always https://pypi.org/project/conscript/enough-analyst-54434
10/04/2022, 4:52 PMbitter-ability-32190
10/04/2022, 4:52 PMMaintainers
John.SiroisI know that guy!
important-psychiatrist-39230
10/04/2022, 4:57 PMimportant-psychiatrist-39230
10/04/2022, 4:57 PMenough-analyst-54434
10/04/2022, 4:57 PMimportant-psychiatrist-39230
10/04/2022, 4:58 PMenough-analyst-54434
10/04/2022, 4:59 PMenough-analyst-54434
10/04/2022, 4:59 PM