Metadata-Version: 2.1
Name: object-tracker
Version: 1.0.1
Summary: A pure python object change and history tracker. Monitor all changes in your objects lifecycle and trigger callback functions to capture them.
Home-page: https://github.com/saurabh0719/object-tracker
Author: Saurabh Pujari
Author-email: saurabhpuj99@gmail.com
License: three-clause BSD
Project-URL: Documentation, https://github.com/saurabh0719/object-tracker#README
Project-URL: Source, https://github.com/saurabh0719/object-tracker
Keywords: object_tracker,object-tracker,changelog,object history,tracker,change tracker,history
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Description-Content-Type: text/x-rst
License-File: LICENSE

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 <https://github.com/saurabh0719/object-tracker>`__ and the `official docs <https://github.com/saurabh0719/object-tracker#README>`__.

.. code:: sh

    $ 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 and structured API. 
-  Queryable change history log.

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 :
~~~~~~~~~~~~~

.. code:: python

   from object_tracker import ObjectTracker

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

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


    user = User("A")
    print(user.tracker.changed()) 
    # False

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

    print(user.tracker.changed()) 
    # True
