From 00a5d1adc73d4d02f175ac487f2cdfaa77aa4a88 Mon Sep 17 00:00:00 2001 From: Will Handley Date: Mon, 5 Nov 2018 07:18:58 +0000 Subject: [PATCH] Added aur and PyPi repositories --- .gitignore | 4 ++++ README.rst | 34 ++++++++++++++++++++++++++++++---- setup.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf32a52 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ + +build/ +dist/ +*.egg-info/ diff --git a/README.rst b/README.rst index 245b51f..aa9b944 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ py2nb: convert python scripts to jupyter notebooks ================================================== :py2nb: convert python scripts to jupyter notebooks :Author: Will Handley -:Version: 0.0.0 +:Version: 0.0.1 :Homepage: https://github.com/williamjameshandley/py2nb .. image:: https://badge.fury.io/py/py2nb.svg @@ -13,9 +13,13 @@ py2nb: convert python scripts to jupyter notebooks Description =========== -``py2nb`` is a python package for converting python scripts with minimal markdown to jupyter notebooks. +``py2nb`` is a python package for converting python scripts with minimal +markdown to jupyter notebooks. -Here is example code, saved as ``example.py``: +Markdown cells are rendered from comments beginning with ``#|``, splits between +code cells are created by comment lines beginning with ``#-`` + +If one has a script named ``example.py`` containing the code: .. code:: python @@ -49,7 +53,7 @@ Here is example code, saved as ``example.py``: fig, ax = plt.subplots() ax.plot(x,y) -Converting via the script +then running .. code :: bash @@ -58,6 +62,28 @@ Converting via the script produces the notebook `example.ipynb `_ +Installation +=============== + +Users can install using pip: + +.. code:: bash + + pip install py2nb + +from source: + +.. code:: bash + + git clone https://github.com/williamjameshandley/py2nb + cd py2nb + python setup.py install + +or for those on `Arch linux `__ it is +available on the +`AUR `__ + + To do ===== diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..adb2b59 --- /dev/null +++ b/setup.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +from setuptools import setup, Command, find_packages + + +def readme(): + with open('README.rst') as f: + return f.read() + + +def get_version(short=False): + with open('README.rst') as f: + for line in f: + if ':Version:' in line: + ver = line.split(':')[2].strip() + if short: + subver = ver.split('.') + return '%s.%s' % tuple(subver[:2]) + else: + return ver + + +setup(name='py2nb', + version=get_version(), + description='py2nb: convert python scripts to jupyter notebooks', + long_description=readme(), + author='Will Handley', + author_email='wh260@cam.ac.uk', + url='https://github.com/williamjameshandley/py2nb', + scripts=['py2nb'], + install_requires=['nbformat'], + include_package_data=True, + license='GPL', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + ], + )