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.4.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for scriputils-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1681c76196cd41c6585d9f252aaa3249d1d261bd853faab112d1047b235cde66 |
|
MD5 | 7c7bd140567aae4e4987ae27ae6b8204 |
|
BLAKE2b-256 | e9d7ed6b6fd2387a2328bdabb013a9dd5c4c7b23ffb2e149529d2c5aa189b5b3 |