Skip to main content

Export tables and plots from Jupyter notebooks, along with metadata for embedding interactive tables in downstream apps.

Project description

iRe.py

"Export" tables and plots from Jupyter notebooks, for interactive viewing on the web.

iRe/www is the accompanying web app (demo: ire.runsascoded.com), which renders notebooks exported by iRe.py as interactive "reports."

Installation

pip install ire.py

Usage

Wrap the final expression in a notebook cell in ire.export:

from ire import export
import pandas as pd

df = pd.DataFrame({'n': list(range(1000)), 'square': [n**2 for n in range(1000)]})

# Previews DataFrame as usual, in Jupyter, but also
# saves the full DF to a file (Parquet, by default).
export(df)

Supported types:

See also: examples/

Testing

Tests execute the notebooks in examples/ above, and verify the notebooks and exported files are unchanged (vs. HEAD).

Local

macOS

To run tests locally:

examples/run-tests.sh

# Or, run+validate a specific notebook:
cd examples
run-tests.sh export-test.ipynb

Ubuntu

The exported SQLite tables in export-test.ipynb and export-test-no-dvc.ipynb are not byte-for-byte identical across platforms:

db_hex() {
  git show "$1:examples/.ire/state_stats2.db" | hexdump -C
}
diff <(db_hex HEAD) <(db_hex ubuntu)
# 7c7
# < 00000060  00 2e 6e ba 0d 00 00 00  02 0c e4 00 0d 39 0c e4  |..n�......�..9.�|
# ---
# > 00000060  00 2e 63 01 0d 00 00 00  02 0c e4 00 0d 39 0c e4  |..c.......�..9.�|

The ubuntu branch points at a commit that patches them to the expected values. You'll want to cherry-pick it into your branch, to get tests passing on Ubuntu (as CI does, below).

CI

See .gitlab-ci.yml.

This cherry-picks the ubuntu branch, to patch tests' expected SQLite DBs, before running them.

Updating tests

docker/build.sh
docker run --rm -it -v $PWD/.git:/root/src/.git -v $PWD/.dvc/cache:/root/src/.dvc/cache ire.py

See build.sh, Dockerfile, entrypoint.sh.

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

iRe.py-0.4.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iRe.py-0.4.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file iRe.py-0.4.1.tar.gz.

File metadata

  • Download URL: iRe.py-0.4.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for iRe.py-0.4.1.tar.gz
Algorithm Hash digest
SHA256 798fbcbb05101bcd21bac389e1552b58a7fcd36b2b7a5c56d110d34d1880ded2
MD5 b559fdd7c67c2b0e333902d54da2614e
BLAKE2b-256 95b14e38fc7b7213d207bd7f9bd90ff54cf4054072b53c72abb4cf60d0d07565

See more details on using hashes here.

File details

Details for the file iRe.py-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: iRe.py-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for iRe.py-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8983f4a38a4aad027646548ccd02d0ec2aa184b014cab12ab94b5e9ec7226698
MD5 aa1fdbd57db1323f3f2e3c5aa303c71e
BLAKE2b-256 c7e178f12cdcebca81ec2d5c1cd5e85b98afce0b5d565838e2b1f939f0157a0b

See more details on using hashes here.

Supported by

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