Skip to main content

JSON-backed attribute-persistent object with namespace support

Project description

This is a very simple lib that provides the PersistantObject class, which saves all its attributes to the given json file. Exceptions are attributes suffixed with '_'. Attributes are saved as soon as they are set.

[!IMPORTANT]

morphing actions like appending, inserting, extending, etc. will not automaticly save! so its recomended to create a temp var, then append to it and at the end set the PersistantObject attr to the temp var.

with namespace(NAME) seperate sub namespaces can be created inside the object.

Usage example:

from PersistantObject import PersistantObject

pobject = PersistantObject("save.json")

pobject.first_value = 10
pobject.second_value = "foo"

namespace = pobject.namespace("test_namespace") # creates a new namespace (new subdict in json)
namespace.third_value = [10, 5]

pobject.temp_ = True # suffixed with '_' so it will not be saved and behaves like a normal attribute.

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

persistentobjects-0.1.5.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

persistentobjects-0.1.5-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file persistentobjects-0.1.5.tar.gz.

File metadata

  • Download URL: persistentobjects-0.1.5.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for persistentobjects-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6bb274721b2d0a4280cf5e85c7518b82a825d087b73f6ad9cfa6eafd290b2fc5
MD5 69cca88b058663979dd0dc32f51e12de
BLAKE2b-256 10c1830bd43464491d810c664ebca28c4f1d5800489cdbd76924abfb598db26e

See more details on using hashes here.

File details

Details for the file persistentobjects-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for persistentobjects-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e5f5e8f9739215dcb97c29ec33d939f1550dfde072e81ad751a085e082b41dfd
MD5 1e0eedbd05f9aa6a2af0f422cb53ed2a
BLAKE2b-256 098711df368025bc26ba47002d6dee760652559ee87baaf6197be8bcdc9a43a4

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