{"id":13738356,"url":"https://github.com/pyrustic/probed","last_synced_at":"2025-10-13T11:10:55.184Z","repository":{"id":57454884,"uuid":"372937202","full_name":"pyrustic/probed","owner":"pyrustic","description":"Probed collections","archived":false,"fork":false,"pushed_at":"2023-02-25T01:40:22.000Z","size":44,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-31T08:59:35.519Z","etag":null,"topics":["collection","dict","event","library","list","probed-dict","probed-list","probed-set","python","set"],"latest_commit_sha":null,"homepage":"https://pyrustic.github.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyrustic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-06-01T19:14:19.000Z","updated_at":"2023-05-19T13:57:11.000Z","dependencies_parsed_at":"2022-09-05T07:12:03.884Z","dependency_job_id":"8c8e889f-0723-4a18-a342-43c9c0c4ec66","html_url":"https://github.com/pyrustic/probed","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"799fd3c570021296e59c91f365ded5ca7680e805"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/pyrustic/probed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fprobed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fprobed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fprobed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fprobed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyrustic","download_url":"https://codeload.github.com/pyrustic/probed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fprobed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264237931,"owners_count":23577665,"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":["collection","dict","event","library","list","probed-dict","probed-list","probed-set","python","set"],"created_at":"2024-08-03T03:02:19.809Z","updated_at":"2025-10-13T11:10:50.165Z","avatar_url":"https://github.com/pyrustic.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Probed collections\n\nThis project is part of the [Pyrustic Open Ecosystem](https://pyrustic.github.io).\n\u003e [Installation](#installation) . [Latest](https://github.com/pyrustic/probed/tags) . [Documentation](https://github.com/pyrustic/probed/tree/master/docs/modules#readme)\n\n\n# Overview\nSometimes you need to know when the content of a data collection has changed.\n\n`Probed` is a library that exposes three classes: `ProbedDict`, `ProbedList` and `ProbedSet`.\n\nThese classes are containers like the built-in Python containers (dict, list, set) which they subclass but with not a twist but two twists:\n\n- be notified when the content of your data collection changes (if you wish to be notified);\n- being able to put a probe into data collection to do more than just be notified.\n\nLet's write a script to see `Probed` in action:\n\n```python\n# script.py\nfrom probed import ProbedList\n\n\ndef on_change(context):\n    msg = \"\\nThe {} operation changed the {} collection\\n{}\"\n    print(msg.format(context.operation, context.container, context.collection))\n\n\nplist = ProbedList(on_change=on_change)\nplist.append(\"hi\")\nplist.insert(1, \"friend\")\n\n```\n\nLet's run the script:\n\n```bash\n$ python3 script.py\n\nThe append operation changed the list collection\n['hi']\n\nThe insert operation changed the list collection\n['hi', 'friend']\n```\n\nNow, let's discover what the `probe` feature does and how to use it:\n\n```python\n# script.py\nfrom probed import ProbedSet\n\n\ndef probe(context):\n    # this probe will lower strings added to the collection\n    # also, the object None isn't allowed in the collection\n    if context.operation == \"add\":\n        if context.item is None:\n            context = None\n        else:\n            context.item = context.item.lower()\n    return context\n\n\npset = ProbedSet(probe=probe)\n# add items\npset.add(\"RED\")\npset.add(None)\npset.add(\"Green\")\n# print\nprint(pset)  # {'red', 'green'}\n\n```\n\nIn the last script, the `probe` was used to control the items added to the data collection.\n\nAll operations that change the contents of the built-in containers are covered by `probed`.\n\n\u003e **Read the [modules documentation](https://github.com/pyrustic/probed/tree/master/docs/modules#readme) !**\n\n# Related project\nThe **Shared** data exchange and persistence library uses `Probed` to implement the `autosave` feature !\n\n\u003e **Discover [Shared](https://github.com/pyrustic/shared) !**\n\n\n\n# Installation\n**Probed** is **cross platform** and versions under **1.0.0** will be considered **Beta** at best. It is built on [Ubuntu](https://ubuntu.com/download/desktop) with [Python 3.8](https://www.python.org/downloads/) and should work on **Python 3.5** or **newer**.\n\n## For the first time\n\n```bash\n$ pip install probed\n```\n\n## Upgrade\n```bash\n$ pip install probed --upgrade --upgrade-strategy eager\n\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n[Back to top](#readme)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrustic%2Fprobed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrustic%2Fprobed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrustic%2Fprobed/lists"}