Skip to main content

(Blogging) from Jupyter

Installation

This package is compatible with Python 3.8 and higher

pip install from-jupyter

If you want to be able to export data frames to images, it is also necessary to install wkhtmltopdf:

# Debian
sudo apt-get install wkhtmltopdf
# MacOS with brew
brew install --cask wkhtmltopdf

Usage

from-jupyter relies heavily on cell metadata, whenever you want to export a cell, you probably need to add metadata to make sure the export happens as you want.

Exporting images

Given a code cell that produces a matplotlib plot:

import matplotlib.pyplot as plt

plt.plot(1, 2, 3)

It is necessary to add the "image" key to the metadata, the value should be the name you want the plot to have when exported to the local file system.

Set image metadata

The command below will output the plot to the path output/showcase/my-first-plot.png:

from-jupyter images showcase.ipynb

The output:

my-first-plot.png

Exporting pandas data frames

Given a cell that outputs a pandas data frame as a table:

import pandas as pd

my_frame = pd.DataFrame([
    (1, 2),
    (3, 4),
    (5, 6),
], columns=["column 1", "column 2"])

my_frame.head()

It is necessary to add the "dataframe" key to the metadata, the value should be the name you want the exported dataframe to have in the local file system.

Set dataframe metadata

The command below will generate the dataframe as image located in output/showcase/my-dataframe.png:

from-jupyter frames showcase.ipynb

The output:

my-dataframe.png

Exporting code

Any code cell can also be exported to an independent code file, to do this, it is necessary to add the "gist" key to the cell, with the value being the name of the file you want to take.

To export them to the output folder, one needs to use:

from-jupyter code showcase.ipynb

Similar projects

Metadata

Release files for from-jupyter 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for from-jupyter 0.3.0
File Size Uploaded
from-jupyter-0.3.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for from-jupyter 0.3.0
File Interpreter ABI Platform
from_jupyter-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / from-jupyter-0.3.0.tar.gz

Download URL from-jupyter-0.3.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1e561df5f6c0668732c226595738ab439f698fcf95e821873402561ae7df3645
BLAKE2b-256 checksum
How to use checksums
90f253598e91cfc45562fc9e10205e7afe7d332cb3a8f642526987684a57e8c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.12 Linux/5.13.0-1022-azure

Release files / from_jupyter-0.3.0-py3-none-any.whl

Download URL from_jupyter-0.3.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d02ee074551f297c0aacd39e0505c5083df34432539bc57a8cf59a20f7f4e18
BLAKE2b-256 checksum
How to use checksums
48a82c3b28fd3748f2459d7f19bd9ae3833e67e858a1c5347a684136dc166459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.12 Linux/5.13.0-1022-azure

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page