diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ee9a2c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.pyc +env +*.txt +bashplotlib.egg-info +build +dist + diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..26ccf1c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright (c) 2013 Greg Lamp + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..e340960 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,5 @@ +# file GENERATED by distutils, do NOT edit +setup.py +bashplotlib/__init__.py +bashplotlib/histogram.py +bashplotlib/scatterplot.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d80952 --- /dev/null +++ b/README.md @@ -0,0 +1,74 @@ +# bashplotlib +*plotting in the terminal* + + + +## what is it? +bashplotlib is a python package and command line tool for making basic plots in the terminal. It's a quick way to visualize data when you don't have a GUI. It's written in pure python and can quickly be installed anywhere using pip. + +## installation +### install with pip +``` +$ pip install bashplotlib +``` +### install from source +``` +$ git clone git@github.com:glamp/bashplotlib.git +$ cd bashplotlib +$ python setup.py install +``` + +Either method will install the bashplotlib python package and will also add hist and scatter +to your python scripts folder. This folder should be on your path (add it if it's not). + +## features + +- quick plotting from the command line +- customize the color, size, title, and shape of plots +- pipe data into plots with stdin + + +## usage +### command line +hist takes input from either stdin or specified using the -f parameter. Input should be a single column of numbers. + +scatter takes x and y coordinates as input form either a comma delimited file using -f or from 2 different files using -x and -y. + + +### in python +If you want to use bashplotlib from python, just import histogram and scatterplot. +``` +from bashplotlib.scatterplot import plot_scatter +``` + + +``` +from bashplotlib.histogram import plot_hist +``` + + + +## examples +``` +$ scatter --file data/texas.txt --pch . +``` + + +``` +$ hist --file data/exp.txt +``` + + +``` +$ scatter -x data/x_test.txt -y data/y_test.txt +``` + + +## todo + +- sideways numbers for x-axis of histograms +- colors for individual points +- line charts +- trendlines + + diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..b857efd --- /dev/null +++ b/README.rst @@ -0,0 +1,91 @@ +bashplotlib +=========== + +*plotting in the terminal* + +what is it? +----------- + +bashplotlib is a python package and command line tool for making basic +plots in the terminal. It's a quick way to visualize data when you don't +have a GUI. It's written in pure python and can quickly be installed +anywhere using pip. + +installation +------------ + +install with pip +~~~~~~~~~~~~~~~~ + +:: + + $ pip install bashplotlib + +install from source +~~~~~~~~~~~~~~~~~~~ + +:: + + $ git clone git@github.com:glamp/bashplotlib.git + $ cd bashplotlib + $ python setup.py install + +Either method will install the bashplotlib python package and will also +add hist and scatter to your python scripts folder. This folder should +be on your path (add it if it's not). + +features +-------- + +- quick plotting from the command line +- customize the color, size, title, and shape of plots +- pipe data into plots with stdin + +usage +----- + +command line +~~~~~~~~~~~~ + +hist takes input from either stdin or specified using the -f parameter. +Input should be a single column of numbers. scatter takes x and y +coordinates as input form either a comma delimited file using -f or from +2 different files using -x and -y. + +in python +~~~~~~~~~ + +If you want to use bashplotlib from python, just import histogram and +scatterplot. + +:: + + from bashplotlib.scatterplot import plot_scatter + +:: + + from bashplotlib.histogram import plot_hist + +examples +-------- + +:: + + $ scatter --file data/texas.txt --pch . + +:: + + $ hist --file data/exp.txt + +:: + + $ scatter -x data/x_test.txt -y data/y_test.txt + +todo +---- + +- sideways numbers for x-axis of histograms +- colors for individual points +- line charts +- trendlines + diff --git a/bashplotlib/__init__.py b/bashplotlib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bashplotlib/histogram.py b/bashplotlib/histogram.py new file mode 100644 index 0000000..fe0a5f7 --- /dev/null +++ b/bashplotlib/histogram.py @@ -0,0 +1,261 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Plotting terminal based histograms +""" + +from __future__ import print_function +from __future__ import division + +import os +import sys +import math +import optparse +from os.path import dirname +from .utils.helpers import * +from .utils.commandhelp import hist + + +def calc_bins(n, min_val, max_val, h=None, binwidth=None): + """ + Calculate number of bins for the histogram + """ + if not h: + h = max(10, math.log(n + 1, 2)) + if binwidth == 0: + binwidth = 0.1 + if binwidth is None: + binwidth = (max_val - min_val) / h + for b in drange(min_val, max_val, step=binwidth, include_stop=True): + if b.is_integer(): + yield int(b) + else: + yield b + + +def read_numbers(numbers): + """ + Read the input data in the most optimal way + """ + if isiterable(numbers): + for number in numbers: + yield float(str(number).strip()) + else: + with open(numbers) as fh: + for number in fh: + yield float(number.strip()) + + +def run_demo(): + """ + Run a demonstration + """ + module_dir = dirname(dirname(os.path.realpath(__file__))) + demo_file = os.path.join(module_dir, 'examples/data/exp.txt') + + if not os.path.isfile(demo_file): + sys.stderr.write("demo input file not found!\n") + sys.stderr.write("run the downloaddata.sh script in the example first\n") + sys.exit(1) + + # plotting a histogram + print("plotting a basic histogram") + print("plot_hist('%s')" % demo_file) + print("hist -f %s" % demo_file) + print("cat %s | hist" % demo_file) + plot_hist(demo_file) + print("*" * 80) + + # with colours + print("histogram with colours") + print("plot_hist('%s', colour='blue')" % demo_file) + print("hist -f %s -c blue" % demo_file) + plot_hist(demo_file, colour='blue') + print("*" * 80) + + # changing the shape of the point + print("changing the shape of the bars") + print("plot_hist('%s', pch='.')" % demo_file) + print("hist -f %s -p ." % demo_file) + plot_hist(demo_file, pch='.') + print("*" * 80) + + # changing the size of the plot + print("changing the size of the plot") + print("plot_hist('%s', height=35.0, bincount=40)" % demo_file) + print("hist -f %s -s 35.0 -b 40" % demo_file) + plot_hist(demo_file, height=35.0, bincount=40) + + +def plot_hist(f, height=20.0, bincount=None, binwidth=None, pch="o", colour="default", title="", xlab=None, showSummary=False, regular=False): + """ + Make a histogram + + Arguments: + height -- the height of the histogram in # of lines + bincount -- number of bins in the histogram + binwidth -- width of bins in the histogram + pch -- shape of the bars in the plot + colour -- colour of the bars in the terminal + title -- title at the top of the plot + xlab -- boolen value for whether or not to display x-axis labels + showSummary -- boolean value for whether or not to display a summary + regular -- boolean value for whether or not to start y-labels at 0 + """ + if pch is None: + pch = "o" + + if isinstance(f, str): + with open(f) as fh: + f = fh.readlines() + + min_val, max_val = None, None + n, mean, sd = 0.0, 0.0, 0.0 + + for number in read_numbers(f): + n += 1 + if min_val is None or number < min_val: + min_val = number + if max_val is None or number > max_val: + max_val = number + mean += number + + mean /= n + + for number in read_numbers(f): + sd += (mean - number)**2 + + sd /= (n - 1) + sd **= 0.5 + + bins = list(calc_bins(n, min_val, max_val, bincount, binwidth)) + hist = dict((i, 0) for i in range(len(bins))) + + for number in read_numbers(f): + for i, b in enumerate(bins): + if number <= b: + hist[i] += 1 + break + if number == max_val and max_val > bins[len(bins) - 1]: + hist[len(hist) - 1] += 1 + + min_y, max_y = min(hist.values()), max(hist.values()) + + start = max(min_y, 1) + stop = max_y + 1 + + if regular: + start = 1 + + if height is None: + height = stop - start + if height > 20: + height = 20 + + ys = list(drange(start, stop, float(stop - start) / height)) + ys.reverse() + + nlen = max(len(str(min_y)), len(str(max_y))) + 1 + + if title: + print(box_text(title, max(len(hist) * 2, len(title)), nlen)) + print() + + used_labs = set() + for y in ys: + ylab = str(int(y)) + if ylab in used_labs: + ylab = "" + else: + used_labs.add(ylab) + ylab = " " * (nlen - len(ylab)) + ylab + "|" + + print(ylab, end=' ') + + for i in range(len(hist)): + if int(y) <= hist[i]: + printcolour(pch, True, colour) + else: + printcolour(" ", True, colour) + print('') + xs = hist.keys() + + print(" " * (nlen + 1) + "-" * len(xs)) + + if xlab: + labels = abbreviate([str(b) for b in bins]) + xlen = len(labels[0]) + for i in range(0, xlen): + printcolour(" " * (nlen + 1), True, colour) + for x in range(0, len(hist)): + num = labels[x] + if x % 2 != 0: + pass + elif i < len(num): + print(num[i], end=' ') + else: + print(" ", end=' ') + print('') + + center = max(map(len, map(str, [n, min_val, mean, max_val]))) + center += 15 + + if showSummary: + print() + print("-" * (2 + center)) + print("|" + "Summary".center(center) + "|") + print("-" * (2 + center)) + summary = "|" + ("observations: %d" % n).center(center) + "|\n" + summary += "|" + ("min value: %f" % min_val).center(center) + "|\n" + summary += "|" + ("mean : %f" % mean).center(center) + "|\n" + summary += "|" + ("std dev : %f" % sd).center(center) + "|\n" + summary += "|" + ("max value: %f" % max_val).center(center) + "|\n" + summary += "-" * (2 + center) + print(summary) + + +def main(): + + parser = optparse.OptionParser(usage=hist['usage']) + + parser.add_option( + '-f', '--file', help='a file containing a column of numbers', default=None, dest='f') + parser.add_option('-t', '--title', help='title for the chart', default="", dest='t') + parser.add_option( + '-b', '--bins', help='number of bins in the histogram', type='int', default=None, dest='b') + parser.add_option('-w', '--binwidth', help='width of bins in the histogram', + type='float', default=None, dest='binwidth') + parser.add_option('-s', '--height', help='height of the histogram (in lines)', + type='int', default=None, dest='h') + parser.add_option('-p', '--pch', help='shape of each bar', default='o', dest='p') + parser.add_option('-x', '--xlab', help='label bins on x-axis', + default=None, action="store_true", dest='x') + parser.add_option('-c', '--colour', help='colour of the plot (%s)' % + colour_help, default='default', dest='colour') + parser.add_option('-d', '--demo', help='run demos', action='store_true', dest='demo') + parser.add_option('-n', '--nosummary', help='hide summary', + action='store_false', dest='showSummary', default=True) + parser.add_option('-r', '--regular', + help='use regular y-scale (0 - maximum y value), instead of truncated y-scale (minimum y-value - maximum y-value)', + default=False, action="store_true", dest='regular') + + opts, args = parser.parse_args() + + if opts.f is None: + if len(args) > 0: + opts.f = args[0] + elif opts.demo is None or opts.demo is False: + opts.f = sys.stdin.readlines() + + if opts.demo: + run_demo() + elif opts.f: + plot_hist(opts.f, opts.h, opts.b, opts.binwidth, opts.p, opts.colour, + opts.t, opts.x, opts.showSummary, opts.regular) + else: + print("nothing to plot!") + + +if __name__ == "__main__": + main() diff --git a/bashplotlib/scatterplot.py b/bashplotlib/scatterplot.py new file mode 100644 index 0000000..69cab9d --- /dev/null +++ b/bashplotlib/scatterplot.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Plotting terminal based scatterplots +""" + +from __future__ import print_function +import csv +import sys +import optparse +from .utils.helpers import * +from .utils.commandhelp import scatter + + +def get_scale(series, is_y=False, steps=20): + min_val = min(series) + max_val = max(series) + scaled_series = [] + for x in drange(min_val, max_val, (max_val - min_val) / steps, + include_stop=True): + if x > 0 and scaled_series and max(scaled_series) < 0: + scaled_series.append(0.0) + scaled_series.append(x) + + if is_y: + scaled_series.reverse() + return scaled_series + + +def _plot_scatter(xs, ys, size, pch, colour, title, cs): + plotted = set() + + if title: + print(box_text(title, 2 * (len(get_scale(xs, False, size)) + 1))) + + print("-" * (2 * (len(get_scale(xs, False, size)) + 2))) + for y in get_scale(ys, True, size): + print("|", end=' ') + for x in get_scale(xs, False, size): + point = " " + for (i, (xp, yp)) in enumerate(zip(xs, ys)): + if xp <= x and yp >= y and (xp, yp) not in plotted: + point = pch + plotted.add((xp, yp)) + if cs: + colour = cs[i] + printcolour(point + " ", True, colour) + print(" |") + print("-" * (2 * (len(get_scale(xs, False, size)) + 2))) + +def plot_scatter(f, xs, ys, size, pch, colour, title): + """ + Form a complex number. + + Arguments: + f -- comma delimited file w/ x,y coordinates + xs -- if f not specified this is a file w/ x coordinates + ys -- if f not specified this is a filew / y coordinates + size -- size of the plot + pch -- shape of the points (any character) + colour -- colour of the points + title -- title of the plot + """ + cs = None + if f: + if isinstance(f, str): + with open(f) as fh: + data = [tuple(line.strip().split(',')) for line in fh] + else: + data = [tuple(line.strip().split(',')) for line in f] + xs = [float(i[0]) for i in data] + ys = [float(i[1]) for i in data] + if len(data[0]) > 2: + cs = [i[2].strip() for i in data] + elif isinstance(xs, list) and isinstance(ys, list): + pass + else: + with open(xs) as fh: + xs = [float(str(row).strip()) for row in fh] + with open(ys) as fh: + ys = [float(str(row).strip()) for row in fh] + + _plot_scatter(xs, ys, size, pch, colour, title, cs) + + + +def main(): + + parser = optparse.OptionParser(usage=scatter['usage']) + + parser.add_option('-f', '--file', help='a csv w/ x and y coordinates', default=None, dest='f') + parser.add_option('-t', '--title', help='title for the chart', default="", dest='t') + parser.add_option('-x', help='x coordinates', default=None, dest='x') + parser.add_option('-y', help='y coordinates', default=None, dest='y') + parser.add_option('-s', '--size', help='y coordinates', default=20, dest='size', type='int') + parser.add_option('-p', '--pch', help='shape of point', default="x", dest='pch') + parser.add_option('-c', '--colour', help='colour of the plot (%s)' % + colour_help, default='default', dest='colour') + + opts, args = parser.parse_args() + + if opts.f is None and (opts.x is None or opts.y is None): + opts.f = sys.stdin.readlines() + + if opts.f or (opts.x and opts.y): + plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t) + else: + print("nothing to plot!") + + +if __name__ == "__main__": + main() diff --git a/bashplotlib/utils/__init__.py b/bashplotlib/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bashplotlib/utils/commandhelp.py b/bashplotlib/utils/commandhelp.py new file mode 100644 index 0000000..411b7ad --- /dev/null +++ b/bashplotlib/utils/commandhelp.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Usage messages for bashplotlib system commands +""" + +hist = { + "usage": """hist is a command for making histograms. it accepts a series of values in one of the following formats: + 1) txt file w/ 1 column of numbers + 2) standard in piped from another command line cat or curl + + for some examples of how to use hist, you can type the command: + hist --demo + or visit https://github.com/glamp/bashplotlib/blob/master/examples/sample.sh + """ +} + +scatter = { + "usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the + following formats: + 1) a txt file or standard in value w/ 2 comma seperated columns of x,y values + 2) 2 txt files. 1 w/ designated x values and another with designated y values. + + scatter -x -y + cat | scatter + """ +} diff --git a/bashplotlib/utils/helpers.py b/bashplotlib/utils/helpers.py new file mode 100644 index 0000000..cf209ee --- /dev/null +++ b/bashplotlib/utils/helpers.py @@ -0,0 +1,86 @@ +#!/usr/bin/evn python +# -*- coding: utf-8 -*- + +""" +Various helpful function for bashplotlib +""" + +import sys + +isiterable = lambda x: hasattr(x, '__iter__') or hasattr(x, '__getitem__') + +bcolours = { + "white": '\033[97m', + "aqua": '\033[96m', + "pink": '\033[95m', + "blue": '\033[94m', + "yellow": '\033[93m', + "green": '\033[92m', + "red": '\033[91m', + "grey": '\033[90m', + "black": '\033[30m', + "default": '\033[39m', + "ENDC": '\033[39m', +} + +colour_help = ', '.join([colour for colour in bcolours if colour != "ENDC"]) + + +def get_colour(colour): + """ + Get the escape code sequence for a colour + """ + return bcolours.get(colour, bcolours['ENDC']) + + +def printcolour(text, sameline=False, colour=get_colour("ENDC")): + """ + Print color text using escape codes + """ + if sameline: + sep = '' + else: + sep = '\n' + sys.stdout.write(get_colour(colour) + text + bcolours["ENDC"] + sep) + + +def drange(start, stop, step=1.0, include_stop=False): + """ + Generate between 2 numbers w/ optional step, optionally include upper bound + """ + if step == 0: + step = 0.01 + r = start + + if include_stop: + while r <= stop: + yield r + r += step + r = round(r, 10) + else: + while r < stop: + yield r + r += step + r = round(r, 10) + + +def abbreviate(labels, rfill=' '): + """ + Abbreviate labels without introducing ambiguities. + """ + max_len = max(len(l) for l in labels) + for i in range(1, max_len): + abbrev = [l[:i].ljust(i, rfill) for l in labels] + if len(abbrev) == len(set(abbrev)): + break + return abbrev + + +def box_text(text, width, offset=0): + """ + Return text inside an ascii textbox + """ + box = " " * offset + "-" * (width+2) + "\n" + box += " " * offset + "|" + text.center(width) + "|" + "\n" + box += " " * offset + "-" * (width+2) + return box diff --git a/bin/texas b/bin/texas new file mode 100755 index 0000000..d62bc78 --- /dev/null +++ b/bin/texas @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +from __future__ import print_function +import os + +_ROOT = os.path.abspath(os.path.dirname(__file__)) + +texas = os.path.join(_ROOT, "../bashplotlib", "data", "texas.txt") +print(open(texas).read().strip()) diff --git a/examples/downloaddata.sh b/examples/downloaddata.sh new file mode 100755 index 0000000..ba2298f --- /dev/null +++ b/examples/downloaddata.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +dir=$(dirname "$0") + +if [ ! -d "${dir}data" ]; then + mkdir "${dir}/data" +fi + +curl -L 'https://dl.dropbox.com/sh/jjeubxlxuqkzkeq/5W6zkUZXww/million.txt?dl=1' > "${dir}/data/million.txt" +curl -L 'https://dl.dropbox.com/s/yuxlaj8okcjta9t/exp.txt?dl=1' > "${dir}/data/exp.txt" +curl -L 'https://dl.dropbox.com/s/cbf5skx34grlwy6/lower48.txt?dl=1' > "${dir}/data/lower48.txt" +curl -L 'https://dl.dropbox.com/s/gsu2y9vqnx5ps5i/texas.txt?dl=1' > "${dir}/data/texas.txt" +curl -L 'https://dl.dropbox.com/s/4zws1nbamorcy9z/x_test.txt?dl=1' > "${dir}/data/x_test.txt" +curl -L 'https://dl.dropbox.com/s/mlt4gfqr6n24kxj/y_test.txt?dl=1' > "${dir}/data/y_test.txt" diff --git a/examples/img/basichist.png b/examples/img/basichist.png new file mode 100644 index 0000000..fa5b3c4 Binary files /dev/null and b/examples/img/basichist.png differ diff --git a/examples/img/histhelp.png b/examples/img/histhelp.png new file mode 100644 index 0000000..1b4b452 Binary files /dev/null and b/examples/img/histhelp.png differ diff --git a/examples/img/histogram.png b/examples/img/histogram.png new file mode 100644 index 0000000..00e7ade Binary files /dev/null and b/examples/img/histogram.png differ diff --git a/examples/img/histogramhelp.png b/examples/img/histogramhelp.png new file mode 100644 index 0000000..0f07ebe Binary files /dev/null and b/examples/img/histogramhelp.png differ diff --git a/examples/img/scatter.png b/examples/img/scatter.png new file mode 100644 index 0000000..7485675 Binary files /dev/null and b/examples/img/scatter.png differ diff --git a/examples/img/scatterhelp.png b/examples/img/scatterhelp.png new file mode 100644 index 0000000..71b29e2 Binary files /dev/null and b/examples/img/scatterhelp.png differ diff --git a/examples/img/scatterplothelp.png b/examples/img/scatterplothelp.png new file mode 100644 index 0000000..f9ba7b4 Binary files /dev/null and b/examples/img/scatterplothelp.png differ diff --git a/examples/img/texas.png b/examples/img/texas.png new file mode 100644 index 0000000..61a38d2 Binary files /dev/null and b/examples/img/texas.png differ diff --git a/examples/img/usa.png b/examples/img/usa.png new file mode 100644 index 0000000..44f5842 Binary files /dev/null and b/examples/img/usa.png differ diff --git a/examples/sample.sh b/examples/sample.sh new file mode 100755 index 0000000..08702e5 --- /dev/null +++ b/examples/sample.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +dir=$(dirname "$0") + +if [ ! -d "${dir}/data" ]; then + echo 'downloading data' + "${dir}/downloaddata.sh" +fi + +echo 'plotting coordinates' +scatter --file "${dir}/data/texas.txt" + +echo 'with x and y coords' +scatter -x "${dir}/data/x_test.txt" -y "${dir}/data/y_test.txt" + +echo 'plotting a histogram' +hist --file "${dir}/data/exp.txt" + +echo 'with colors' +hist --file "${dir}/data/exp.txt" --colour blue + +echo 'changing the shape of the point' +hist --file "${dir}/data/exp.txt" --pch . + +echo 'adding x-labels' +hist --file "${dir}/data/exp.txt" --pch . --xlab + +#echo 'using stdin' +#curl -sL https://dl.dropbox.com/u/49171662/example.txt | hist + +#echo 'getting data from a webpage' +#curl -s 'http://www.baseball-reference.com' | +#grep -o -E '[$][0-9]+' | grep -o -E '[0-9]+' | +#hist -b 20 -t 'Baseball Payrolls' --height 20 --pch '*' diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..c6bbcc5 --- /dev/null +++ b/release.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +pandoc -f markdown -t rst README.md > README.rst +python setup.py install sdist $1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f85f54b --- /dev/null +++ b/setup.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +from setuptools import find_packages, setup + +with open("README.rst") as fh: + long_description = fh.read() + +setup( + name="bashplotlib", + version="0.6.5", + author="Greg Lamp", + author_email="lamp.greg@gmail.com", + url="https://github.com/glamp/bashplotlib", + license="BSD", + packages=find_packages(), + description="plotting in the terminal", + long_description=long_description, + entry_points = { + 'console_scripts': [ + 'hist=bashplotlib.histogram:main', + 'scatter=bashplotlib.scatterplot:main', + ] + }, + keywords=['plotting', 'console', 'shell'], + classifiers=[ + 'Environment :: Console', + 'Intended Audience :: End Users/Desktop', + 'License :: OSI Approved :: BSD License', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + ], +) +