Import python modules by their hash.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
John-Mark Gurney 4a42d2622b pull the version info from the module.. 4 лет назад
casimport add author and license information.. 4 лет назад
fixtures add support for loading via https urls... 4 лет назад
.gitignore initial work on making a cas importing system... 4 лет назад
LICENSE.txt add license 4 лет назад
Makefile initial work on making a cas importing system... 4 лет назад
NOTES.md minor notes.. 4 лет назад
README.md add some more docs for the features that I've added so far.. 4 лет назад
requirements.txt initial work on making a cas importing system... 4 лет назад
setup.py pull the version info from the module.. 4 лет назад

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 (on disk). 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 on hash url that follows the hash-uri format w/ a hash value of sha256. The other supported url type is ipfs. The format follows the IPFS Addressing 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.

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.