Metadata-Version: 2.1
Name: tomfoolery
Version: 0.0.0
Summary: CLI to generate Python dataclasses that model and load toml files (or other can-representated-as-a-dict files)
Project-URL: Homepage, https://github.com/matt-manes/tomfoolery
Project-URL: Documentation, https://github.com/matt-manes/tomfoolery/tree/main/docs
Project-URL: Source code, https://github.com/matt-manes/tomfoolery/tree/main/src/tomfoolery
Author-email: Matt Manes <mattmanes@pm.me>
License-File: LICENSE.txt
Keywords: dataclass,dataclasses,json,toml
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: black
Requires-Dist: dacite
Requires-Dist: pathier
Requires-Dist: pytest
Requires-Dist: typing-extensions
Description-Content-Type: text/markdown

# tomfoolery

Tool to generate Python dataclasses that model and load toml files (or other can-representated-as-a-dict files).<br>
Primarily aimed at configuration type files.

## Installation

Install with:

<pre>
pip install tomfoolery
</pre>


## Usage

Given the following file (`venue.toml`):<br><br>
![](imgs/toml.png)

Running the command
<pre>
tomfoolery venue.toml
</pre>

will produce this file (`venue.py`):<br><br>
![](imgs/dataclass.png)

which can then be used:
<pre>
>from venue import Venue
>venue = Venue.load()
>print(venue.address.city)
'Chicago'
>venue.calendar.start_month = "March"
>venue.dump()
</pre>

### Current Caveats

* Only works with `.toml` and `.json` files.
* All keys must be valid Python variable names.
* If the schema of your original file changes, you can rerun the tool to update the dataclass;
however, anything that you have added or modified will be overwritten.