Skip to main content

🌌🐍 spacesnake - Python decentralized on IPFS

Leveraging decentralized storage technology IPFS for hash-verified Python script/module distribution! Create unstoppable Python applications which can be accessed from anywhere in the universe. Enjoy the assurance that no changes were made to your script (as long as the hash matches).

Contents

Get started

Install from PyPi

pip install spacesnake

Note: Make sure your local IPFS node is running. The easiest way to set up a local IPFS node is by installing IPFS Desktop. By default, spacesnake expects your IPFS node to be at [http://127.0.0.1:5001], but you can override this with the SPACESNAKE_IPFS_NODE_URL environment variable.

Warning: IPFS is still experimental and work in progress. Also, security.

Warning: Always inspect scripts/hashes before you run them. Only run scripts from trusted sources.

To inspect an example "Hello world!" script from IPFS:

spacesnake script QmPzrKNqpMVypixkQDVAQc8MeF8PTuKtnwr91hfE3DAJ6j --inspect

To run an example "Hello world!" script straight from IPFS:

spacesnake script QmPzrKNqpMVypixkQDVAQc8MeF8PTuKtnwr91hfE3DAJ6j

Or importing modules:

import spacesnake # Required for IPFS imports to work
from QmcEuJMSci6SeMUu1xTCtVZmu8FHCnSKUUGp7nav6cuDEj import SnakeSpace

snake = SnakeSpace()
snake.fire_lazers()

Features

  • Import IPFS paths straight from your Python scripts!
  • Run Python scripts and modules straight from IPFS
  • Push your scripts/modules to IPFS to make them available globally and forever.

How it works

  • The spacesnake CLI wraps the runpy module from the Python standard library, with some IPFS-sauce.
  • spacesnake also implements an importer, which takes care of all the IPFS storage and caching magic behind the scenes!

The best way to make sure your script remains available to the world is by sharing with as many people as you can. That way, redundancy across the IPFS network increases for your script or module! Alternatively, you can use pinning services like Pinata to guarantee to some extent your scripts remain available.

Uploading your Python scripts to IPFS

You can use the spacesnake CLI to easily publish a script or module to IPFS, or you can use IPFS desktop to pin the file manually. Using the CLI takes care of import resolution so it makes sure your entire script is published!

Like so:

spacesnake push my_script.py

After confirmation returns the hash of the IPFS pin in stdout:

QmPzrKNqpMVypixkQDVAQc8MeF8PTuKtnwr91hfE3DAJ6j

You can skip confirmation with the -y flag:

spacesnake push my_script.py -y

You can then run the script:

spacesnake QmPzrKNqpMVypixkQDVAQc8MeF8PTuKtnwr91hfE3DAJ6j

To do

  • Add tests!
  • Add IPFS gateway support (eliminates the need for a local IPFS node, but requires a trusted IPFS gateway)
  • Add script encryption/decryption with key or passphrase/password
  • Add IPNS support for pointers to IPFS CIDs

Feedback?

Release files for spacesnake 0.1.0

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

Source distribution (sdist)

Source distribution for spacesnake 0.1.0
File Size Uploaded
spacesnake-0.1.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spacesnake 0.1.0
File Interpreter ABI Platform
spacesnake-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / spacesnake-0.1.0.tar.gz

Download URL spacesnake-0.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c0dac87adc3c8ab20d34e5d60337d182363d8a6365744b8785141d6640b7aaa8
BLAKE2b-256 checksum
How to use checksums
830008f7d14f4a21fd5f3a4259858f6d2564d6676163d0a45942c3706df57b1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Release files / spacesnake-0.1.0-py3-none-any.whl

Download URL spacesnake-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb39f150fa2fe94920f450742b46bb4fcfd26bb459b4ee08a3a06993a7d9da59
BLAKE2b-256 checksum
How to use checksums
9e533cd619f2fd80d1852d0050d75286ed887f7e18458a6e23a7af21afda8afa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release 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