4 ms·
As long as your python program checks for __name__ like this: if __name__ == "__main__": # Your code here Then it should mostly "just work". Use the a
by LeoPanthera 2y ago
As long as your python program checks for __name__ like this:
if __name__ == "__main__":
# Your code here
Then it should mostly "just work". Use the argparse module to parse command line arguments if necessary. Create a setup.py and use pip to install it, if you want.
- fragmede 2y agoif you get lost using argparse, give docopt a try, it's self documenting.
- Doxin 2y agoClick is a nice option too. Slightly less magic than docopt, though docopt is great for quick hacks.
- philomath_mn 2y agoI've been making zero-cost Python CLIs with this for years: https://github.com/google/python-fire https://github.com/google/python-fire