Back to blog

Jupyter Mimetypes for Datalayer SDK

JupyterDatalayerPython

Originally published on datalayer.blog (in English)

jupyter-mimetypes

We are excited to announce jupyter-mimetypes, a new package that simplifies data exchange between Jupyter kernels and frontends using Apache Arrow serialization.

The Problem

Jupyter's messaging protocol relies on MIME types to communicate data between kernels and frontends. However, working with these MIME types directly can be cumbersome, especially when dealing with rich, structured data like DataFrames, images, and interactive visualizations.

Developers often find themselves writing boilerplate code to serialize and deserialize data, handle edge cases, and manage compatibility across different Jupyter clients.

The Solution

jupyter-mimetypes provides a clean, Pythonic API for registering and resolving MIME types in the Jupyter ecosystem. Key features include:

  • Apache Arrow serialization — Efficient columnar data format for DataFrames and tabular data, reducing payload size and improving performance.
  • Automatic type detection — The package intelligently determines the best MIME type for a given Python object.
  • Extensible registry — Register custom MIME types and serializers for your own data types.
  • Datalayer SDK integration — Seamless integration with the Datalayer platform for collaborative data science workflows.

Quick Start

from jupyter_mimetypes import register_mimetype, resolve

# Register a custom MIME type
register_mimetype("application/x-my-data", MyDataSerializer())

# Resolve the best representation for an object
result = resolve(my_dataframe)

How It Works

MIME types diagram

Under the hood, jupyter-mimetypes maintains a priority-based registry of MIME types. When you call resolve(), it:

  1. Inspects the Python object's type
  2. Finds all compatible MIME type handlers
  3. Selects the highest-priority handler based on the client's capabilities
  4. Serializes the data using Apache Arrow where applicable

This approach means your kernel code doesn't need to know what frontend is rendering the output — the MIME type system handles the negotiation automatically.

What's Next

We're working on expanding the default set of supported MIME types, improving integration with popular libraries like Pandas, Polars, and Matplotlib, and adding support for streaming data.

Check out the jupyter-mimetypes repository to get started, and let us know what you think!

© 2026 Gonzalo Peña-Castellanos

Made with 💜 by goanpeca