Generates dynamic bindings for module imports
Project description
A small python utility for auto-completing __all__ and binding sub-modules in __init__.py files.
How to Use
Add these lines to the top of your __init__.py.
import allset allset.set_all_submodules(globals()) allset.bind_all_submodules(globals()) del allset
Now you can reference any sub-module with import mysubmodule or from mysubmodule import SubModClassDef. Additionally, the from mymodule import * will work as though you specified all sub-modules in __all__ manually.
What’s it do?
set_all_submodules sets up you __all__ variable by auto-detecting the files and sub-modules in the current directory.
bind_all_submodules takes the submodules found in set_all_submodules and applies them to the current namespace.
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
File details
Details for the file allset-1.0.1.zip
.
File metadata
- Download URL: allset-1.0.1.zip
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe2d72f4e8ea3c151c399e4953a70acacdfc6c5f502aa756b555196420c0e746 |
|
MD5 | b6f929d51fb4755d6f65930b4732ea1e |
|
BLAKE2b-256 | dccf3236a0dd131e4615e9ef9ff30c2a75a37ae2bc15dfab3562bfe20b1e1311 |