Skip to main content

dj-figpack-codecs

DataJoint codec for storing figpack visualizations in schema-addressed object storage (OAS).

Installation

pip install dj-figpack-codecs

Quick Start

import datajoint as dj
import dj_figpack_codecs  # Auto-registers <figpack> codec

# Configure a store for visualizations
dj.config['stores'] = {
    'figures': {
        'protocol': 'file',
        'location': '/data/figures',
    }
}

schema = dj.Schema('my_analysis')

@schema
class RasterPlot(dj.Computed):
    definition = """
    -> SortedUnits
    ---
    visualization : <figpack@figures>
    """

    def make(self, key):
        from figpack import views as vv
        import numpy as np

        # Fetch spike data
        spikes = (SortedUnits & key).fetch('spike_times')

        # Create figpack visualization
        fig = vv.TimeseriesGraph(
            title="Spike Raster",
            description="Unit activity over time"
        )

        for i, spike_train in enumerate(spikes):
            fig.add_line_series(
                name=f"Unit {i}",
                t=spike_train.tolist(),
                y=[i] * len(spike_train),
            )

        self.insert1({**key, 'visualization': fig})

Usage

Fetching Visualizations

Fetching returns a FigpackRef - a lazy reference that provides metadata without downloading:

# Fetch returns FigpackRef (lazy)
ref = (RasterPlot & key).fetch1('visualization')

# Access metadata without download
print(ref.title)        # "Spike Raster"
print(ref.description)  # "Unit activity over time"

# Serve it over HTTP and open it in a browser
ref.show()

Jupyter Integration

In Jupyter notebooks, FigpackRef displays a rich HTML preview:

ref  # Shows title, description, and action hints

Storage Structure

A figpack figure is its bundle — viewer, data and extension manifest together — and the whole folder is what gets stored. That is what lets a figure be served without figpack installed, and what gives an extension view somewhere to keep its JavaScript.

Bundles are stored under a schema-addressed path chosen by the framework (DataJoint's build_object_path): it mirrors the schema/table structure, encodes primary keys as attr=value segments, and ends in a tokenized filename ({attribute}_{token}.figpack), subject to the store's prefix/partitioning configuration — for example:

{store_location}/demo_showcase/fluorescence_figpack/session_id=4/fig_NPhczfGY.figpack/

The stored folder holds index.html, assets/, data.zarr/ and extension_manifest.json — exactly what FigpackView.save() produced. Treat it as opaque: a custom view may name its data folder differently or carry several.

The layout is browsable but framework-owned — do not hand-build or rely on exact paths; the database column's metadata (path, store) is the source of truth.

API Reference

FigpackCodec

The codec for <figpack@store> attributes. Registered automatically on import.

FigpackRef

Lazy reference returned when fetching <figpack@> attributes.

Properties:

  • title - Visualization title (no I/O)
  • description - Visualization description (no I/O)
  • path - Storage path
  • store - Store name

Methods:

  • show(open_browser=True) - Serve the figure over HTTP; returns its URL
  • serve_under(base_dir) - Publish the stored bundle; returns its relative URL

Serving a figure in a dashboard

FigpackRef.serve_under(base_dir) downloads the stored bundle into base_dir/<id>/ and returns the relative URL /<id>/index.html. Nothing is assembled and figpack need not be installed in the serving process. Dashboards (e.g. dash-datajoint-components' PlotGrid) serve base_dir over HTTP and embed the URL in an <iframe>; repeated calls are idempotent and refresh the directory mtime for TTL-based cache cleaners.

Requirements

  • Python >= 3.10
  • datajoint >= 2.0
  • figpack >= 0.3

License

Copyright 2026 DataJoint Inc.

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Metadata

Release files for dj-figpack-codecs 0.3.0

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

Source distribution (sdist)

Source distribution for dj-figpack-codecs 0.3.0
File Size Uploaded Provenance Actions
dj_figpack_codecs-0.3.0.tar.gz 14.4 kB With provenance Details for dj_figpack_codecs-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dj-figpack-codecs 0.3.0
File Interpreter ABI Platform Actions
dj_figpack_codecs-0.3.0-py3-none-any.whl Python 3 none any Details for dj_figpack_codecs-0.3.0-py3-none-any.whl

Total release size: 31.3 kB

Release files / dj_figpack_codecs-0.3.0.tar.gz

Download URL dj_figpack_codecs-0.3.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b5d70ead9d8a530d38fe5afb23bac162496fe25a6e0a606791995212435d6c77
BLAKE2b-256 checksum
How to use checksums
fd56f3ce8510204b31f50b4f2c6b5a3ed3db3613944afc9639af62527900a67a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dj_figpack_codecs-0.3.0-py3-none-any.whl

Download URL dj_figpack_codecs-0.3.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fa203baf8bf0da70ac04b1ab25b1022eff98c44c0e2b296618b964b7eddf563
BLAKE2b-256 checksum
How to use checksums
5bd137c29cb2456bb418cc0aa61db9df2b71d58cdd67631fed1478de011e2162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for dj-figpack-codecs 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dj_figpack_codecs-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

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