Skip to main content

py-ipfs-lite

py-ipfs-lite is a lightweight, embeddable Python IPFS peer built on top of py-libp2p. It provides the core features of IPFS (Blockstore, Bitswap, DHT, IPNI, IPNS, and IPLD DAGs) without the overhead of a heavy Kubo daemon.

It is designed to be highly interoperable with standard IPFS implementations like Kubo and go-ipfs-lite, natively supporting dag-cbor, CARv1 file import/export, Bitswap streaming, and more.

Features

  • Embedded IPFS Node: Run a complete IPFS node purely in Python using trio or standard async.
  • Bitswap Protocol: Interoperate and exchange blocks directly with Kubo daemons.
  • KadDHT & IPNI Routing: Local block lookups with lightning-fast routing via the KadDHT network and Delegated HTTP IPNI (cid.contact).
  • IPLD DAG Support: Fully supports dag-pb, dag-cbor, and dag-json for building decentralized knowledge graphs, versioned datasets, and agent memory chains.
  • Offline Data Bundles (CAR): Export and import full or partial DAGs as Content Addressable aRchives (.car).
  • IPNS Mutable Pointers: Publish and resolve cryptographically signed mutable pointers (IPNS).
  • FastAPI HTTP Daemon: A drop-in, Kubo-compatible HTTP API exposing /api/v0 endpoints for adding files, fetching DAGs, and pinning.
  • Prometheus Metrics: Integrated observability for garbage collection, block sizes, and Bitswap traffic.

Installation

py-ipfs-lite uses uv for dependency management.

# Clone the repository
git clone https://github.com/sumanjeet0012/py-ipfs-lite.git
cd py-ipfs-lite

# Install dependencies using uv
uv sync --locked --python 3.12

Quickstart

1. The Python SDK (Embedded Peer)

You can run an IPFS peer directly inside your Python application using trio:

import trio
from py_ipfs_lite.peer import Peer
from py_ipfs_lite.config import Config

async def main():
    # Start an ephemeral in-memory peer
    peer = Peer(Config(blockstore_type="memory"), listen_addrs=["/ip4/127.0.0.1/tcp/0"])
    await peer.start()

    # Add a file
    cid = await peer.add_file("/path/to/my/file.txt")
    print(f"Added file with CID: {cid}")

    # Build an IPLD DAG
    node_cid = await peer.add_node({"title": "Hello World", "author": "py-ipfs-lite"}, codec="dag-cbor")
    print(f"Added DAG node with CID: {node_cid}")

    # Publish to IPNS
    ipns_name = await peer.publish_name(f"/ipfs/{node_cid}")
    print(f"Published to IPNS: {ipns_name}")

    await peer.close()

if __name__ == "__main__":
    trio.run(main)

2. The CLI Daemon & HTTP API

You can spin up py-ipfs-lite as a standalone daemon that provides a Kubo-compatible HTTP API.

# Run the daemon on port 4001, exposing the HTTP API on port 5001
uv run py-ipfs-lite daemon --api --api-port 5001

Then you can use the standard HTTP API to interact with it:

# Add a file
curl -X POST -F file=@test.txt http://127.0.0.1:5001/api/v0/add

# Fetch an IPLD node
curl -X POST "http://127.0.0.1:5001/api/v0/dag/get?arg=bafy..."

What's Next

I want to… Go to…
Understand how py-ipfs-lite is structured internally docs/architecture.md
Build verifiable AI agent memory / RAG pipelines docs/guides/ai-agents-and-rag.md
Export a DAG as a CAR file for Filecoin storage docs/guides/car-files-and-filecoin.md
Use IPNS mutable pointers and understand the trust model docs/guides/ipns.md
Interoperate with a live Kubo daemon over Bitswap docs/guides/interop-with-kubo.md
See the full list of all 21 examples with one-line descriptions docs/reference/examples-index.md
Browse all documentation docs/index.md

License

MIT License

Metadata

Release files for py-ipfs-lite 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-ipfs-lite 0.2.1
File Size Uploaded Provenance Actions
py_ipfs_lite-0.2.1.tar.gz 138.6 kB With provenance Details for py_ipfs_lite-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-ipfs-lite 0.2.1
File Interpreter ABI Platform Actions
py_ipfs_lite-0.2.1-py3-none-any.whl Python 3 none any Details for py_ipfs_lite-0.2.1-py3-none-any.whl

Total release size: 265.7 kB

Release files / py_ipfs_lite-0.2.1.tar.gz

Download URL py_ipfs_lite-0.2.1.tar.gz
Size 138.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c9dba17e713473db91216a601a17413b5a06e06926e842947bc66740ca8eadcb
BLAKE2b-256 checksum
How to use checksums
de99a0d2be9f1f8f73abab9d477003a86ec0c8ab89b8cc50c58f2c8bd5d4fd7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / py_ipfs_lite-0.2.1-py3-none-any.whl

Download URL py_ipfs_lite-0.2.1-py3-none-any.whl
Size 127.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23555f7d00c8f63aff088b4b9185906811bde745a1f2dd687a11fff552daf4a8
BLAKE2b-256 checksum
How to use checksums
4323310535e208924b3221f1d2e90588d23ee157199405535d8fc16f9c445b02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for py-ipfs-lite 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_ipfs_lite-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page