CLI to generate Python dataclasses that model and load toml files (or other can-representated-as-a-dict files)
Project description
tomfoolery
Tool to generate Python dataclasses that model and load toml files (or other can-representated-as-a-dict files).
Primarily aimed at configuration type files.
Installation
Install with:
pip install tomfoolery
Usage
Given the following file (venue.toml
):
Running the command
tomfoolery venue.toml
will produce this file (venue.py
):
which can then be used:
>from venue import Venue >venue = Venue.load() >print(venue.address.city) 'Chicago' >venue.calendar.start_month = "March" >venue.dump()
Current Caveats
- Only works with
.toml
and.json
files. - All keys must be valid Python variable names.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tomfoolery-1.0.1.tar.gz
(5.8 kB
view details)
Built Distribution
File details
Details for the file tomfoolery-1.0.1.tar.gz
.
File metadata
- Download URL: tomfoolery-1.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2e7ad5c6231e263ab315d8cba2ab814cbe869827b6ff5a0c86712213f804f1a |
|
MD5 | 2f2f1c2edce0ab40b2713a56d3c43036 |
|
BLAKE2b-256 | fc881fc1be3845e76b17b99fb293fb69701f9d98af1e27970d005cd7a16cda6a |
File details
Details for the file tomfoolery-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: tomfoolery-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f743475b94584b3dc8289179357d0c5689879273e3b33da310d82bf60a2589cd |
|
MD5 | eb779d32a9ad702dddff135c7ecbbf66 |
|
BLAKE2b-256 | 4b150b18b8fcfe30036a13e4d67db9ba00f01cef94d936270edf9d373628c7d4 |