sensibleconfig
So you have some configuration variables, and you want them to be available to be in any number of ini-like files, as well as overridable from the environment, and overridable from the command line. Define once, and use.
>>> options = [
... Option('debug', 'Run in debug mode', False,
... short_name='d', converter=bool, action='store_true'),
... ]
>>> conf = Config(options)
>>> conf.debug # Will start as the default value
False
This time we shall pass an env prefix to look up on, so as not to pollute any environment namespace too badly:
>>> conf = Config(options, 'PONY')
>>> conf.grab_from_env({'PONY_DEBUG': '1'})
>>> conf.debug
True
Now we can grab some stuff from argv:
>>> conf = Config(options) >>> conf.grab_from_argv(['--debug']) [] >>> conf.debug True
Also, remember that you can serialize these things:
>>> conf = Config(options)
>>> conf.to_dict()
{'debug': False}
So as you can see above, the options were declared, and then the config object was created from those options. It is imagined that an application may collate the options from many different places, such as plugins which wish to define their own options.
Metadata
Release files for sensibleconfig 0.5
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 |
|---|---|---|---|---|
| sensibleconfig-0.5.tar.gz | 7.1 kB | Without provenance | Details for sensibleconfig-0.5.tar.gz |
Release files / sensibleconfig-0.5.tar.gz
| Download URL | sensibleconfig-0.5.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2faacf220a2d39e8bbd439805da6979a49e7273529f3e8059024180a2fe5eba9
|
|
BLAKE2b-256 checksum How to use checksums |
e3e864159a667f6cedbf728722e81a814f234c09b449ff02ea98ac7b6f128f03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sensibleconfig 0.5
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.