Skip to main content

stringimporter

stringimporter lets 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 ")

Dependances

None

Compatibility

Python 3. I don’t know (yet?) how to emulate importlib.abc.SourceLoader on Python 2.7.

Release files for stringimporter 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stringimporter 0.1.4
File Size Uploaded
stringimporter-0.1.4.tar.gz 1.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stringimporter 0.1.4
File Interpreter ABI Platform
stringimporter-0.1.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size:4.5 kB

Release files / stringimporter-0.1.4.tar.gz

Download URL stringimporter-0.1.4.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
339306b012ac77046c93b7dcfd93ce84dc3f47cfce645dec87fd7316f32e75a7
BLAKE2b-256 checksum
How to use checksums
07de27ef935a2b63c68755c22acc463a50b9cea6c500cc8d20a3fe7e46a441bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / stringimporter-0.1.4-py2.py3-none-any.whl

Download URL stringimporter-0.1.4-py2.py3-none-any.whl
Size 2.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1a0e6f54ba3e334d733776f0f7fb1d24c449fb56514fe0690cb211150a124706
BLAKE2b-256 checksum
How to use checksums
b382f8b6e0f54fa086bd22edebff32b5262aa43436dd3f3616bb72e5c7543535
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page