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.

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.1.1.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

tomfoolery-1.1.1-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

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