Dynamic import from files and other sources
Project description
When you just need that code, include does the ugly bits for you. It allows you to run code from files, strings or other sources as if they were regular modules. Code is executed as compliant as possible with the Python ecosystem. The resulting modules and objects can be pickled, copied and sent to other processes. This makes include suitable for testing, configuration, code creation and more.
Usage
include provides a simple API that works similar to the __import__ builtin. To import a module from its file path, pass it to the include.path function:
import include
conf_module = include.path('/etc/myapp/conf.py')
Once a module has been imported by include, it does not require special handling. You can work with the resulting module and its content without using include explicitly.
- note:
The include package must be importable by any python process working with a module imported by include.
Installation
The most recent stable version of include is available from pypi. You can install it using pip:
pip install include
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file include-0.2.2.tar.gz
.
File metadata
- Download URL: include-0.2.2.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37c2c6854f145bce050e75847c8da17039bdfae76d2c7e95bf531eaad2148e69 |
|
MD5 | 61a3d39e3178a656ebe05597889caf31 |
|
BLAKE2b-256 | 44c6a263ccff96cb6c6e4b15c03108f5d8d99f44e0941096d1275bd4adca050a |
File details
Details for the file include-0.2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: include-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58c7d81ba82b92ed432919aaa019bdde7258c569bfd85f1ea44a525576b20529 |
|
MD5 | b40d05a175eb7a8145e9e5df8ebbc280 |
|
BLAKE2b-256 | 0f2c69552fa13f4a1af5a58f5f2a964bfdefdf6614a0d21b141fd9ed24c2776e |