- Create a
setup.py
:
#!/usr/bin/env python
from distutils.core import setup
setup(
name='My Thing',
version='1.0',
description='Does these things',
scripts=['scripts/thing'],
)
- Create the file
./scripts/thing
and add:
#!/usr/bin/env python
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Thing helper')
parser.add_argument('command', type=str, choices=['install'])
args = parser.parse_args()
if args.command == 'install':
# do something.
# add additional choices and handle here for positional arguments
- Install with
pip editable -e .
- Now call anywhere with
thing install