From c38039700081c2aa66efb89e14ba75869db1600b Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Tue, 1 Mar 2016 16:47:34 +0100 Subject: [PATCH] Add a setup.py file --- .gitignore | 5 +++- Examples.ipynb | 4 ++-- LICENSE | 21 +++++++++++++++++ README.md | 12 +++++++++- replot.py => replot/__init__.py | 3 +++ requirements.txt | 2 ++ setup.py | 41 +++++++++++++++++++++++++++++++++ 7 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 LICENSE rename replot.py => replot/__init__.py (99%) create mode 100644 requirements.txt create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index dcf3a58..83602a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .ipynb_checkpoints/ -__pycache__ +__pycache__/ +build/ +dist/ +replot.egg-info/ diff --git a/Examples.ipynb b/Examples.ipynb index 20a4b5d..fde54c0 100644 --- a/Examples.ipynb +++ b/Examples.ipynb @@ -9534,7 +9534,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 30, "metadata": { "collapsed": false, "scrolled": true @@ -10307,7 +10307,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..de519c7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Phyks(Lucas Verney) + +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. diff --git a/README.md b/README.md index 6e2c7fa..516a15b 100644 --- a/README.md +++ b/README.md @@ -66,4 +66,14 @@ examples. ## License -MIT license. +This Python module is released under MIT license. Feel free to contribute and +reuse. For more details, see `LICENSE.txt` file. + + +## Thanks + +* [Matplotlib](http://matplotlib.org/) for their really good backend (but + not for their terrible API) +* [Seaborn](https://github.com/mwaskom/seaborn) and + [prettyplotlib](http://blog.olgabotvinnik.com/prettyplotlib/) which gave me + the original idea. diff --git a/replot.py b/replot/__init__.py similarity index 99% rename from replot.py rename to replot/__init__.py index ab67784..aa75070 100644 --- a/replot.py +++ b/replot/__init__.py @@ -8,6 +8,9 @@ import numpy as np import seaborn.apionly as sns +__VERSION__ = "0.0.1" + + # TODO: Remove it, this is interfering with matplotlib plt.rcParams['figure.figsize'] = (10.0, 8.0) # Larger figures by default plt.rcParams['text.usetex'] = True # Use LaTeX rendering diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f17c374 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +matplotlib>=1.5.1 +seaborn>=0.7.0 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..15e65f9 --- /dev/null +++ b/setup.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +try: + from setuptools import setup +except ImportError: + print('[replot] setuptools not found.') + raise + +with open('replot/__init__.py') as fh: + for line in fh: + line = line.strip() + if line.startswith('__VERSION__'): + version = line.split()[-1][1:-1] + break + +try: + from pip.req import parse_requirements + from pip.download import PipSession +except ImportError: + print('[replot] pip not found.') + raise + +# parse_requirements() returns generator of pip.req.InstallRequirement objects +parsed_requirements = parse_requirements("requirements.txt", + session=PipSession()) + +# reqs is a list of requirement +# e.g. ['django==1.5.1', 'mezzanine==1.4.6'] +install_requires = [str(ir.req) for ir in parsed_requirements] + +setup( + name='replot', + version=version, + url='https://github.com/Phyks/replot/', + author='Phyks (Lucas Verney)', + author_email='phyks@phyks.me', + license='MIT License', + description='A (sane) Python plotting module, abstracting on top of Matplotlib.', + packages=['replot'], + install_requires=install_requires +)