{"id":16947032,"url":"https://github.com/mainro/cyclotron-py","last_synced_at":"2025-03-22T13:31:03.501Z","repository":{"id":55200895,"uuid":"119295069","full_name":"MainRo/cyclotron-py","owner":"MainRo","description":"A functional and reactive framework","archived":false,"fork":false,"pushed_at":"2023-02-05T14:46:39.000Z","size":152,"stargazers_count":39,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T11:38:42.138Z","etag":null,"topics":["cyclotron","functional-programming","python","python3","reactive-extensions","reactive-programming","reactivex","rxpy"],"latest_commit_sha":null,"homepage":null,"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/MainRo.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-28T20:29:31.000Z","updated_at":"2024-12-24T17:38:49.000Z","dependencies_parsed_at":"2023-02-19T00:15:30.724Z","dependency_job_id":null,"html_url":"https://github.com/MainRo/cyclotron-py","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainRo%2Fcyclotron-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainRo%2Fcyclotron-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainRo%2Fcyclotron-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainRo%2Fcyclotron-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MainRo","download_url":"https://codeload.github.com/MainRo/cyclotron-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244962766,"owners_count":20539223,"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":["cyclotron","functional-programming","python","python3","reactive-extensions","reactive-programming","reactivex","rxpy"],"created_at":"2024-10-13T21:45:37.994Z","updated_at":"2025-03-22T13:31:03.151Z","avatar_url":"https://github.com/MainRo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===========================\n|cyclotron-logo| Cyclotron\n===========================\n\n.. |cyclotron-logo| image:: https://github.com/mainro/cyclotron-py/raw/master/docs/asset/cyclotron_logo.png\n\nA functional and reactive framework for `RxPY \u003chttps://github.com/ReactiveX/RxPY/\u003e`_.\n\n.. image:: https://github.com/MainRo/cyclotron-py/actions/workflows/ci.yml/badge.svg\n    :target: https://github.com/MainRo/cyclotron-py/actions/workflows/ci.yml\n\n.. image:: https://badge.fury.io/py/cyclotron.svg\n    :target: https://badge.fury.io/py/cyclotron\n\n.. image:: https://readthedocs.org/projects/cyclotron-py/badge/?version=latest\n    :target: https://cyclotron-py.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n\n\n----------------------\n\nWith Cyclotron, you can structure your RxPY code as many reusable components.\nMoreover it naturally encourages to separate pure code and side effects. So a\nCyclotron application is easier to test, maintain, and extend.\n\nHere is the structure of a cyclotron application:\n\n.. figure:: https://github.com/mainro/cyclotron-py/raw/master/docs/asset/cycle.png\n    :width: 60%\n    :align: center\n\nHow to use it\n=============\n\nThe following example is an http echo server:\n\n.. code:: python\n\n    from collections import namedtuple\n\n    from cyclotron import Component\n    from cyclotron.asyncio.runner import run\n    import cyclotron_aiohttp.httpd as httpd\n    import reactivex as rx\n    import reactivex.operators as ops\n\n    EchoSource = namedtuple('EchoSource', ['httpd'])\n    EchoSink = namedtuple('EchoSink', ['httpd'])\n    EchoDrivers = namedtuple('EchoDrivers', ['httpd'])\n\n    def echo_server(source):\n        init = rx.from_([\n            httpd.Initialize(),\n            httpd.AddRoute(methods=['GET'], path='/echo/{what}', id='echo'),\n            httpd.StartServer(host='localhost', port=8080),\n        ])\n\n        echo = source.httpd.route.pipe(\n            ops.filter(lambda i: i.id == 'echo'),\n            ops.flat_map(lambda i: i.request),\n            ops.map(lambda i: httpd.Response(\n                context=i.context,\n                data=i.match_info['what'].encode('utf-8')),\n            )\n        )\n\n        control = rx.merge(init, echo)\n        return EchoSink(httpd=httpd.Sink(control=control))\n\n\n    def main():\n        run(Component(call=echo_server, input=EchoSource),\n            EchoDrivers(httpd=httpd.make_driver()))\n\n\n    if __name__ == '__main__':\n        main()\n\nIn this application, the echo_server function is a pure function, while the http\nserver is implemented as a driver. \n\n.. code::\n\n    pip install cyclotron-aiohttp\n\nyou can then test it with an http client like curl:\n\n.. code::\n\n    $ curl http://localhost:8080/echo/hello\n    hello\n    \n\nInstall\n========\n\nCyclotron is available on PyPi and can be installed with pip:\n\n.. code:: console\n\n    pip install cyclotron\n\nCyclotron automatically uses `uvloop \u003chttps://github.com/MagicStack/uvloop\u003e`_\nif it is available.\n\nThis project is composed of several python packages. Install also the ones that\nyou use in your application:\n\n====================================================================  =========================\nPackage                                                               Version\n====================================================================  =========================\n`cyclotron \u003chttps://github.com/mainro/cyclotron-py\u003e`_                 |pypi-cyclotron|\n`cyclotron-std \u003chttps://github.com/mainro/cyclotron-std\u003e`_            |pypi-cyclotron-std|\n`cyclotron-aiohttp \u003chttps://github.com/mainro/cyclotron-aiohttp\u003e`_    |pypi-cyclotron-aiohttp|\n`cyclotron-aiokafka \u003chttps://github.com/mainro/cyclotron-aiokafka\u003e`_  |pypi-cyclotron-aiokafka|\n`cyclotron-consul \u003chttps://github.com/mainro/cyclotron-consul\u003e`_      |pypi-cyclotron-consul|\n====================================================================  =========================\n\n.. |pypi-cyclotron| image:: https://badge.fury.io/py/cyclotron.svg\n    :target: https://badge.fury.io/py/cyclotron\n\n.. |pypi-cyclotron-aiohttp| image:: https://badge.fury.io/py/cyclotron-aiohttp.svg\n    :target: https://badge.fury.io/py/cyclotron-aiohttp\n\n.. |pypi-cyclotron-std| image:: https://badge.fury.io/py/cyclotron-std.svg\n    :target: https://badge.fury.io/py/cyclotron-std\n\n.. |pypi-cyclotron-aiokafka| image:: https://badge.fury.io/py/cyclotron-aiokafka.svg\n    :target: https://badge.fury.io/py/cyclotron-aiokafka\n\n.. |pypi-cyclotron-consul| image:: https://badge.fury.io/py/cyclotron-consul.svg\n    :target: https://badge.fury.io/py/cyclotron-consul\n\n\nLicense\n=========\n\nThis project is licensed under the MIT License - see the `License\n\u003chttps://github.com/mainro/cyclotron-py/raw/master/LICENSE.txt\u003e`_ file for\ndetails","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmainro%2Fcyclotron-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmainro%2Fcyclotron-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmainro%2Fcyclotron-py/lists"}