{"id":15581862,"url":"https://github.com/1kbgz/bigbrother","last_synced_at":"2025-09-06T15:32:19.823Z","repository":{"id":151442216,"uuid":"624063261","full_name":"timkpaine/bigbrother","owner":"timkpaine","description":"An evil, awful, terrible, no-good library for watching objects for mutation. Do not use this library.","archived":false,"fork":false,"pushed_at":"2024-12-01T05:23:17.000Z","size":60,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-29T14:51:41.838Z","etag":null,"topics":["observability","observer","observer-pattern","pydantic","python","python3","reactive"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timkpaine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-05T17:04:53.000Z","updated_at":"2024-12-01T05:23:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"71f6388e-389a-4f22-8f67-c4a18e456f7f","html_url":"https://github.com/timkpaine/bigbrother","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkpaine%2Fbigbrother","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkpaine%2Fbigbrother/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkpaine%2Fbigbrother/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkpaine%2Fbigbrother/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timkpaine","download_url":"https://codeload.github.com/timkpaine/bigbrother/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232130340,"owners_count":18476788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["observability","observer","observer-pattern","pydantic","python","python3","reactive"],"created_at":"2024-10-02T19:58:06.464Z","updated_at":"2025-09-06T15:32:19.782Z","avatar_url":"https://github.com/timkpaine.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bigbrother\nAn evil, awful, terrible, no-good library for watching objects for mutation. Do not use this library.\n\n[![Build Status](https://github.com/1kbgz/bigbrother/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/1kbgz/bigbrother/actions?query=workflow%3A%22Build+Status%22)\n[![Coverage](https://codecov.io/gh/1kbgz/bigbrother/branch/main/graph/badge.svg)](https://codecov.io/gh/1kbgz/bigbrother)\n[![License](https://img.shields.io/github/license/1kbgz/bigbrother)](https://github.com/1kbgz/bigbrother)\n[![PyPI](https://img.shields.io/pypi/v/bigbrother.svg)](https://pypi.python.org/pypi/bigbrother)\n\n## Overview\n`bigbrother` is a mutation observer library. You can use it to watch your objects for changes. When your object changes, `bigbrother` will trigger your choice of callback.\n\n\n```python\nx = {1: \"a\", 2: \"b\", 3: \"c\"}\n\ndef track_changes(obj, method, ref, call_args, call_kwargs):\n    print(f\"method: {method}, args: {args}, kwargs: {kwargs}\")\n\nx = watch(x, track_changes)\n\nx[1] = \"x\"\n\n# prints: method: setitem, args: (1, 'x'), kwargs: {}\n```\n\n`bigbrother` can also embed itself recursively in your object by passing in argument `deepstate=True`.\n\n\n## Callback\n\n```python\ndef callback(obj, method, ref, call_args, call_kwargs):\n    '''Callback called when object is mutated\n\n    Args:\n        obj (Any): The object being mutated via `method`\n        method (str): The method called on the object (dunders removed)\n        ref (Any): Reference object. If callback installed recursively, `ref` will be the entrypoint\n        call_args (Tuple[Any]): Positional arguments that `method` was called with on `obj`\n        call_kwargs (Dict[Any, Any]): Keyword arguments that `method` was called with on `obj`\n    '''\n```\n\n\n## Supported types\n\n### Builtins\nMost builtin types are read-only and cannot have their method structure mutated, so we observe via replacement with thin wrappers.\n\n- `list` via `_ObservedList`\n    - `append`\n    - `clear`\n    - `extend`\n    - `insert`\n    - `pop`\n    - `remove`\n    - `sort`\n    - `__setattr__`\n    - `__setitem__`\n- `dict` via `_ObservedDict`\n    - `clear`\n    - `pop`\n    - `popitem`\n    - `update`\n    - `__setattr__`\n    - `__setitem__`\n- `set` via `_ObservedSet`\n    - `add`\n    - `clear`\n    - `difference_update`\n    - `discard`\n    - `intersection_update`\n    - `pop`\n    - `remove`\n    - `symmetric_difference_update`\n    - `update`\n    - `__setattr__`\n\n\n### Libraries\n- `pydantic.BaseModel`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1kbgz%2Fbigbrother","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1kbgz%2Fbigbrother","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1kbgz%2Fbigbrother/lists"}