ConfigLite
A lightweight self-healing config handler.
What is ConfigLite?
ConfigLite aims to provide a simple "subclass and go" methodology for handling yaml-based file configs.
Subclass from the base BaseConfig object and add your defaults.
Then, create an instance of your new class, providing a list of paths to search through.
If a config is found at once of these paths, it is used, otherwise a default config is created.
You can then set import this from wherever is needed and access properties.
For more details, see Usage below.
Installation
pypi
ConfigLite is available on pypi!
Simply run pip install configlite to install it in your current environment.
development
If you want to make changes to how configs are handled, you can clone this repo and run pip install -e . to install it in editable mode.
Usage
Creating a Config
There are two methods of creating a config object.
Direct Initialisation
The simplest method to create a config, simply init the BaseConfig class and provide your defaults as an argument:
from configlite import BaseConfig
CONFIG = BaseConfig(
path = "config.yaml",
defaults = {
"value": 10,
...
}
)
As a Class
If you wish to add extra methods, create a subclass of the base BaseConfig object, adding your parameters and their defaults to a defaults field.
For example:
from configlite import BaseConfig
class MyConfig(BaseConfig):
defaults = {
"value": 10,
"name": "test",
"pi": 3.14,
}
You must still initialise the config, however:
CONFIG = MyConfig(path="config.yaml")
Access
To use your created config, there are two methods:
- "globally", where a single instance created.
- "locally", initialising the class where needed.
Global
To create a global config, set up the config as a parameter in the toplevel __init__.py:
CONFIG = MyConfig("./path/to/config.yaml")
Then in the rest of your code you may import this object:
from my_package import CONFIG
value = CONFIG.value
This is most useful if your code requires a single config file for everything.
Local
Or a local config, where you create an instance of your subclass wherever it is needed:
from my_package import MyConfig
config = MyConfig("./path/to/config.yaml")
value = config.value
This can be useful if you are juggling multiple different config files dynamically.
Paths
The BaseConfig object can take either a single path, or a list of paths.
If a list is passed, the config will search each one in order, using the last one in the list if none are found.
Path Lists
Lets say you create a config this way:
class Config(BaseConfig):
...
CONFIG = Config(
paths=[
"config.yaml",
"~/.config/app/config.yaml",
]
)
In this case, Config will take these steps:
- Search for
config.yamlin the current working directory. - If not found, search for
~/.config/app/config.yaml. - If still no file exists, create a default config at
~/.config/app/config.yaml
If we get to step 3, but then create a new config at ./config.yaml, this will take priority over the one found at ~/.config/app/config.yaml.
Environment Overrides
You may also set a prefix property, which enables environment overrides.
If we take our config from earlier, but add this feature:
class MyConfig(BaseConfig):
defaults = {
"value": 10,
"name": "test",
"pi": 3.14,
}
prefix = "test_prefix"
Now, on initialisation, the config will search for environment variables starting with test_prefix
If we export test_prefix_value="foo", we will see the changes:
cfg = MyConfig(...)
cfg.value
> "foo"
Example
See usage.py for an example.
Metadata
Release files for configlite 0.2.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 | |
|---|---|---|---|---|
| configlite-0.2.6.tar.gz | 10.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| configlite-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / configlite-0.2.6.tar.gz
| Download URL | configlite-0.2.6.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc0d792217e3455a475f739b4447340a640d93a6e4361ff54f70a7f27055a38b
|
|
BLAKE2b-256 checksum How to use checksums |
dd2c93fca485b7f33045e72370c8e9079682a3ca194b0f529f317611e7da3dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.
Transparency logRelease files / configlite-0.2.6-py3-none-any.whl
| Download URL | configlite-0.2.6-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2af38746c7a30970dc66dfc9af5939c597b2943625436a366050334501c6a70f
|
|
BLAKE2b-256 checksum How to use checksums |
fa96c3563b017d3b04af76ebb174ebe1e558884208a2ccd178f7d4557dcbaeda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.
Transparency logSecurity for configlite 0.2.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for configlite-0.2.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.
Transparency logA 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.