From 9d6ec832346a5ccfe968d657f240d27ed0929d87 Mon Sep 17 00:00:00 2001 From: Krzysztof Magusiak Date: Sun, 26 Nov 2023 22:41:06 +0100 Subject: [PATCH] Fix interactive --- README.md | 9 +++++---- alphaconf/interactive.py | 4 ++-- pyproject.toml | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5c8ade9..7bc0ebd 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ alphaconf.setup_configuration({ def main(): log = logging.getLogger() log.info('server.url:', alphaconf.get('server.url')) - log.info('has server.user:', alphaconf.get('server.user', bool)) + log.info('has server.user:', alphaconf.get('server.user', bool, default=False)) if __name__ == '__main__': alphaconf.cli.run(main) @@ -110,6 +110,7 @@ When showing the configuration, by default configuration keys which are secrets, keys or passwords will be masked. Another good practice is to have a file containing the password which you can retrieve using `alphaconf.get('secret_file', 'read_strip')`. +TODO do better than this, also pydantic.SecretStr? ### Invoke integration @@ -125,9 +126,9 @@ alphaconf.invoke.run(__name__, ns) ``` ## Way to 1.0 -- Secret management -- Install completions for bash -- Run a function after importing the module +- Run a specific function `alphaconf.cli.run_module()`: + find functions and parse their args +- Install completions for bash `alphaconf --install-autocompletion` [OmegaConf]: https://omegaconf.readthedocs.io/ [pydantic]: https://docs.pydantic.dev/latest/ diff --git a/alphaconf/interactive.py b/alphaconf/interactive.py index 004b654..53216a7 100644 --- a/alphaconf/interactive.py +++ b/alphaconf/interactive.py @@ -16,10 +16,10 @@ def mount(configuration_paths: List[str] = [], setup_logging: bool = True): application.setup_configuration(configuration_paths=configuration_paths) set_application(application) if setup_logging: - import logging_util + from . import logging_util logging_util.setup_application_logging( - application.configuration.get('logging'), default=None + application.configuration.get('logging', default=None) ) logging.info('Mounted interactive application') diff --git a/pyproject.toml b/pyproject.toml index 9580fbc..af22d06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ requires-python = ">=3.9" classifiers = [ # https://pypi.org/pypi?%3Aaction=list_classifiers "Programming Language :: Python :: 3", - "Development Status :: 3 - Alpha", + "Development Status :: 4 - Beta", "License :: OSI Approved :: BSD License", "Environment :: Console", ]