Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Kubo Python Library

A Python wrapper for the Kubo (Go-IPFS) library.

Overview

This library provides Python bindings for Kubo, the Go implementation of IPFS, allowing you to:

  • Spawn an in-process IPFS node
  • Add and retrieve files/directories from IPFS
  • Connect to the IPFS network
  • Manage IPFS repositories
  • Publish and subscribe to IPFS PubSub topics
  • Mount and connect to remote TCP services via libp2p

Project Status EXPERIMENTAL

This library is very early in its development, and is published as a proof-of-concept that it is feasible to write a python wrapper around kubo (Go-IPFS) to run IPFS nodes from within python. Much of the code is LLM-generated, and code coverage is poor.

The API of this library WILL CHANGE in the near future!

So far this library has been tested on Linux x86 64-bit and Android ARM 64-bit (in Termux & in Kivy). Assuming that it proves to be a reliable way of working in python, this library will be developed to maturity and maintained.

Compatibility

  • linux x86-64 (tested on Ubuntu)
  • linux arm-64 (tested on Ubuntu on a raspberry pi 5)

Roadmap

py_ipfs_node, will be incorporated into ipfs_toolkit when py_ipfs_node's API has stabilised.

ipfs_toolkit will become a multimodal IPFS library with a unified API for alternative modes of using IPFS:

  • running an embedded IPFS node
  • interacting with a separate IPFS node via its HTTP RPC

You can check out a prototype version of the combination of these two libraries under the kubo_python branch of the IPFS-Toolkit repo: https://github.com/emendir/IPFS-Toolkit-Python/tree/kubo_python

Installation

pip install ipfs_node

Dev Requirements

  • Go 1.19
  • Python 3.7+
  • IPFS Kubo dependencies

Basic Usage

Working with Files

from ipfs_node import IpfsNode

# Create a new node with a temporary repository
with IpfsNode.ephemeral() as node:
    # Add a file to IPFS
    cid = node.files.publish("README.md")
    print(f"Added file with CID: {cid}")
    
    # Retrieve a file from IPFS
    node.files.download(cid, "download.md")

Using PubSub

from ipfs_node import IpfsNode

with IpfsNode.ephemeral() as node:
    # Subscribe to a topic
    with node.pubsub.subscribe("my-topic") as subscription:
        # Publish a message
        node.pubsub.publish("my-topic", "Hello, IPFS world!")
        
        # Receive messages
        message = subscription.next_message(timeout=2.0)
        if message:
            print(f"Received: {message.data.decode('utf-8')}")
        
        # Or use a callback
        def on_message(msg):
            print(f"Received via callback: {msg.data.decode('utf-8')}")
        
        subscription.subscribe(on_message)

Using TCP Tunnels (LibP2P Stream Mounting)

from ipfs_node import IpfsNode

# Create an IPFS node
with IpfsNode.ephemeral() as node:
    
    # Example 1: Listen for connections on a protocol and forward them to a local service
    node.tunnels.open_listener("my-service", 8888)
    
    # Example 2: Forward local connections to a remote peer
    node.tunnels.open_sender("their-service", 8889, node.peer_id)
    
    # List active listeners and streams
    tunnels = node.tunnels.get_tunnels()
    print(tunnels.listeners)
    print(tunnels.senders)
    
    # Close specific connections when done
    node.tunnels.close_listener("my-service")
    node.tunnels.close_sender("their-service")

Documentation

Examples

Contributing

Get Involved

  • GitHub Discussions: if you want to share ideas
  • GitHub Issues: if you find bugs, other issues, or would like to submit feature requests
  • GitHub Merge Requests: if you think you know what you're doing, you're very welcome!

Donations

To support me in my work on this and other projects, you can make donations with the following currencies:

Donations help me:

  • dedicate more time to developing and maintaining open-source projects
  • cover costs for IT infrastructure
  • finance projects requiring additional hardware & compute

About the Developer

This project is developed by a human one-man team, publishing under the name Emendir.
I build open technologies trying to improve our world; learning, working and sharing under the principle:

Freely I have received, freely I give.

Feel welcome to join in with code contributions, discussions, ideas and more!

Open-Source in the Public Domain

I dedicate this project to the public domain. It is open source and free to use, share, modify, and build upon without restrictions or conditions.

I make no patent or trademark claims over this project.

Formally, you may use this project under either the:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ipfs_node-0.1.12rc8-py3-none-win_amd64.whl (24.6 MB view details)

Uploaded Python 3Windows x86-64

ipfs_node-0.1.12rc8-py3-none-manylinux_2_17_x86_64.whl (32.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

ipfs_node-0.1.12rc8-py3-none-manylinux_2_17_aarch64.whl (32.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

ipfs_node-0.1.12rc8-py3-none-macosx_10_9_x86_64.whl (29.6 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

ipfs_node-0.1.12rc8-py3-none-macosx_10_9_universal2.whl (57.2 MB view details)

Uploaded Python 3macOS 10.9+ universal2 (ARM64, x86-64)

ipfs_node-0.1.12rc8-py3-none-macosx_10_9_arm64.whl (27.6 MB view details)

Uploaded Python 3macOS 10.9+ ARM64

ipfs_node-0.1.12rc8-py3-none-android_28_arm64_v8a.whl (32.2 MB view details)

Uploaded Android API level 28+ ARM64 v8aPython 3

File details

Details for the file ipfs_node-0.1.12rc8-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for ipfs_node-0.1.12rc8-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 33c28ee46a603ac4b8ceb3bd674f28ce2a69f9caba16ce8e99abd0464b159d71
MD5 1dc9cf31d4d01cfc6cf2673e6ad1b7d6
BLAKE2b-256 0e4c9f633e0bc4daede41078f210af66cc80aa16f65ee94b3ba7a664406aa9b8

See more details on using hashes here.

File details

Details for the file ipfs_node-0.1.12rc8-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ipfs_node-0.1.12rc8-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fb2e0a8320a8b40d3b7439f0fe25d81bc25f2c82f5c55713d9615943ec508d47
MD5 00d496b42cd63097427843438734649a
BLAKE2b-256 4e142a478de92c9e84a4f85f59b035e229031e3410f0335f2b6f4fe9d57b75de

See more details on using hashes here.

File details

Details for the file ipfs_node-0.1.12rc8-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for ipfs_node-0.1.12rc8-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 991f7e3443089df5e2f8a7a41cbff35e440b4d151ef4d8f2a42c67df268b7d94
MD5 cf839e2d6edeea7df8dbe25d5995e84c
BLAKE2b-256 c254a8e39ebaafae667d233285630124df9dc074113fd952db272ba456492576

See more details on using hashes here.

File details

Details for the file ipfs_node-0.1.12rc8-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ipfs_node-0.1.12rc8-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b96a376331a96959859baf04500a2a4073fcb0dcfbb0eeddc3ce944371077784
MD5 cce6eae162645a655df101b1db183816
BLAKE2b-256 1f099daf9556a44a912f856f44b7d26f0e5f59c7d456a28c832dadcb911ba909

See more details on using hashes here.

File details

Details for the file ipfs_node-0.1.12rc8-py3-none-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for ipfs_node-0.1.12rc8-py3-none-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3d0c84428cd77cadd1d51fd51feaaf332a8e8d8506cd33b39fe4c19fe4f37edf
MD5 8b9da0b2537c243c65e970fb4c16b132
BLAKE2b-256 8d751deb38dd10e46522a8fd50ac811563f4ea10f4ac62a53f814af74e416888

See more details on using hashes here.

File details

Details for the file ipfs_node-0.1.12rc8-py3-none-macosx_10_9_arm64.whl.

File metadata

File hashes

Hashes for ipfs_node-0.1.12rc8-py3-none-macosx_10_9_arm64.whl
Algorithm Hash digest
SHA256 21aef9e452f6b3253e38c5c6a0d34b5cbf999b1c458bc0f8432c6db08a1506b1
MD5 5a4e2418110e13143c4f45c2a84e6ebf
BLAKE2b-256 ec1817babc8bba2fcd92eae14475799aa0f629038e5cd71d9c77a9ea3bc5b9de

See more details on using hashes here.

File details

Details for the file ipfs_node-0.1.12rc8-py3-none-android_28_arm64_v8a.whl.

File metadata

File hashes

Hashes for ipfs_node-0.1.12rc8-py3-none-android_28_arm64_v8a.whl
Algorithm Hash digest
SHA256 540067d7dc5a83c659c0cbfc6afd075478015dadb78b17a68d5eb612f1fb2d8f
MD5 f31f4402f240a2170a3b53840742eec3
BLAKE2b-256 563f481c2fdc8106f2a5a5b6bcb729f675d0d99be276429a1703f330e9a297be

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.12rc8 This release

7 files

0.1.11

2 files

0.1.10

2 files

0.1.9

1 file

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

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