Integrated Framework for Configuration
Alternative configuration framework using argparse and configparser. Designed for the following purposes.
- Integration of command line args and configuration files
- Generation of default configuration files
- Class initialization procedure using parameter object pattern
SAMPLE
-
main.py
from ifconf import configure_main if __name__ == "__main__": configure_main() -
server.py
from ifconf import configure_module, config_callback @config_callback def conf(loader): loader.add_attr('server_addr', '0.0.0.0', help='server inet addr to bind') loader.add_attr_int('server_port', 8080, help='server inet port to bind') loader.add_attr_boolean('udp', False, help='True if use UDP otherwise TCP is used.') loader.add_attr_float('val_float', 0.8, help='float test value') loader.add_attr_dict('val_dict', {'a':1,'b':2,'c':3}, help='dict test value') loader.add_attr_list('val_list', [1,2,3], help='list test value') loader.add_attr_path('home', '../', help='path test value') class MyClass: def __init__(self): self.conf = configure_module(conf) self.addr = self.conf.addr self.port = self.conf.port self.conf.logger.info(self.conf) -
config.ini
[server_conf] #addr = 0.0.0.0 port = 8888
config file generation
You can print config.ini template
python -m ifconf server.config
Install
You can install this package by pip
pip3 install ifconf
If you need to use 'mutable' option, install 'recordclass' as well.
pip3 install ifconf recordclass
If you got an error such as 'error: command 'x86_64-linux-gnu-gcc' failed with exit status 1', you need to install build essentials.
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
Metadata
Release files for ifconf 0.0.16
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 | Actions |
|---|---|---|---|---|
| ifconf-0.0.16.tar.gz | 11.8 kB | Without provenance | Details for ifconf-0.0.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ifconf-0.0.16-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for ifconf-0.0.16-py2.py3-none-any.whl |
Total release size: 22.3 kB
Release files / ifconf-0.0.16.tar.gz
| Download URL | ifconf-0.0.16.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
566133fceb3d8a9129913cadd2c8eb6ed3d23d53f9ae53deaca4fe09af46efc0
|
|
BLAKE2b-256 checksum How to use checksums |
604e1af15bc844643e213bb059825f531c2bb33ad7e7b76a4585afd02a4b5b6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.10
|
Release files / ifconf-0.0.16-py2.py3-none-any.whl
| Download URL | ifconf-0.0.16-py2.py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b140e5b70349e3cdcc510f4b6fb2945be6e55d77bb56fb18146b301f7770656e
|
|
BLAKE2b-256 checksum How to use checksums |
74b2b24a400e4e21806fef4ef59a1e62456a64bef370c32e3cf0c9b75bcc62f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.10
|
Security for ifconf 0.0.16
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.