Skip to main content

jupyter-io

Release Python Downloads DOI Tests

Saving and loading files directly into Jupyter notebooks

Installation

pip install jupyter-io

File saving

jupyter-io provides the in_notebook function to directly save (i.e. embed) files to Jupyter notebooks. Suppose you create a Matplotlib figure want to save it as a PDF file. The following code will save the PDF file to your local environment:

import matplotlib.pyplot as plt

plt.plot([1, 2, 3])
plt.savefig("figure.pdf")

This should work in many cases, however, in a virtual environment like Google Colaboratory, you will not be able to get the file once the Jupyter server is stopped. By wrapping the file path by in_notebook, the PDF file will be directly saved to the Jupyter notebook and you will get a download link instead:

import matplotlib.pyplot as plt
from jupyter_io import in_notebook

plt.plot([1, 2, 3])
plt.savefig(in_notebook("figure.pdf"))

The download link works when the Jupyter server is stopped, and even when it does not exist. This makes Jupyter notebooks more portable, for example, to share the output data other than images together with them.

More examples

To save a pandas series to a notebook:

import pandas as pd
from jupyter_io import in_notebook

ser = pd.Series([1, 2, 3])
ser.to_csv(in_notebook("series.csv"))

To save a general text to a notebook:

from jupyter_io import in_notebook

with open(in_notebook("output.txt"), "w") as f:
    f.write("1, 2, 3\n")

File loading

The file loading feature has not been implemented yet.

Metadata

Release files for jupyter-io 2.0.1

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

Source distribution (sdist)

Source distribution for jupyter-io 2.0.1
File Size Uploaded
jupyter_io-2.0.1.tar.gz 83.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-io 2.0.1
File Interpreter ABI Platform
jupyter_io-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 89.8 kB

Release files / jupyter_io-2.0.1.tar.gz

Download URL jupyter_io-2.0.1.tar.gz
Size 83.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f1628da77450740fad7aa7a1ba5c46f66a93c4cc0e5f24656f43f784e93fedb3
BLAKE2b-256 checksum
How to use checksums
3513b7bc75c9afffa5451039c8cf145f9a2d0779fa73eedeac3f9995392acb0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.13

Release files / jupyter_io-2.0.1-py3-none-any.whl

Download URL jupyter_io-2.0.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c03b1f68ea696058aec19dd5a657d25f028957ac25743b3a732828a6b3555a1c
BLAKE2b-256 checksum
How to use checksums
b4b40ec6640f23781ca9f993fb308c126dab68e7acf9f3372c4a865dd6a65dda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.13

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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