skillfed

py-multicodec

Multicodec implementation in Python

py-multicodec v1.0.0 174.6K downloads/30d#10,279 on PyPI19
Permissive license MIT AGING released

What it is and what it does

py-multicodec is a Python implementation of the Multicodec specification, a self-describing multiformat standard that wraps data with a tiny varint-encoded header identifying the codec used. The library lets you add codec prefixes to binary data, extract those prefixes, and look up which codec was used—all grounded in a table of supported codecs maintained from the upstream multiformats specification.

The package provides both simple prefix operations (add_prefix, remove_prefix, get_codec) and type-safe codec management through named Code constants and a known_codes registry. It supports modern Python versions (3.10 through 3.14) and depends only on varint for encoding/decoding the multicodec identifiers. The library is commonly used in IPFS and IPLD ecosystems where content addressing and format identification are critical.

Use it for:

  • Tag binary data with codec identifiers in IPFS/IPLD applications to enable format-agnostic content addressing.
  • Decode multicodec-prefixed data to identify the underlying format before processing.
  • Build type-safe codec handling in systems that work with multiple serialization formats (CBOR, JSON, Protocol Buffers).
  • Maintain a canonical reference of supported multicodec codes in a Python application.
  • Wrap custom or domain-specific data formats with standard multicodec headers for interoperability.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Wraps data with self-describing multicodec prefixes, enabling format identification and codec lookup from varint-encoded headers.

Yes, if you work with IPFS, IPLD, or other multiformats ecosystems. The package is stable (Production/Stable classifier), has no known vulnerabilities, and installs with minimal friction. Maintenance is aging (239 days since last release), but the repository is active and the API is mature. Install it for multicodec prefix operations; avoid it if you have no need for format-agnostic codec tagging.

Install

py-multicodec on PyPI

pip

pip install py-multicodec

uv

uv add py-multicodec

poetry

poetry add py-multicodec

Installing py-multicodec

Before you install

Low friction install with a single runtime dependency (varint). Last release was recent; repository is active and not archived, though maintenance status is aging with 239 days since last release.

License in practice

MIT license permits commercial and private use with minimal restrictions—suitable for most projects.

Quickstart

pip install py-multicodec

from multicodec import add_prefix, remove_prefix, get_codec

# Add codec prefix to data
prefixed = add_prefix('sha2-256', b'EiC5TSe5k00')

# Retrieve codec name from prefixed data
codec_name = get_codec(prefixed)

Requires Python 3.10 or later.

Verify before relying

  • Whether the 460 known codecs listed in the description are current as of the latest release.
  • Performance characteristics when handling large batches of codec operations.
  • Stability guarantees for the multicodec table updates and backward compatibility across versions.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — varint
Maintenance aging — 239 days since the last release
Last repo commit
First released
Downloads 174,588/month — #10,279 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: py_multicodec-1.0.0-py3-none-any.whl

Keywords: multicodec, multiformats, CID, IPFS, IPLD

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

multicodec prefix encodingself-describing data formatmultiformat codec wrappervarint codec identificationIPFS multicodec implementationdata format taggingcodec lookup by prefix
ipfs-ipldcodec-taggingmultiformats

More Internet packages