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.2.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for scriputils-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ecae91ea7d87abe489f910e969a52292c04418bf8678309a86ae1cdab5a14f |
|
MD5 | 1821735496302414557f6f356d38c814 |
|
BLAKE2b-256 | 77d50a61a8553af6317b062ff717c4b170fb6e50fc831a15f7e866db24fdba93 |