Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Create a Python command-line tool.

Install Python

yum install python

Install pip

Manage packages from Python Package Index.

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

Install virtualenv

Build virtual Python environment.

pip install virtualenv

Create project dir

mkdir hello
cd hello

Setup and activate virtual env

virtualenv venv
. venv/bin/activate

Install program

pip install --editable .
import click
@click.command()
def cli():
"""Example script."""
click.echo('Hello World!')
from setuptools import setup
setup(
name='hello',
version='0.1',
py_modules=['hello'],
install_requires=[
'click',
],
entry_points='''
[console_scripts]
hello=hello:cli
''',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment