{"library":"persistence","title":"Persistence","description":"The `Persistence` package (version 5.4) provides a specific variant of the persistent base class, `Persistent`, implemented as an ExtensionClass. It is part of the Zope Foundation ecosystem and is primarily intended for use when ExtensionClass semantics are required. For general-purpose object persistence without these specific semantics, the `persistent.Persistent` class from the `persistent` distribution is typically recommended. The library is mature and receives occasional updates, with its most recent release in November 2025.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install Persistence"],"cli":null},"imports":["from Persistence import Persistent"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from Persistence import Persistent\n\nclass MyPersistentObject(Persistent):\n    def __init__(self, value):\n        self.value = value\n        self.data = []\n\n    def add_data(self, item):\n        self.data.append(item)\n\n# In a real ZODB application, this object would be managed by a Connection/Database.\n# Example: (requires ZODB setup, not runnable standalone for full persistence)\n# from ZODB import DB, FileStorage\n# import transaction\n#\n# storage = FileStorage.FileStorage('my_data.fs')\n# db = DB(storage)\n# conn = db.open()\n# root = conn.root()\n#\n# if 'my_obj' not in root:\n#     root['my_obj'] = MyPersistentObject('initial_value')\n#     transaction.commit()\n#\n# obj = root['my_obj']\n# print(f'Initial value: {obj.value}, Data: {obj.data}')\n# obj.add_data('new_item')\n# obj.value = 'updated_value'\n# transaction.commit()\n#\n# print(f'Updated value: {obj.value}, Data: {obj.data}')\n# conn.close()\n# db.close()","lang":"python","description":"Defines a basic persistent class using `Persistence.Persistent`. Note that for true persistence, this class needs to be instantiated and managed within a ZODB (Zope Object Database) context, which typically involves setting up a storage and connection.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}