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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lava_serpent-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 384b8ac9172288c359881a06fe596bfa17b7a131e108152b4759ff6c89c2a187
MD5 ccd8d6af287c05a02be19549d8e2075e
BLAKE2b-256 3456eac04719134ba96dc18658e81dd639e25968f77914e14ccc3784be9e1f9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lava_serpent-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b651a97e2365c67c279f7cc1aac358ec2f2e23cc1deb3f23ba47e38e2cd06b7a
MD5 a6acec8470d8d211b68d420446d6c147
BLAKE2b-256 be8e39a0774303f4114c97fffc13b91ee87ae1e995fae5cafc5d93b61a133991

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