Yirgachefe
A library for the convenience of configuring environment variables, configuration files, and logger.
Prerequisite
- Python 3.9.x or higher
Quick start
The configuration file format is JSON, and the default location is [CWD]/configure.json.
- CWD: Current working directory (you can get it with 'os.getcwd()')
Example configure.json
{
"API_PORT": 8100,
"STORAGE_ID": "storage_1"
}
Example Code
from yirgachefe import config, logger
logger.debug(config['API_PORT'])
logger.info(config.API_PORT)
config['NEW'] = 'new value'
config.NEW2 = 'new value2'
Custom Usage
Default configure.json.
- This value is set internally and is used even if the file doesn't exist.
- You can use the changed value by explicitly setting it in the file.
{
"debug": true,
"log_level": "DEBUG",
"log_format": "%(asctime)s,%(msecs)03d %(process)d %(thread)d %(levelname)s %(filename)s(%(lineno)d) %(message)s",
"log_path": "Yirgachefe.log",
"log_when": "d",
"log_interval": 1,
"log_backup_count": 5
}
- debug: Set stream handler to logging with coloredlog.
- log_level: Log level for logging.
- log_format: Log format for logging.
- log_path: Write a file log if present (optional)
Optional configuration for RotatingFileHandler.
- yirgachefe supports time-based log file rotating.
- Each option is as follows.
- Rotating works when all values are present.
{
"log_when": "d",
"log_interval": 1,
"log_backup_count": 10
}
- log_when: rotating unit s | m | h | d | w0-w6 (see. 'logging.handler')
- log_interval: rotating period
- log_backup_count: log backup count.
Make and Save configure.json
- After creating an empty config class, you can set the config value and save it as a file.
from yirgachefe import Config
config = Config()
config.NEW = 'new value'
config.write_config()
Metadata
Release files for yirgachefe 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| yirgachefe-0.1.6.tar.gz | 10.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yirgachefe-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / yirgachefe-0.1.6.tar.gz
| Download URL | yirgachefe-0.1.6.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6b121d6bd93ce1df44ec224d574029b1c054dcae13c0479546a93f9bf5e34fe
|
|
BLAKE2b-256 checksum How to use checksums |
d1bb42ae4f75ff8f0274d48b14d9b9df407389971b152a20575d422d88a211b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / yirgachefe-0.1.6-py3-none-any.whl
| Download URL | yirgachefe-0.1.6-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
679f5facd179f7afaf98719a67ce9db97e3682b34a2cbfd5e9f628130b936889
|
|
BLAKE2b-256 checksum How to use checksums |
bf82f7d8a5f1cba1439a718fede99f7e0d2250940f558f2b0522846d3f5eb6df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for yirgachefe 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.