A user-preference focused configuration library for Python.
Project description
What is it?

Prefer is a library for helping you manage application configurations while providing your users the flexibility of using whatever configuration format fits their needs.
It provides a set of interfaces which provide standard methods for reading arbitrary project configuration data. This can vary from simple cases like JSON, to more complicated examples - such as retreiving configuration data from a database.
How do I use it?
Firstly, you'll want to install the module. This can be done easily with
easy_install or pip.
easy_install prefer
Prefer is fairly simple to use. A basic use case might be that you have the following JSON configuration in settings.json:
{
"auth": {
"username": "user",
"password": "pass"
}
}
You can load these settings with the following code using promises:
import prefer
configuration = await prefer.load('settings')
username = configration.get('auth.username')
You will notice that prefer only required 'settings' as the filename. It is recommended to be given without a path or extension, because prefer takes care of looking through the filesystem for configuration files. On both Unix and Windows systems, it will look in all of the standard folders, as well as some conventional places where people like to put their configurations.
Ordering matters, so having a file in ./settings.json as well as another in
/etc/settings.json is still reliable. The configuration in ./settings.json
will be used first. Prefer doesn't care what format your user writes your
settings in, so they can also use settings.yaml if they like.
Supported configuration formats
Along with being fully configurable to support any arbitrary data source you'd like, the following types of data can immediately be used as configuration formats upon installation of prefer:
- JSON / JSON5 (with comments, trailing commas, unquoted keys)
- YAML
- INI / CFG
- XML
Why asyncronous?
In order to supply a more-simple method of getting the configuration, many configuration tools prefer to provide a blocking method of retrieving a project configuration. One goal of prefer is to ensure that we aren't limiting users to specific use-cases - and some projects require real-time, dynamic updating of their configuration. Prefer provides all it's interfaces as asyncronous functions in order to provide that possibility without the requirement that those actions are blocking.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prefer-0.2.0.tar.gz.
File metadata
- Download URL: prefer-0.2.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e741498f7c9cee594a7b95d1a0145b7d3bff94a4bf69229d0fd584815341c306
|
|
| MD5 |
2fe956005c94bee973aa44d41acfc91f
|
|
| BLAKE2b-256 |
61af3b6efcfea2919a73a6331fb625a517b6bf2236505dbf4a522e3e4b25d04e
|
Provenance
The following attestation bundles were made for prefer-0.2.0.tar.gz:
Publisher:
deploy.yml on LimpidTech/prefer.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prefer-0.2.0.tar.gz -
Subject digest:
e741498f7c9cee594a7b95d1a0145b7d3bff94a4bf69229d0fd584815341c306 - Sigstore transparency entry: 701406083
- Sigstore integration time:
-
Permalink:
LimpidTech/prefer.py@fb1c8585adc8a29a2ce04ae9a42b66118e69bf93 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/LimpidTech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@fb1c8585adc8a29a2ce04ae9a42b66118e69bf93 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file prefer-0.2.0-py3-none-any.whl.
File metadata
- Download URL: prefer-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2382002d3dedd45e883115a4bc4d033b2f20e7f4090674cd624621d2569684cc
|
|
| MD5 |
2885b61a65cc01150dedf2fa53272706
|
|
| BLAKE2b-256 |
bbe4ef2848bfdec89ee6f76658789adf3d55955fcb07ce44be2cb05ce2a2ccda
|
Provenance
The following attestation bundles were made for prefer-0.2.0-py3-none-any.whl:
Publisher:
deploy.yml on LimpidTech/prefer.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prefer-0.2.0-py3-none-any.whl -
Subject digest:
2382002d3dedd45e883115a4bc4d033b2f20e7f4090674cd624621d2569684cc - Sigstore transparency entry: 701406085
- Sigstore integration time:
-
Permalink:
LimpidTech/prefer.py@fb1c8585adc8a29a2ce04ae9a42b66118e69bf93 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/LimpidTech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@fb1c8585adc8a29a2ce04ae9a42b66118e69bf93 -
Trigger Event:
workflow_dispatch
-
Statement type: