Import python modules by their hash.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
John-Mark Gurney 11ce7373f8 ignore the build directory.. 8ヶ月前
casimport make cache writing happen... 8ヶ月前
fixtures add registering the writer to the config... 8ヶ月前
.gitignore ignore the build directory.. 8ヶ月前
LICENSE.txt add license 8ヶ月前
Makefile initial work on making a cas importing system... 8ヶ月前 remove things that have been implemented, add new comments.. 8ヶ月前 minor wording changes.. 8ヶ月前
requirements.txt initial work on making a cas importing system... 8ヶ月前 pull the version info from the module.. 8ヶ月前


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. An alias file is currently limited to python packages (modules in a directory w/ an file). An example is the randpkg in the fixtures directory. You can put a file named cas_aliases.txt along side the 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:

At least one of these MUST be specified. The url format is specified by [hash-uri]( and currently only a hash value of sha256 is supported.
The format follows ipfs scheme url as specified by the [IPFS Addressing]( document. 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`.
This is the standard web url that everyone is familar with.


Top level usage:

import casimport
from cas.v1_f_330884aa2febb5e19fb7194ec6a69ed11dd3d77122f1a5175ee93e73cf0161c3 import hello


Defintion of module names in cas package: v__

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


By default, a configuration file is read from ~/.casimport/casimport.conf. The configuration file allows the specification of the priority of the different modules (does casimport search IPFS or HTTPS urls first), and the configuration 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 IPFS gateway, followed by normal https urls.