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
- Add #export or # export comments to cells you want to export.
-
- Option 1: Use command line.
For all the options:exporter notebook_path.ipynb output_path.py
exporter --help
- Option 2: Use Python function.
from exporter import export export("notebook_path.ipynb","oytput_path.py")
- Option 1: Use command line.
Export Code as a Image
- 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!)
- List all the available styles.
image-exporter --styles
-
- Option 1: Use command line.
orimage-exporter script.py output_path style
For all the options:image-exporter notebook.ipynb output_path style
exporter --help
- Option 2: Use Python function.
from exporter import image_export, available_styles print(available_styles()) image_export("script.py","exported_images","colorful")
- Option 1: Use command line.
Examples
Some examples with different styles.
emacs
friendly
native
vs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.