A textual editor and validator for YAML/JSON files against Pydantic models.
Project description
Confantic
Confantic is a lightweight, text-based user interface to edit YAML and JSON configuration files with real-time validation and feedback.
YAML and JSON configuration files are all over the place. For less polished workflows, they can become a sort of "user interface" into the configuration of system. Expecting users to fill out text files to modify configuration is an extremely easy thing to develop, but has obvious UX limitations; the most notable of which is user's often don't know which fields are expected and their constraints. Confantic seeks to address this and take configuration files as UI a little more seriously.
Installation
pip install confantic
Usage
Confantic is built on top of Pydantic to define the configuration model. To use it, you first need a pydantic model to validate against. Lets use this one as an example:
model.py
from pydantic import BaseModel
class ProgramConfig(BaseModel):
name: str
version: str
debug: bool = False
To specify which model to use when editing, you use a Model URI that tells python how to import the model. It supports two different specifications:
- <file path>:<model class> (ex. ./my_folder/my_file.py:MyModel)
- <module path>:<model class> (ex. my_module.my_submodule:MyModel)
Now, we can run the following command to start creating a config:
confantic model.py:ProgramConfig config.json
If the target file (config.json in this case) does not exist, it will populate the editor with some attempted defaults for the field - to at least give you the structure of the model.
If we change some of the fields to create an error, we see the error show up at the bottom:
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 confantic-1.0.0.tar.gz.
File metadata
- Download URL: confantic-1.0.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c267212e49eeed140e79f3a36445d9d08d71114169a03f47e758032e9f636f6f
|
|
| MD5 |
4475c90ffc1c7a216a0a22fb6aafce44
|
|
| BLAKE2b-256 |
d9768640ee60b9ffea3a4efbff815a06a612349c6db1b53ff85f383a279a0768
|
Provenance
The following attestation bundles were made for confantic-1.0.0.tar.gz:
Publisher:
python-publish.yml on Verdant-Evolution/confantic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
confantic-1.0.0.tar.gz -
Subject digest:
c267212e49eeed140e79f3a36445d9d08d71114169a03f47e758032e9f636f6f - Sigstore transparency entry: 873696354
- Sigstore integration time:
-
Permalink:
Verdant-Evolution/confantic@10da2cf5888e9ce5208db47c37e92c4cbe823f3d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Verdant-Evolution
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@10da2cf5888e9ce5208db47c37e92c4cbe823f3d -
Trigger Event:
release
-
Statement type:
File details
Details for the file confantic-1.0.0-py3-none-any.whl.
File metadata
- Download URL: confantic-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.0 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 |
77bdf46276c6d03cfa5310c74ebcb1715ef7855e9eae5b945a73aaa2d5586e42
|
|
| MD5 |
eac73b313d3b1a60d72559171551e7b4
|
|
| BLAKE2b-256 |
1aeb481e5aedbc08d40fa708194395497ad35f25ef45093871e7c0aba2827fe8
|
Provenance
The following attestation bundles were made for confantic-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on Verdant-Evolution/confantic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
confantic-1.0.0-py3-none-any.whl -
Subject digest:
77bdf46276c6d03cfa5310c74ebcb1715ef7855e9eae5b945a73aaa2d5586e42 - Sigstore transparency entry: 873696401
- Sigstore integration time:
-
Permalink:
Verdant-Evolution/confantic@10da2cf5888e9ce5208db47c37e92c4cbe823f3d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Verdant-Evolution
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@10da2cf5888e9ce5208db47c37e92c4cbe823f3d -
Trigger Event:
release
-
Statement type: