KvF
The key-value file format with sections
Overview
A config file (config.kvf) with sections encoded with the Paradict text format:
# this comment is part of the
# unnamed section
[section 1]
id = 42
name = 'alex'
books = (dict)
sci-fi = (list)
'book 1'
'book 2'
thriller = (list)
'book 3'
Reading a config file:
import kvf
MY_CONFIG = {"section 1": {"id": 42,
"name": "alex",
"books": {"sci-fi": ["book 1",
"book 2"],
"thriller": ["book 3"]}}}
# read a config file
my_config = kvf.get_config("/path/to/config.kvf")
# my_config is a dictionary object.
# Each key-value item of the dict represents
# a section where the key is the header (string)
# and the value is the body (dictionary)
# test
assert my_config["section 1"] == MY_CONFIG["section 1"]
# load the config from a file object
with open("path/to/config.kvf", "r", encoding="utf-8") as file:
my_config = kvf.load(file)
# test
assert my_config["section 1"] == MY_CONFIG["section 1"]
Writing a config file:
import kvf
MY_CONFIG = {"section 1": {"id": 42,
"name": "alex",
"books": {"sci-fi": ["book 1",
"book 2"],
"thriller": ["book 3"]}}}
# write a config file
kvf.put_config(MY_CONFIG, "path/to/config.kvf")
# write config to a file object
with open("/path/to/config.kvf", "w", encoding="utf-8") as file:
kvf.dump(MY_CONFIG, file)
Testing and contributing
Feel free to open an issue to report a bug, suggest some changes, show some useful code snippets, or discuss anything related to this project. You can also directly email me.
Setup your development environment
Following are instructions to setup your development environment
# create and activate a virtual environment
python -m venv venv
source venv/bin/activate
# clone the project then change into its directory
git clone https://github.com/pyrustic/kvf.git
cd kvf
# install the package locally (editable mode)
pip install -e .
# run tests
python -m tests
# deactivate the virtual environment
deactivate
Installation
KvF is cross-platform. It is built on Ubuntu and should work on Python 3.5 or newer.
Create and activate a virtual environment
python -m venv venv
source venv/bin/activate
Install for the first time
pip install kvf
Upgrade the package
pip install kvf --upgrade --upgrade-strategy eager
Deactivate the virtual environment
deactivate
About the author
Hello world, I'm Alex, a tech enthusiast ! Feel free to get in touch with me !
Metadata
Release files for kvf 0.0.3
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 |
|---|---|---|---|---|
| kvf-0.0.3.tar.gz | 4.9 kB | Without provenance | Details for kvf-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kvf-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for kvf-0.0.3-py3-none-any.whl |
Total release size: 9.7 kB
Release files / kvf-0.0.3.tar.gz
| Download URL | kvf-0.0.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4885b1bbe66c8c20fdabe5cedeb3c0e5d12a54ac495f9e5fcf6fed0e0c51b73
|
|
BLAKE2b-256 checksum How to use checksums |
9cf8e1826c156d4f97cf4662a6110cbbcfd91b5e5570c8a88bf0a8270718621e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Release files / kvf-0.0.3-py3-none-any.whl
| Download URL | kvf-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d666e51cae512e3f95c55b77524e34d0095b278c81f96f7bbc7d37b5bd545c6
|
|
BLAKE2b-256 checksum How to use checksums |
a8db4a8d3b1fef45cabcadf36f9a2231b2cde3dddd3a58ab1723119c7fbce34f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Security for kvf 0.0.3
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.