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.jsonfiles usingdataclasses - Compatible with
.avifframe 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
Metadata
Release files for lava-serpent 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lava_serpent-0.1.2.tar.gz | 5.9 kB | Without provenance | Details for lava_serpent-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lava_serpent-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for lava_serpent-0.1.2-py3-none-any.whl |
Total release size: 14.1 kB
Release files / lava_serpent-0.1.2.tar.gz
| Download URL | lava_serpent-0.1.2.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f79072167c2cc48035aa9b585a6d495f00c11cafd40eba58842803966d4ed7ad
|
|
BLAKE2b-256 checksum How to use checksums |
293c2553e4e8a06bbadb9fbc32901ff14be00d1a6fcec392af0e2c544ee9b368
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.11.12 Darwin/24.5.0
|
Release files / lava_serpent-0.1.2-py3-none-any.whl
| Download URL | lava_serpent-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72824b182294928f040eac51c2f3f335951fb3f05973a1db94eebb3c07b2e425
|
|
BLAKE2b-256 checksum How to use checksums |
1671fa498617787070208e3c8826cdb9d2ee4675877851b1480f21242aa5470d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.11.12 Darwin/24.5.0
|
Security for lava-serpent 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.