Import python modules by their hash.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
John-Mark Gurney 46e0978548 make cache writing happen... 1 anno fa
casimport make cache writing happen... 1 anno fa
fixtures add registering the writer to the config... 1 anno fa
.gitignore initial work on making a cas importing system... 1 anno fa
LICENSE.txt add license 1 anno fa
Makefile initial work on making a cas importing system... 1 anno fa
NOTES.md minor notes.. 1 anno fa
README.md udpate the readme a bit w/ what I've implemented recently.. 1 anno fa
requirements.txt initial work on making a cas importing system... 1 anno fa
setup.py pull the version info from the module.. 1 anno fa

README.md

casimport

This is a python module that is designed to load Python code from a cryptographic hash. The idea is that instead of having to package up simple code as a Python package, you can import it directly via the hash.

There is the concept of aliases to make the import statements easier to read. This is currently limited to packages. An example is the randpkg in the fixtures directory. You can put a file named cas_aliases.txt along side your init.py file. Each line of the file is:

<alias>	<url>

Where alias is a simple name, and url is a location to find the file at. Currently, at least one hash url must be specified.

The following url schemes are supported:

hash
At least one of these MUST be specified. This is specified at [hash-uri](https://github.com/hash-uri/hash-uri) and currently only a hash value of sha256 is supported.
ipfs
The format follows the [IPFS Addressing](https://github.com/ipfs/in-web-browsers/blob/master/ADDRESSING.md) document, and it is recommend that CIDv1 addresses are used, as the host portion of a URL is case insensitive, and CIDv0 (the current default) values are case sensitive. An example is: `ipfs://bafkreibtbcckul7lwxqz7nyzj3dknhwrdxj5o4jc6gsroxxjhzz46albym`.
https
This is the standard web url that everyone is familar with.

Usage

Top level usage:

import casimport
from cas.v1_f_330884aa2febb5e19fb7194ec6a69ed11dd3d77122f1a5175ee93e73cf0161c3 import hello

print(repr(hello('Alice')))

Defintion of module names in cas package: v__

Currently v1 is defined, and has the following types: f The arg is the hash of the Python source file. Example generated via: shasum -a 256 hello.py a An alias. Any aliases must be loaded before being processed. This is a short name that could be used.

Configuration

By default, a configuration file is read from ~/.casimport/casimport.conf. This specifies the priority of the different modules (do you search IPFS or HTTPS urls first), and configures each of the modules.

The first time you import casimport, a sample configuration will be created. The default is a local cache the home directory, and then to use IPFW gateway, followed by normal https urls.