Structure:
.
├── setup.py
└── src
└── my_topology
├── __init__.py
└── __main__.py
setup.py
provides data for packaging up the files under it into a python package__init__.py
is so thatsrc/my_topology/
is discovered as a python package.__main__.py
is like theif __name__ == "__main__":
thing in python, but in its own file so you can run the parent module (my_topology
instead of a submodule e.g.my_topology.entrypoint
if that if was in amy_topology/entrypoint.py
)
To build these into a pex, you can do
cd "$top_directory"
pex \
--python=python3 \
--entry-point=my_topology \
--output=my_topology.pex \
.
heron submit my_topology.pex -
Trivia:
- a pex is a zip file, so you can inspect the contents to see your packaged files, e.g.
unzil -l my_topology.pex | grep my_topology
- a pex can be executed (thanks to python executing zip files [e.g. "eggs"]) e.g.
./my_topology.pex
(what heron can do internally to get data about the topology)