Skip to main content

exporter helps to export Jupyter notebooks as a Python script.

Project description

exporter

exporter is a simple package that helps to export Jupyter notebooks as a Python script. Add #export or # export comments anywhere in the notebook cell you want to export as a Python script. Cells in the same notebook will be exported to the same Python script.

You can also export codes from Jupyter notebooks and Python scripts as an image.

Installation

pip install exporter

Check PyPI for all the versions available.

Installation for Image Export Functionality

To work with image export functionality you need to install wkhtmltopdf.

  • Ubuntu/Debian

    sudo apt-get install wkthtmltopdf
    
  • MacOS

    brew install wkhtmltopdf
    
  • Windows and other options

    Check Wktmltopdf download page.

Basic Usage

  1. Add #export or # export comments to cells you want to export.
    1. Option 1: Use command line.
      exporter notebook_path.ipynb output_path.py
      
      For all the options:
      exporter --help
      
    2. Option 2: Use Python function.
      from exporter import export
      export("notebook_path.ipynb","oytput_path.py")
      

Export Code as a Image

  1. Add # image-export-start and # image-export-end comments to the start and end of the code blocks you want to export. (You can export more than one code block!)
  2. List all the available styles.
    image-exporter --styles
    
    1. Option 1: Use command line.
      image-exporter script.py output_path style
      
      or
      image-exporter notebook.ipynb output_path style
      
      For all the options:
      exporter --help
      
    2. Option 2: Use Python function.
      from exporter import image_export, available_styles
      print(available_styles())
      image_export("script.py","exported_images","colorful")
      

Examples

Some examples with different styles.

emacs

emacs example 0 emacs example 1

friendly

friendly example 0 friendly example 1

native

native example 0 native example 1

vs

vs example 0 vs example 1

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

exporter-0.0.4.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

exporter-0.0.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file exporter-0.0.4.tar.gz.

File metadata

  • Download URL: exporter-0.0.4.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for exporter-0.0.4.tar.gz
Algorithm Hash digest
SHA256 1e16ba33c6a2240e6a7f1cac778abf37f550e4695350e7a6b8870c964e7ae782
MD5 98891d1d5cd6beb00dfaa1fb293b268a
BLAKE2b-256 9fd2f6fbcf901c2de679c95e248ba96e34957f8bcb3846044b485daa85987e70

See more details on using hashes here.

File details

Details for the file exporter-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: exporter-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for exporter-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e170b60c1b176d7b4132ae66a52d4308a8c86869cfc8eda185c93e881ea06480
MD5 9f72b2e245767d1fb1c42191dc762ba4
BLAKE2b-256 101da33598d8f481d6da83e66bd73b60b3b09b3f14327c811846eae64d719211

See more details on using hashes here.

Supported by

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