Arbitrary import Python source as a Python module
Project description
stringimporter
let’s you import raw string as real Python modules
How to use
You can read the tests (in tests directory) or copy the following code.
import stringimporter
module_from_thin_air = """
def multiply_by_2():
return lambda x: 2*x"""
loader, mymodule = stringimporter.import_str('yihaaa', module_from_thin_air)
hello_2 = mymodule.multiply_by_2()("hello ")
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
stringimporter-0.1.2.tar.gz
(1.6 kB
view hashes)
Built Distribution
Close
Hashes for stringimporter-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76f022ddc6771967a3b64598cd115ac1b8c75226099a78e40cd67b93081eb80b |
|
MD5 | 077a3b90995fdba96431ff54b6980e7f |
|
BLAKE2b-256 | 7769c1840fde54cecde9e4a8c8fc1719b9b5395532b5d67ab853f43e73e57a75 |