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.0.tar.gz (10.0 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.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: iRe.py-0.4.0.tar.gz
  • Upload date:
  • Size: 10.0 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.0.tar.gz
Algorithm Hash digest
SHA256 3318e8497ea408457d59bce0027dcb3e43f708c70f4fffdd1ddb74c3caba2e3f
MD5 a053c37df7fe55021c42fa586b04dd9f
BLAKE2b-256 4ffd87f1bb80bbffe5c0495efb5efd112c79c8da15f0b30b28d254a441fae511

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iRe.py-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 873e5cff61a82c6cac8d1f425115e5ddd725c70400bfea1cb53bd14be6281dc9
MD5 0c329004389f7a45c9654cb4d0a19fbf
BLAKE2b-256 d45d3df4c09b586d36e546433e7d4d57bc211e1db8edfd4586ee16e03169b539

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