Skip to main content

No project description provided

Project description

LavaSerpent 🐍🔥

LavaSerpent is a Python library for working with the Lava animation format originally developed by Airbnb. It allows you to easily pack a sequence of image frames into the Lava format, and unpack existing Lava animations into individual frames for inspection or conversion.

This package also includes data classes and helpers for parsing and generating manifest.json files used by Lava.

✨ Features

  • Convert frame sequences into Lava-compatible animations
  • Export Lava animations back into frame sequences
  • Parse and generate Lava manifest.json files using dataclasses
  • Compatible with .avif frame sequences (via PIL + AVIF plugin)

📦 Installation

pip install lava-serpent

Requires:

  • Python 3.10+
  • Pillow with AVIF support (e.g., via pillow-avif-plugin)

🚀 Usage

Packing Frames

from lavaserpent import pack_frames

pack_frames(
    frames_path="frames/",
    output_path="output_lava/",
    frame_pattern="frame_%04d.avif",
    tile_size=32,
)

Unpacking Frames

from lavaserpent import unpack_frames

unpack_frames(
    lava_path="output_lava/",
    output_path="extracted_frames/"
)

🧾 API Reference

pack_frames

def pack_frames(
    frames_path: str,
    output_path: str,
    frame_pattern: str = None,
    tile_size: int = 32,
):
    """
    Packs a directory of frames into the Lava format.

    Args:
        frames_path (str): Path to a directory containing input frames (e.g., AVIF images).
        output_path (str): Path to save the resulting Lava package (includes manifest + images).
        frame_pattern (str, optional): FFmpeg-style frame naming pattern (e.g., "frame_%04d.avif").
                                       If omitted, all .avif files in the directory will be used.
        tile_size (int): Size of each square tile (e.g., 32 for 32x32 tiles).
    """

unpack_frames

def unpack_frames(
    lava_path: str,
    output_path: str,
):
    """
    Unpacks a Lava animation into individual frame images.

    Args:
        lava_path (str): Path to a Lava package directory containing manifest and images.
        output_path (str): Directory where extracted frames will be saved.
    """

Here's the updated section of the README.md including a note and usage example for the simple CLI:


🧰 Command-Line Interface (CLI)

LavaSerpent includes a simple CLI for packing and unpacking animations directly from the terminal.

🔧 Usage

# Pack frames into Lava format
poetry run lava-serpent pack Frames/frame_%04d.avif OutputLava

# Unpack a Lava package into individual frames
poetry run lava-serpent unpack LavaDir Frames

You can also use this via python -m lavaserpent if you prefer.

👋 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests with bugfixes, enhancements, or format insights.

📜 License

MIT 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

lava_serpent-0.1.1.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.

lava_serpent-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file lava_serpent-0.1.1.tar.gz.

File metadata

  • Download URL: lava_serpent-0.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.12 Darwin/24.5.0

File hashes

Hashes for lava_serpent-0.1.1.tar.gz
Algorithm Hash digest
SHA256 59426b7d5c89f6b12c12d01ae390f1a5f73aa7adf6368266912772ab21df2cfd
MD5 965b3b1102341d343a5886c72029ad4a
BLAKE2b-256 004e7146e75ba2bad1533072fb457ba462a23f6d60d4e25478a1b95d3712fdba

See more details on using hashes here.

File details

Details for the file lava_serpent-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lava_serpent-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.12 Darwin/24.5.0

File hashes

Hashes for lava_serpent-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 710e03bb9c7c6250728837ec4c283ed3233c41720851e4c57ac77ed7cf10f38b
MD5 10ade6b9e19998bb7c1daae9071e05e6
BLAKE2b-256 eb8e03bfddb2a2dc8c9a8681eb8da3833e45833154105e1d4a3ae1b983c3fe11

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