Skip to main content

A pure python object change and history tracker. Monitor all changes in your objects lifecycle and trigger callback functions to capture them.

Project description

object-tracker

A pure python object change and history tracker. Monitor all changes in your objects lifecycle and trigger callback functions to capture them.

View the Github repository and the official docs.

$ pip install object-tracker

Tested for python 3.6, 3.7 and above.

Key Features

  • Determine if a python object has changed.

  • Investigate change history through the changelog.

  • Trigger callback functions whenever the object or an attribute has changed.

  • Simple query interface for object changelog.

License

Copyright (c) Saurabh Pujari
All rights reserved.

This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.

Usage :

from object_tracker import ObjectTracker

 def observer(attr, old, new):
     print(f"Observer : {attr} -> {old} - {new}")

 class User(ObjectTracker):
     def __init__(self, name) -> None:
         self._observers = [observer,]
         self.name = name


 user = User("A")
 print(user._has_changed())
 # False

 user.name = "B" # observers will be triggered
 # Observer : name -> A - B

 print(user._has_changed())
 # True

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

object-tracker-0.1.1.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

object_tracker-0.1.1-py3-none-any.whl (6.4 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