The MkInit Module¶
A tool to autogenerate explicit top-level imports
Read the docs |
|
Github |
|
Pypi |
Autogenerates __init__.py files statically and dynamically.
To use the static version simply pip install and run the mkinit command with
the directory corresponding to the package.
The main page for this project is: https://github.com/Erotemic/mkinit
Quick Start¶
Install mkinit via pip install mkinit. Then run:
MOD_INIT_PATH=path/to/repo/module/__init__.py
mkinit "$MOD_INIT_PATH"
This will display autogenerated code that exposes all top-level imports. Use
the --diff option to check differences with existing code, and add the
-w flag to write the result.
Package Layout
- mkinit
- mkinit package
- Subpackages
- Submodules
- mkinit.__main__ module
- mkinit._tokenize module
- mkinit.dynamic_mkinit module
- mkinit.formatting module
- mkinit.static_analysis module
- mkinit.static_mkinit module
- mkinit.top_level_ast module
TopLevelVisitorTopLevelVisitor._register()TopLevelVisitor._unregister()TopLevelVisitor.parse()TopLevelVisitor.visit_FunctionDef()TopLevelVisitor.visit_AsyncFunctionDef()TopLevelVisitor.visit_ClassDef()TopLevelVisitor.visit_Assign()TopLevelVisitor.visit_AnnAssign()TopLevelVisitor.visit_If()TopLevelVisitor.visit_Try()TopLevelVisitor.visit_TryExcept()TopLevelVisitor.visit_Delete()
- Module contents
- mkinit package