config_extension
Screen Shot
How to
The function of auto-completion, typing-hinting and docstring is provided taplo
-- an lsp of TOML. After installing taplo and excore init
, you need:
- Run
excore auto-register
. - Run
excore config-extension
.
Code navigation is provided by the an extension of excore, currently only support neovim
. You need:
- Install
excore.nvim
. - Run
excore auto-register
andexcore config-extension
. - Open project by neovim, rum command
ExLoad
to manually load the cached mapping.
Generate Python Type Hints
Run excore generate-typehints
to generate python type hints for modules and isolated objects. You need to specify a config to get the isolated objects. For example:
excore generate-typehints types --class-name ModuleType --info-class-name Info --config ./configs/launch/test_optim.toml
It will generate a python file named types
:
from typing import Union, Any
from excore.config.models import ModuleNode, ModuleWrapper
class ModuleType:
Model: Union[ModuleNode, ModuleWrapper]
TrainData: Union[ModuleNode, ModuleWrapper]
TestData: Union[ModuleNode, ModuleWrapper]
Backbone: Union[ModuleNode, ModuleWrapper]
Loss: Union[ModuleNode, ModuleWrapper]
LRSche: Union[ModuleNode, ModuleWrapper]
Optimizer: Union[ModuleNode, ModuleWrapper]
class Info:
learning_rate: Any
test1: Any
test2: Any
test3: Any
test4: Any
Then you can use them like:
from .types import ModuleType, Info
from excore import config
cfg = config.load("xxx.toml")
modules, run_info = config.build_all(cfg)
modules: ModuleType
run_info: Info