Skip to main content

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.
  • 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.

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.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

tomfoolery-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tomfoolery-1.0.0.tar.gz.

File metadata

  • Download URL: tomfoolery-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for tomfoolery-1.0.0.tar.gz
Algorithm Hash digest
SHA256 30e47eef9d44f1f2dfd4f1e2232f8dd01bcc26d16bf0ed10e712c26a3dddc005
MD5 983c10e2ff1170209f12bb5e43de57bc
BLAKE2b-256 16cdf21fa6ac7d1978655293cdcde21ec549545d95adfbb1f9c8ebf8327e578b

See more details on using hashes here.

File details

Details for the file tomfoolery-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tomfoolery-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for tomfoolery-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fad8318f5891d939edff55d676378d4c05b9cac4925ece93da9f513dbe2022b7
MD5 10db51343938968ce244edf36e2e1f94
BLAKE2b-256 e2f2f8755f3635dbcf62a21656e85eebb5cd0c6350b41063c4d076db32e34a45

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page