Skip to content

Instantly share code, notes, and snippets.

@prerakmody
Last active August 29, 2020 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prerakmody/dd610a4ddc5d3fe457dfe0ca3171d945 to your computer and use it in GitHub Desktop.
Save prerakmody/dd610a4ddc5d3fe457dfe0ca3171d945 to your computer and use it in GitHub Desktop.
Python Command Line Tool
# Local
.idea
.vscode/
# Media
.mp4
.png
.db
# Python
.pyc
__pycache__
# Others
_models
_data
models
data
# Installation
bin
build
dist
.egg-info
from .demo import demo

Steps

  1. Create a fresh directory
  2. In that fresh directory create the following files
    • setup.py
    • README.md
    • MANIFEST.in
    • .gitignore
    • _init_.py (empty file)
    • my_package/ directory
    • bin/ directory
  3. In the my_package/ directory
    • src/ directory
    • _init_.py
    • demo.py
  4. In the bin/ directory
    • my_package
      • You may need to run dos2unix on this if you code in Windows and run in Unix
import sys
from pathlib import Path
MAIN_DIR = Path(__file__).parent.absolute()
sys.path.append(str(MAIN_DIR))
import src.<> as <>
def demo():
pass
include README.md
#!/usr/bin/env python3
import sys
import argparse
from pathlib import Path
MAIN_DIR = Path(__file__).parent.absolute().parent.absolute()
sys.path.append(str(MAIN_DIR))
def main():
parser = argparse.ArgumentParser(description='Bla Bla Bla')
parser.add_argument('indir', type=str, help='Input dir containing images')
parser.add_argument('model', type=str, help='3D CNN model path')
parser.add_argument('--outdir', type=str, help='Output dir for image results')
parser.add_argument('--conf', type=float, help='Some threshold (default=0.6)', default=0.6)
print ('')
print (' ----------------------------------------------------------------------- ')
args = parser.parse_args()
print ('')
args = vars(args)
indir = args['indir']
model = args['model']
outdir = args['outdir']
conf = args['conf']
import my_package as myp
myp.demo()
if __name__ == "__main__":
main()
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(name='my_package',
version='0.2',
description='Estimation of 3D human pose using inputs from a Microsoft Kinect v2 camera',
long_description=readme(),
# long_description='Uses a 3D CNN which takes as input a 3D Point Cloud and outputs 3D locations and body-part associations for various body-joints',
classifiers=[
'Programming Language :: Python :: 3.6', # https://pypi.org/classifiers/
],
keywords="sample package, test package",
url='https://gist.github.com/prerakmody',
author='Prerak Mody',
author_email='prerakmody@mindyourbusiness.com',
license='',
packages=['my_package', 'my_package.src'], # rom setuptools import find_packages; packages=find_packages()
install_requires=[],
scripts=['bin/my_package'],
include_package_data=True,
zip_safe=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment