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.dynamic_mkinit module
- mkinit.formatting module
FormatOptionsResolvedFormatOptionsResolvedFormatOptions.with_attrsResolvedFormatOptions.with_modsResolvedFormatOptions.with_allResolvedFormatOptions.relativeResolvedFormatOptions.lazy_importResolvedFormatOptions.lazy_loaderResolvedFormatOptions.lazy_loader_typedResolvedFormatOptions.lazy_boilerplateResolvedFormatOptions.use_blackResolvedFormatOptions.source_order
_ensure_options()_insert_autogen_text()_find_insert_points()_indent()_format_export_literal()_initstr()_make_lazy_boilerplate()codeblock()_make_our_lazy_boilerplate()_make_imports_str()_packed_rhs_text()_make_fromimport_str()
- 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_Delete()
- Module contents
- mkinit package