Embeddable lightweight IPFS peer for Python (bootstrap phase)
Project description
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
trioor 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, anddag-jsonfor 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/v0endpoints 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/IPFS-Meshkit/py-ipfs-lite.git
cd py-ipfs-lite
# Install dependencies using uv
uv sync
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_ipfs_lite-0.1.0.tar.gz.
File metadata
- Download URL: py_ipfs_lite-0.1.0.tar.gz
- Upload date:
- Size: 32.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7717c918e08481a1c24a68bf6020475b128ab989fae84eeeabfd37822f0aec47
|
|
| MD5 |
20b8b9d93ae43daafd8567441d3f516a
|
|
| BLAKE2b-256 |
194d397932bc8413831fc64902f37a8b9c67e3594391db5b0e3269741af6494b
|
Provenance
The following attestation bundles were made for py_ipfs_lite-0.1.0.tar.gz:
Publisher:
publish.yml on IPFS-Meshkit/py-ipfs-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_ipfs_lite-0.1.0.tar.gz -
Subject digest:
7717c918e08481a1c24a68bf6020475b128ab989fae84eeeabfd37822f0aec47 - Sigstore transparency entry: 2146271470
- Sigstore integration time:
-
Permalink:
IPFS-Meshkit/py-ipfs-lite@2629eee60c7ffd21ed8714e6b69984c9d455c96b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/IPFS-Meshkit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2629eee60c7ffd21ed8714e6b69984c9d455c96b -
Trigger Event:
push
-
Statement type:
File details
Details for the file py_ipfs_lite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_ipfs_lite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cf6a6436c594183e74b5587a28b893a91c4b2d4582d41f3f3be3380a5ca7a86
|
|
| MD5 |
3fde75f1ecc4721cbcbefd4c4f8b9f66
|
|
| BLAKE2b-256 |
4c58d7007490ed903798e5c4d8892b1acae7b778a5c427f1802a0dd45c59832d
|
Provenance
The following attestation bundles were made for py_ipfs_lite-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on IPFS-Meshkit/py-ipfs-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_ipfs_lite-0.1.0-py3-none-any.whl -
Subject digest:
5cf6a6436c594183e74b5587a28b893a91c4b2d4582d41f3f3be3380a5ca7a86 - Sigstore transparency entry: 2146271525
- Sigstore integration time:
-
Permalink:
IPFS-Meshkit/py-ipfs-lite@2629eee60c7ffd21ed8714e6b69984c9d455c96b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/IPFS-Meshkit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2629eee60c7ffd21ed8714e6b69984c9d455c96b -
Trigger Event:
push
-
Statement type: