{"id":16345391,"url":"https://github.com/unclechu/py-radio-class","last_synced_at":"2025-07-23T10:33:11.595Z","repository":{"id":57459698,"uuid":"94633146","full_name":"unclechu/py-radio-class","owner":"unclechu","description":"Python library that provides event-bus inspired by backbone.radio","archived":false,"fork":false,"pushed_at":"2017-06-17T18:09:11.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-18T15:44:33.258Z","etag":null,"topics":["backbone","backbone-marionette","class","eventbus","events","library","python","python2","python3"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/radio-class","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/unclechu.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2017-06-17T15:42:58.000Z","updated_at":"2017-06-17T18:05:39.000Z","dependencies_parsed_at":"2022-09-03T22:00:37.829Z","dependency_job_id":null,"html_url":"https://github.com/unclechu/py-radio-class","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/unclechu/py-radio-class","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclechu%2Fpy-radio-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclechu%2Fpy-radio-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclechu%2Fpy-radio-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclechu%2Fpy-radio-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unclechu","download_url":"https://codeload.github.com/unclechu/py-radio-class/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclechu%2Fpy-radio-class/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266171146,"owners_count":23887337,"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":["backbone","backbone-marionette","class","eventbus","events","library","python","python2","python3"],"created_at":"2024-10-11T00:31:25.403Z","updated_at":"2025-07-23T10:33:11.546Z","avatar_url":"https://github.com/unclechu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Radio\n=====\n\nEvent-bus implementation inspired by `backbone.radio`__.\n\n__ https://github.com/marionettejs/backbone.radio\n\nInstall\n-------\n\n.. code:: bash\n\n  pip install radio-class\n\nUsage\n-----\n\nHere are some small examples that demonstrate how to use it:\n\non/off/trigger\n~~~~~~~~~~~~~~\n\n.. code:: python\n\n  from radio import Radio\n  radio = Radio()\n\n  def foo(arg): print('argument:', arg)\n  radio.on('bar', foo) # bind 'foo' handler on 'bar' event\n  radio.trigger('bar', 123) # \"argument: 123\" will be shown in output\n\n  def baz(arg): print('baz handler was triggered')\n  radio.on('bar', baz) # bind another handler on same event\n  radio.trigger('bar', 456) # \"argument: 456\" and then \"baz handler was triggered\" will be shown in output\n\n  radio.off('bar', baz) # unbind previously bound handler\n  radio.trigger('bar', 789) # now only \"argument: 789\" will be shown\n\nonce\n~~~~\n\nYou could bind some handler that automatically unbounds after first trigger.\n\n.. code:: python\n\n  from radio import Radio\n  radio = Radio()\n\n  def foo(arg): print('argument:', arg)\n  radio.once('bar', foo) # bind 'foo' handler on 'bar' event\n  radio.trigger('bar', 123) # \"argument: 123\" will be shown in output\n  radio.trigger('bar', 456) # nothing shown in output\n\nrequest/reply/stopReplying\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n  from radio import Radio\n  radio = Radio()\n\n  def sum(a=5, b=10): return a + b\n  radio.reply('get-sum', sum) # bind 'sum' replier-handler on 'get-sum' requests\n  x = radio.request('get-sum')\n  print(x) # 15 will be shown in output (5 + 10 from default arguments)\n  x = radio.request('get-sum', b=2, a=4)\n  print(x) # 6 will be shown\n  x = radio.request('get-sum', 2)\n  print(x) # 12 will be shown\n  radio.stopReplying('get-sum', sum)\n  radio.request('get-sum') # will raise 'ListenerNotFound' exception\n\nAuthor\n------\n\n`Viacheslav Lotsmanov`__\n\n__ https://github.com/unclechu/\n\nLicense\n-------\n\n`MIT`__\n\n__ LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funclechu%2Fpy-radio-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funclechu%2Fpy-radio-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funclechu%2Fpy-radio-class/lists"}