Python import extension metaclass.
Project description
iext
Add new imports tied to a specific class.
Installation
Install this package via pip
:
python -m pip install iext
Usage
To extend the imports within a specific class, subclass ExtendImports
and add an __imports__
method with all the extra imports. Everything imported here will be added to the namespace of self
.
from iext import ExtendImports
class ExampleClass(ExtendImports):
def __imports__(self):
import pkg1
from pkg2 import thing
def example_method(self):
return self.pkg1.func(self.thing)
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
iext-1.1.0.tar.gz
(3.7 kB
view details)
Built Distribution
iext-1.1.0-py3-none-any.whl
(3.7 kB
view details)
File details
Details for the file iext-1.1.0.tar.gz
.
File metadata
- Download URL: iext-1.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.15.1 CPython/3.10.12 Linux/6.5.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2799e6e421339dc889987a9ade973e18c71089d4cb696f354a547295762cc516 |
|
MD5 | ea1803f7ea1c74f6f63e7af1a21def18 |
|
BLAKE2b-256 | 07c33199b6e565e8adfc68fcdf8ffc39dfdb41eec001658110c72c7a87d89417 |
File details
Details for the file iext-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: iext-1.1.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.15.1 CPython/3.10.12 Linux/6.5.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b0bf44b21f79371b9f665cd408e40985273bcf27cd582a70c11961c6da93445 |
|
MD5 | e01f1d1f2e72691278af89b1f2c9f337 |
|
BLAKE2b-256 | 7b896f25edd2e8280bd6558690f9463997351df86abca4751286674a7eb2ac7a |