Skip to content

Commit

Permalink
Better documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjameshandley committed Nov 5, 2018
1 parent 7e4fa76 commit b9ee28b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ py2nb: convert python scripts to jupyter notebooks
==================================================
:py2nb: convert python scripts to jupyter notebooks
:Author: Will Handley
:Version: 0.0.2
:Version: 0.0.3
:Homepage: https://github.com/williamjameshandley/py2nb

.. image:: https://badge.fury.io/py/py2nb.svg
Expand Down
19 changes: 13 additions & 6 deletions py2nb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def new_cell(nb, cell, markdown=False):
return ''


def py2nb(script_name):
def convert(script_name):
""" Convert the python script to jupyter notebook"""
with open(script_name) as f:
markdown_cell = ''
Expand All @@ -55,11 +55,18 @@ def py2nb(script_name):
nbformat.write(nb, notebook_name)


if __name__ == '__main__':
def parse_args():
"""Argument parsing for py2nb"""
description = "Convert a python script to a jupyter notebook"
parser = argparse.ArgumentParser(description=description)
parser.add_argument("script_name", help="name of script (.py) to convert to jupyter notebook (.ipynb)")
return parser.parse_args()


parser = argparse.ArgumentParser()
parser.add_argument("script_name", help="file name of python script (.py) to convert to jupyter notebook (.ipynb)")
def main():
args = parse_args()
convert(args.script_name)

args = parser.parse_args()

py2nb(args.script_name)
if __name__ == '__main__':
main()

0 comments on commit b9ee28b

Please sign in to comment.