Hi all - I'm attempting to build a `pex` that will...
# general
a
Hi all - I'm attempting to build a
pex
that will run a python cli tool (
dagster
) against my module. Specifically
dagster api grpc --module-name "my.module"
, where
my.module
is part of my repository.
Copy code
python_sources(
  name="mymod",
)
 
pex_binary(
  name="mymod_usercode",
  entry_point = './main.py:main',
)
I have an entrypoint function in
main.py
Copy code
import ...

def main():
    subprocess.run(
        args = [
            "dagster",
            "api",
            "grpc",
            "-h",
            "0.0.0.0",
            "-p",
            "4000",
            "--module-name",
            "my.module.main",
        ]
    )
I can build a pex that can resolve all of the third-party dependencies, but none of the first party dependencies can be resolved:
No module named 'my' while importing module 'my.module.main'
. Dropping into an interpreter with
PEX_INTERPRETER=1
lets me import the module just fine. Any advice on how I can do this (or if I even should be trying to do this)? Many thanks in advance!
l
But haven't looked in more detail
a
Thanks for this! I'd tried it briefly, but dug back in and it seems to be working.