Skip to main content

Capture output from JupyterLab

Project description

jupyter-caputure-output

A cell magic that captures jupyter cell output

JupyterLight

Install

Requires Python >=3.8

pip install jupyter_capture_output

Example

https://user-images.githubusercontent.com/44469195/184531492-6bc34ed9-3640-447b-b09e-767d01ecf3da.mov

import jupyter_capture_output
%%capture_text --path "foo.txt"
print("Hello World")
import matplotlib.pyplot as plt
%%capture_img --path "foo.png bar.png"
plt.plot([1,2],[10,20])
plt.show()
plt.plot([3,4],[-10,-20])
plt.show()
%%capture_img  --path "foo.jpg bar.jpg" --compression 50
plt.plot([1,2],[10,20], color = "r")
plt.show()
plt.plot([3,4],[-10,-20],color = "r")
plt.show()

Implemented

  • %%capture_text -> to .txt file with text output
  • %%capture_img -> to .png or .jpg with image output
  • %%capture_video -> to .mp4 file with the video output

Wishlist

  • %%capture_svg -> to .svg file with svg vectorgraphic outout
  • %%capture_numpy_array -> to .np file with array
  • %%capture_csv -> to .csv with datapoints
  • %%capture_gif -> to .gif with animation
  • %%capture_auto-> automatically detects what output there is to capture

Changelog

0.0.8 (work in progress)

0.0.7

  • Add relative path support and automatically create paths if they don't exist yet.

Add some experimental magic, but this will likely be removed in future versions:

    • experimental_capture_video_first_last captures video and extracts first and last frame from it. Useful for post-processing of videos in other video editors. Needs ffmpeg installed
  • experimental_video_thumbnail extracts video from the Jupyter cell output, and replaces it with an image thumbnail of the video -> useful for Version control. Needs matplotlib and ffmpeg installed

0.0.6

better regex in capture video change example images to dogs

0.0.5

Remove debugging code Add JupyterLiteDemo

0.0.4

Add Text and Video capture cell magic update example

0.0.3

Setup automatic release action.

0.0.2

Update example

0.0.1

Initial release

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

jupyter_capture_output-0.0.7.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

jupyter_capture_output-0.0.7-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_capture_output-0.0.7.tar.gz.

File metadata

  • Download URL: jupyter_capture_output-0.0.7.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.15 Linux/5.15.0-1022-azure

File hashes

Hashes for jupyter_capture_output-0.0.7.tar.gz
Algorithm Hash digest
SHA256 d33bfb9d34c71862c856b1c988232655c867ab9f88927d3691e5a75a6da294b4
MD5 44a5cee726dd194fcb452514fc3602d4
BLAKE2b-256 01dbb6b83a0d46f4da81ab0b8420cc74133280553a6fe70aa913698ebfbf6bb3

See more details on using hashes here.

File details

Details for the file jupyter_capture_output-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_capture_output-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5da8b3d039729f685a6f2c0ba36205d79d4115f232a41d313b1677233f051433
MD5 c19050489c5db9f93eb7d5277618639d
BLAKE2b-256 9c35ab56520e00bcfcda7b3c2c51b04ee22b5a00a25e998cdf0f5423dd855b39

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