Skip to main content

A small example package

Project description

JsonHandler

This is a simple package that allows you to store nested Model objects in a JSON file. Completely asynchronous and allows the json file to be edited then rebooted.

Example Usage:

class People(CustomModel):
    name: Name
    age: int

class Name(CustomModel):
    first: str
    last: str
    
class Data(CustomModel):
    people: list[People]

json_handler = JsonHandler(Data, "data.json")

# prints the first name of the first person
if json_handler.data.people:
    print(json_handler.data.people[0].name.first)
else:
    # if there is no data, add some
    json_handler.data.people.append(People(name=Name(first="John", last="Doe"), age=30))

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

jsonhandlerdb-0.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonhandlerdb-0.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file jsonhandlerdb-0.0.1.tar.gz.

File metadata

  • Download URL: jsonhandlerdb-0.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for jsonhandlerdb-0.0.1.tar.gz
Algorithm Hash digest
SHA256 337177e5c44f8e23b41e06c274f568e8df78c37bf07e29fe877b6f528f7a44ea
MD5 4b54f46c9538aebf19e30637a25d140c
BLAKE2b-256 6d1f49f73cd977cc4a6e2507f44106df156a1d1bac58681e45465a8046735da7

See more details on using hashes here.

File details

Details for the file jsonhandlerdb-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: jsonhandlerdb-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for jsonhandlerdb-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e29ddf819f755be0208391c9007f6d7b150299adc41e10c73394a46256d832c
MD5 1a4ddffbb84886a150abd2ff439a5565
BLAKE2b-256 7522b377db052fb983426f6bc891447bff02c944491d04b385a7bab3d6ce4806

See more details on using hashes here.

Supported by

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