79831021

Date: 2025-11-26 18:07:40
Score: 0.5
Natty:
Report link

OK. I can answer my own question after some trial.

pex -r requirement.txt -M <my_main_script> -P <folder> -P <folder> ... -e <my_main_script> -o <pex>

given I have a project like

gateway.py
brokers/
    __init__.py
    file1.py
    file2.py

To package the above, do

pex -r requirement.txt -M gateway -P brokers -e gateway -o g.pex

Then run ./g.pex will run the program.

The final thing I need to do is my program need a configuration file, say gateway.yml . But I could not found how to put the yml file (or any resource file) into the pex.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Gerald Me