Python decentralized on IFPS
Project description
🌌🐍 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?
- Create an issue, or even better, submit a pull request.
- Send an e-mail to vaneijk.koen@gmail.com.
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
Hashes for spacesnake-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb39f150fa2fe94920f450742b46bb4fcfd26bb459b4ee08a3a06993a7d9da59 |
|
MD5 | 09da86be2bba4216e3ba5cdc4ab2fd0a |
|
BLAKE2b-256 | 9e533cd619f2fd80d1852d0050d75286ed887f7e18458a6e23a7af21afda8afa |