Skip to main content

Convert jupyter notebook to .py file

Project description

jup2py - Make jupyter notebook production ready

Simplest way to convert jupyter notebook to production ready .py file

Introduction

As a data scientist or some one who loves quick proto-typing, you might be using Jupyter notebook or Ipython console to build your data pipelines or modelling iteration. Finally when it's time for deployment, the hard time starts, converting jupyter notebook to simple py file.

You have conventional ways to download it as a .py file from console with or by downloading as .py file from Jupyter Notebooks. But they never make it production ready .py file, somethings they mess with magic words or plots.

Installation

To install Jup2Py from PyPI:

$ pip install jup2py
  • Jup2Py supports Python 3.6 and above
  • Only requirement as of now is nbconvert

Jup2Py is still considered in "alpha" stage, and the released version may change often; therefore, the best way to keep up-to-date with the latest development is to clone this repository.

Usage

Jup2Py is made to remove complexity and make it super easy.

Options:

Jup2Py :- Simple way to convert your Jupyter Notebook to .py
Please make sure that you have saved the Notebook before running Jup2Py
usage: jup2py [-h] [-v] [-i INPUT] [-o OUTPUT]

Jup2Py :- Simple way to convert your Jupyter Notebook to .py

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Jup2Py Version
  -i INPUT, --input INPUT
                        Input Jupyter Notebook to be converted to .py file
  -o OUTPUT, --output OUTPUT
                        [Optional]: Output python file name and location

Example

  • NOTE - Jup2Py requires you to save the Jupyter Notebook before using jup2py

  • Command Line

jup2py -i <<JUPYTER_NOTEBOOK.ipynb>> -o <<PYTHON_FILENAME.py>>

-o/ --output is totally optional, if you don't supply it will save the .py in the same directory save the .ipynb file

jup2py -i tests\jup2py_sample.ipynb
  • Python Code
import jup2py
jup2py.jup2py("tests/jup2py_test.ipynb", "tests/test.py")

Second argument is totally optional, if you don't supply it will save the .py in the same directory save the .ipynb file

NOTE: - The output file is non-interactive in nature and will override if any previous same name file is found at that location.

Conversion

Sample Jupyter Notebook -

Sample Jupyter Notebook

Jup2Py converted to production ready .py file in no time -

Production ready python code

Contact Us

Jup2Py is a very small initiative I took, there are lot of things we can improve on this and make this more stronger.

Please don't hesitate to report a bug through issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jup2py-0.1.dev1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jup2py-0.1.dev1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file jup2py-0.1.dev1.tar.gz.

File metadata

  • Download URL: jup2py-0.1.dev1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for jup2py-0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 4823f5baafb2f8ef77879bd46847c1565afab34660f2251c1ccc76050d98c5e3
MD5 62aa06ea11daa2c38ce0a3d1330b0c32
BLAKE2b-256 c8dc3b59bfb71f58884c0131ccc214baeacf102218987879b1584a4f360ade44

See more details on using hashes here.

File details

Details for the file jup2py-0.1.dev1-py3-none-any.whl.

File metadata

  • Download URL: jup2py-0.1.dev1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for jup2py-0.1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ddb2681e8b4b53b3059bdc7d20c52767267452be8dea711bb25d6fc17759b17
MD5 1a1dc84bfbd3a7d3c3e18fa2e8f13a1e
BLAKE2b-256 6fbe7ccaf08918f6dd86222183915acddc88fdad109383e1b5e12ef95ec31c3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page