Skip to main content

Binary data visualization as a Jupyter anywidget

Project description

bitjet

Binary data visualization as a Jupyter anywidget. Drop bytes in, see structure come out.

from bitjet import BitView, ByteView

BitView(data=open("/bin/ls", "rb").read(), datawidth=64)

bitjet screenshot

What it does

Every bit (or byte) in your payload becomes a fixed-size block on a canvas. The datawidth slider changes how many units are drawn per row — not how big the canvas gets — so periodic structures in the data (byte boundaries in ASCII text, alignment padding, null runs in executables, LZ-compressed block headers) line up into columns and patterns pop out as you drag.

Install

pip install bitjet

That's it. anywidget handles the JS — no lab extension, no server extension, no rebuild step.

Use

from bitjet import BitView, ByteView

# Bit mode: each bit is a white (1) or black (0) block. Good for ASCII text,
# checksums, bitfields, anywhere the individual bits matter.
BitView(data=b"The quick brown fox jumps over the lazy dog. " * 128, datawidth=64)

# Byte mode: each byte is a grayscale block (0=black, 255=white). Good for
# pixel data, pickled objects, compressed blobs, anything where byte-level
# entropy matters.
ByteView(data=bytes(range(256)) * 16, datawidth=32, block_size=6)

Assign to data to live-update:

import os

view = BitView(data=b"")
view  # renders

# In a later cell
view.data = os.urandom(8192)

Traitlets

trait type default meaning
data bytes b"" The binary payload. Accepts bytes, bytearray, memoryview, or anything with .tobytes() (e.g. numpy.ndarray).
datawidth int 64 Units per row. Bits if mode == "bit", bytes if mode == "byte".
block_size int 4 Pixel side length of each unit. Fixed across widths so patterns scale.
mode "bit" or "byte" "bit" Rendering mode.

All sync bidirectionally. Drag the slider and the Python side sees the update; assign view.datawidth = 128 and the canvas redraws.

Compatible with

  • JupyterLab 3+
  • Jupyter Notebook 7+
  • VS Code notebooks
  • nteract desktop (tested during development)
  • Anything else that runs anywidget

History

Replaces the original 2014-era bitjet that depended on ipywidgets 1.x-style nbextensions. Same idea, modern plumbing — anywidget loads the ESM directly instead of requiring a notebook extension install.

License

BSD-3-Clause. See LICENSE.

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

bitjet-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

bitjet-1.0.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file bitjet-1.0.0.tar.gz.

File metadata

  • Download URL: bitjet-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for bitjet-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f10ac05696af261fb6a2bb9c87423f8f4794bda82d202898b4ac133ccec0c68f
MD5 745b695881a956fd31ce58c5d87c9f0e
BLAKE2b-256 2492f5d6afa47b55f0b52184b6b1060f273005c02691857c6713a4299276c533

See more details on using hashes here.

File details

Details for the file bitjet-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bitjet-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for bitjet-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be850ad58dbfa94c79696c91a9778b708bdc613da08e1f7020b6e31adb852dc7
MD5 9564efc86e8317a0a0d91b07f649682b
BLAKE2b-256 854c95d63a1afbc6b3527c64f287344d3429769d4cc22ff3f5b61f55fd64aa77

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