An essential utility library for Python scripts, offering robust functions for reading YAML configurations, initializing loggers, and parsing command-line arguments.
Project description
util_kit
An essential utility library for Python scripts, offering robust functions for reading YAML configurations, initializing loggers, and parsing command-line arguments.
Installation
pip install scriputils
Usage in your Python script
from pathlib import Path
from scriputils import get_config, get_logger, get_kwargs
if __name__ == '__main__':
# getting default config path
file_path = Path(__file__)
config_path = file_path.parent / (file_path.stem + '_config.yaml')
kwargs = get_kwargs(config_path).parse_args()
# Read configurations from a YAML file
config = get_config(kwargs.config_path)
LOGGER = get_logger(
logger_name=config['logger_name'],
path=Path("logs"),
level=kwargs.logger_level,
add_stdout=False
)
LOGGER.info("Logger initialized")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scriputils-0.2.3.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for scriputils-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec30656185594a764baffd7a09e7cdc3f1586f03c498ca8a41e0d3e54da986ae |
|
MD5 | a9875dfe9b9bc0c414957315712c0717 |
|
BLAKE2b-256 | d89828a4a0ce0397a640cb9691a302fb51dc5af67c1e27e54227866efd434f14 |