{"id":13486436,"url":"https://github.com/semiversus/python-broqer","last_synced_at":"2026-01-14T11:49:56.917Z","repository":{"id":54841719,"uuid":"127476645","full_name":"semiversus/python-broqer","owner":"semiversus","description":"Carefully crafted library to operate with continuous streams of data in a reactive style with publish/subscribe, asyncio support and broker functionality.","archived":false,"fork":false,"pushed_at":"2025-10-19T10:00:43.000Z","size":874,"stargazers_count":75,"open_issues_count":9,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2026-01-04T04:26:33.598Z","etag":null,"topics":["broker","functional-programming","publish-subscribe","python","reactive"],"latest_commit_sha":null,"homepage":"","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/semiversus.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-03-30T21:58:35.000Z","updated_at":"2025-10-19T10:00:42.000Z","dependencies_parsed_at":"2024-01-18T15:56:33.528Z","dependency_job_id":"fb9dedff-8b0b-46b7-b8e0-35ea44034127","html_url":"https://github.com/semiversus/python-broqer","commit_stats":{"total_commits":800,"total_committers":3,"mean_commits":266.6666666666667,"dds":0.02124999999999999,"last_synced_commit":"49968eaa8819a82c01a9453a4a3780d2e078a0ba"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/semiversus/python-broqer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semiversus%2Fpython-broqer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semiversus%2Fpython-broqer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semiversus%2Fpython-broqer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semiversus%2Fpython-broqer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semiversus","download_url":"https://codeload.github.com/semiversus/python-broqer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semiversus%2Fpython-broqer/sbom","scorecard":{"id":810838,"data":{"date":"2025-08-11","repo":{"name":"github.com/semiversus/python-broqer","commit":"e4ff454488e89b57aefde1b8933f17c9494a13e3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/25 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/deploy.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/semiversus/python-broqer/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/semiversus/python-broqer/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/semiversus/python-broqer/deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/semiversus/python-broqer/deploy.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/deploy.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/semiversus/python-broqer/deploy.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:21","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/deploy.yml:18","Warn: pipCommand not pinned by hash: .github/workflows/deploy.yml:19","Warn: pipCommand not pinned by hash: .github/workflows/deploy.yml:20","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   5 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/deploy.yml:8"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T13:08:28.479Z","repository_id":54841719,"created_at":"2025-08-23T13:08:28.479Z","updated_at":"2025-08-23T13:08:28.479Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["broker","functional-programming","publish-subscribe","python","reactive"],"created_at":"2024-07-31T18:00:45.859Z","updated_at":"2026-01-14T11:49:56.899Z","avatar_url":"https://github.com/semiversus.png","language":"Python","readme":"=======================================\nPython Broqer\n=======================================\n\n.. image:: https://img.shields.io/pypi/v/broqer.svg\n  :target: https://pypi.python.org/pypi/broqer\n\n.. image:: https://readthedocs.org/projects/python-broqer/badge/?version=latest\n  :target: https://python-broqer.readthedocs.io/en/latest\n\n.. image:: https://img.shields.io/github/license/semiversus/python-broqer.svg\n  :target: https://en.wikipedia.org/wiki/MIT_License\n\nInitial focus on embedded systems *Broqer* can be used wherever continuous streams of data have to be processed - and they are everywhere. Watch out!\n\n.. image:: https://cdn.rawgit.com/semiversus/python-broqer/7beb7379/docs/logo.svg\n\n.. header\n\nSynopsis\n========\n\n- Pure python implementation without dependencies\n- Under MIT license (2018 Günther Jena)\n- Source is hosted on GitHub.com_\n- Documentation is hosted on ReadTheDocs.com_\n- Tested on Python 3.7. 3.8, 3.9, 3.10 and 3.11\n- Unit tested with pytest_, coding style checked with Flake8_, static type checked with mypy_, static code checked with Pylint_, documented with Sphinx_\n- Operators known from ReactiveX_ and other streaming frameworks (like Map_, CombineLatest_, ...)\n\n  + Centralised object to keep track of publishers and subscribers\n  + Starting point to build applications with a microservice architecture\n\n.. _pytest: https://docs.pytest.org/en/latest\n.. _Flake8: http://flake8.pycqa.org/en/latest/\n.. _mypy: http://mypy-lang.org/\n.. _Pylint: https://www.pylint.org/\n.. _Sphinx: http://www.sphinx-doc.org\n.. _GitHub.com: https://github.com/semiversus/python-broqer\n.. _ReadTheDocs.com: http://python-broqer.readthedocs.io\n.. _ReactiveX: http://reactivex.io/\n\nShowcase\n========\n\nIn other frameworks a *Publisher* is sometimes called *Oberservable*. A *Subscriber*\nis able to observe changes the publisher is emitting. With these basics you're\nable to use the observer pattern - let's see!\n\nObserver pattern\n----------------\n\nSubscribing to a publisher is done via the .subscribe() method.\nA simple subscriber is ``Sink`` which is calling a function with optional positional\nand keyword arguments.\n\n.. code-block:: python3\n\n    \u003e\u003e\u003e from broqer import Publisher, Sink\n    \u003e\u003e\u003e a = Publisher(5)  # create a publisher with state `5`\n    \u003e\u003e\u003e s = Sink(print, 'Change:')  # create a subscriber\n    \u003e\u003e\u003e disposable = a.subscribe(s)  # subscribe subscriber to publisher\n    Change: 5\n\n    \u003e\u003e\u003e a.notify(3)  # change the state\n    Change: 3\n\n    \u003e\u003e\u003e disposable.dispose()  # unsubscribe\n\nCombine publishers with arithmetic operators\n--------------------------------------------\n\nYou're able to create publishers on the fly by combining two publishers with\nthe common operators (like ``+``, ``\u003e``, ``\u003c\u003c``, ...).\n\n.. code-block:: python3\n\n    \u003e\u003e\u003e a = Publisher(1)\n    \u003e\u003e\u003e b = Publisher(3)\n\n    \u003e\u003e\u003e c = a * 3 \u003e b  # create a new publisher via operator overloading\n    \u003e\u003e\u003e disposable = c.subscribe(Sink(print, 'c:'))\n    c: False\n\n    \u003e\u003e\u003e a.notify(2)\n    c: True\n\n    \u003e\u003e\u003e b.notify(10)\n    c: False\n\nAlso fancy stuff like getting item by index or key is possible:\n\n.. code-block:: python3\n\n    \u003e\u003e\u003e i = Publisher('a')\n    \u003e\u003e\u003e d = Publisher({'a':100, 'b':200, 'c':300})\n\n    \u003e\u003e\u003e disposable = d[i].subscribe(Sink(print, 'r:'))\n    r: 100\n\n    \u003e\u003e\u003e i.notify('c')\n    r: 300\n    \u003e\u003e\u003e d.notify({'c':123})\n    r: 123\n\nSome python built in functions can't return Publishers (e.g. ``len()`` needs to\nreturn an integer). For these cases special functions are defined in broqer: ``Str``,\n``Int``, ``Float``, ``Len`` and ``In`` (for ``x in y``). Also other functions\nfor convenience are available: ``All``, ``Any``, ``BitwiseAnd`` and ``BitwiseOr``.\n\nAttribute access on a publisher is building a publisher where the actual attribute\naccess is done on emitting values. A publisher has to know, which type it should\nmimic - this is done via ``.inherit_type(type)``.\n\n.. code-block:: python3\n\n    \u003e\u003e\u003e i = Publisher('Attribute access made REACTIVE')\n    \u003e\u003e\u003e i.inherit_type(str)\n    \u003e\u003e\u003e disposable = i.lower().split(sep=' ').subscribe(Sink(print))\n    ['attribute', 'access', 'made', 'reactive']\n\n    \u003e\u003e\u003e i.notify('Reactive and pythonic')\n    ['reactive', 'and', 'pythonic']\n\nFunction decorators\n-------------------\n\nMake your own operators on the fly with function decorators. Decorators are\navailable for ``Accumulate``, ``CombineLatest``, ``Filter``, ``Map``, ``MapAsync``,\n``MapThreaded``, ``Reduce`` and ``Sink``.\n\n.. code-block:: python3\n\n    \u003e\u003e\u003e from broqer import op\n    \u003e\u003e\u003e @op.build_map\n    ... def count_vowels(s):\n    ...     return sum([s.count(v) for v in 'aeiou'])\n\n    \u003e\u003e\u003e msg = Publisher('Hello World!')\n    \u003e\u003e\u003e disposable = (msg | count_vowels).subscribe(Sink(print, 'Number of vowels:'))\n    Number of vowels: 3\n    \u003e\u003e\u003e msg.notify('Wahuuu')\n    Number of vowels: 4\n\nYou can even make configurable ``Map`` s and ``Filter`` s:\n\n.. code-block:: python3\n\n    \u003e\u003e\u003e import re\n\n    \u003e\u003e\u003e @op.build_filter_factory\n    ... def filter_pattern(pattern, s):\n    ...     return re.search(pattern, s) is not None\n\n    \u003e\u003e\u003e msg = Publisher('Cars passed: 135!')\n    \u003e\u003e\u003e disposable = (msg | filter_pattern('[0-9]+')).subscribe(Sink(print))\n    Cars passed: 135!\n    \u003e\u003e\u003e msg.notify('No cars have passed')\n    \u003e\u003e\u003e msg.notify('Only 1 car has passed')\n    Only 1 car has passed\n\n\nInstall\n=======\n\n.. code-block:: bash\n\n    pip install broqer\n\nCredits\n=======\n\nBroqer was inspired by:\n\n* RxPY_: Reactive Extension for Python (by Børge Lanes and Dag Brattli)\n* aioreactive_: Async/Await reactive tools for Python (by Dag Brattli)\n* streamz_: build pipelines to manage continuous streams of data (by Matthew Rocklin)\n* MQTT_: M2M connectivity protocol\n* `Florian Feurstein \u003chttps://github.com/flofeurstein\u003e`_: spending hours of discussion, coming up with great ideas and help me understand the concepts!\n\n.. _RxPY: https://github.com/ReactiveX/RxPY\n.. _aioreactive: https://github.com/dbrattli/aioreactive\n.. _streamz: https://github.com/mrocklin/streamz\n.. _MQTT: http://mqtt.org/\n.. _Value: https://python-broqer.readthedocs.io/en/latest/subjects.html#value\n.. _Publisher: https://python-broqer.readthedocs.io/en/latest/publishers.html#publisher\n.. _Subscriber: https://python-broqer.readthedocs.io/en/latest/subscribers.html#subscriber\n.. _CombineLatest: https://python-broqer.readthedocs.io/en/latest/operators/combine_latest.py\n.. _Filter: https://python-broqer.readthedocs.io/en/latest/operators/filter_.py\n.. _Map: https://python-broqer.readthedocs.io/en/latest/operators/map_.py\n.. _MapAsync: https://python-broqer.readthedocs.io/en/latest/operators/map_async.py\n.. _Sink: https://python-broqer.readthedocs.io/en/latest/operators/subscribers/sink.py\n.. _SinkAsync: https://python-broqer.readthedocs.io/en/latest/operators/subscribers/sink_async.py\n.. _OnEmitFuture: https://python-broqer.readthedocs.io/en/latest/subscribers.html#trace\n.. _Trace: https://python-broqer.readthedocs.io/en/latest/subscribers.html#trace\n\n.. api\n\nAPI\n===\n\nPublishers\n----------\n\nA Publisher_ is the source for messages.\n\n+------------------------------------+--------------------------------------------------------------------------+\n| Publisher_ ()                      | Basic publisher                                                          |\n+------------------------------------+--------------------------------------------------------------------------+\n\nOperators\n---------\n\n+-------------------------------------+-----------------------------------------------------------------------------+\n| CombineLatest_ (\\*publishers)       | Combine the latest emit of multiple publishers and emit the combination     |\n+-------------------------------------+-----------------------------------------------------------------------------+\n| Filter_ (predicate, ...)            | Filters values based on a ``predicate`` function                            |\n+-------------------------------------+-----------------------------------------------------------------------------+\n| Map_ (map_func, \\*args, \\*\\*kwargs) | Apply ``map_func(*args, value, **kwargs)`` to each emitted value            |\n+-------------------------------------+-----------------------------------------------------------------------------+\n| MapAsync_ (coro, mode, ...)         | Apply ``coro(*args, value, **kwargs)`` to each emitted value                |\n+-------------------------------------+-----------------------------------------------------------------------------+\n| Throttle (duration)                 | Limit the number of emits per duration                                      |\n+-------------------------------------+-----------------------------------------------------------------------------+\n\nSubscribers\n-----------\n\nA Subscriber_ is the sink for messages.\n\n+----------------------------------+--------------------------------------------------------------+\n| Sink_ (func, \\*args, \\*\\*kwargs) | Apply ``func(*args, value, **kwargs)`` to each emitted value |\n+----------------------------------+--------------------------------------------------------------+\n| SinkAsync_ (coro, ...)           | Apply ``coro(*args, value, **kwargs)`` to each emitted value |\n+----------------------------------+--------------------------------------------------------------+\n| OnEmitFuture_ (timeout=None)     | Build a future able to await for                             |\n+----------------------------------+--------------------------------------------------------------+\n| Trace_ (d)                       | Debug output for publishers                                  |\n+----------------------------------+--------------------------------------------------------------+\n\nValues\n--------\n\n+--------------------------+--------------------------------------------------------------+\n| Value_ (\\*init)          | Publisher and Subscriber                                     |\n+--------------------------+--------------------------------------------------------------+\n","funding_links":[],"categories":["Python","Awesome Functional Python"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemiversus%2Fpython-broqer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemiversus%2Fpython-broqer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemiversus%2Fpython-broqer/lists"}