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.1.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for scriputils-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee311542683d6671422583d288acf78832c3505c3dc22d5fee5b461554ba74c2 |
|
MD5 | 62368361e3e2dae158edd590c50465e9 |
|
BLAKE2b-256 | 18964c9d3b9af663a948450b80dea2dd16ff7838e5d8ad3b68414cb32dd44492 |