{"id":34077519,"url":"https://github.com/artkra/tranzit","last_synced_at":"2026-05-28T12:32:11.788Z","repository":{"id":53534838,"uuid":"104671351","full_name":"artkra/tranzit","owner":"artkra","description":"Python3 micro web framework based on aiohttp supporting websockets.","archived":false,"fork":false,"pushed_at":"2021-03-25T21:50:40.000Z","size":177,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-16T11:57:04.840Z","etag":null,"topics":["aiohttp","async","python3","web","websocket-server","websockets"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artkra.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}},"created_at":"2017-09-24T19:42:54.000Z","updated_at":"2023-10-05T15:35:20.000Z","dependencies_parsed_at":"2022-08-20T13:20:17.294Z","dependency_job_id":null,"html_url":"https://github.com/artkra/tranzit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/artkra/tranzit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkra%2Ftranzit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkra%2Ftranzit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkra%2Ftranzit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkra%2Ftranzit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artkra","download_url":"https://codeload.github.com/artkra/tranzit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artkra%2Ftranzit/sbom","scorecard":{"id":209625,"data":{"date":"2025-08-11","repo":{"name":"github.com/artkra/tranzit","commit":"c1a9c10c307ead385f6a17c1f4e3fbc599299caf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v2.0: 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":"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"}}]},"last_synced_at":"2025-08-17T00:32:23.814Z","repository_id":53534838,"created_at":"2025-08-17T00:32:23.814Z","updated_at":"2025-08-17T00:32:23.814Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33609237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["aiohttp","async","python3","web","websocket-server","websockets"],"created_at":"2025-12-14T10:06:16.271Z","updated_at":"2026-05-28T12:32:11.771Z","avatar_url":"https://github.com/artkra.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What's that?\n\n_**TRANZIT**_ is an asynchronous micro web framework supporting websockets\n(full duplex socket communication). With **tranzit** you can easily maintain\nboth push \u0026 pull websocket messaging.\n\nIn fact, **tranzit** is a just a tiny wrapper for wonderful\n**aiohttp** lib providing async websocket server (which can be run\nseparately) and a little *CLI* tool.\n \u003c!-- TODO: all the rest of README--\u003e\n## Installation\n\nYou can install **tranzit** via pip:\n\n    $ pip install tranzit\n\n## Quickstart\n\nYou can use *CLI* tool for that:\n\n    $ tranzit project \u003cPROJECT_NAME\u003e\n    $ cd \u003cPROJECT_NAME\u003e\n    $ tranzit run\n\nNow your project runs on http://0.0.0.0:3000/ .\n\nThe first command creates a skeleton project:\n\n```\n\u003cPROJECT_NAME\u003e/\n    __init__.py\n    apps/\n        __init__.py\n        hello/\n            __init__.py\n            static/\n                camel.html\n    common/\n        static/\n            tz.js\n    main.py\n    server.yml\n```\n\nThe main.py file starts the whole thing. It gets configs from\n*server.yml* such as:\n\n* HTTP server host\n* HTTP server port\n* To start websocket server or not\n* Websocket server host\n* Websocket server port\n* Which apps to run\n* Is this a production start or not (not meaningful yet)\n\n\u003e **Info:** You should always pass PROJECT_DIR to *MainServer()*\nconstructor\n\n## Routing and Views\n\nAll routing (for both http requests and websocket requests) is\nhandled by *apps/\\\u003capp_name\u003e/routes.py* file.\n\n`PATH_PREFIX` variable contains prefix for urls handled by this\napplication (like [http://0.0.0.0:3000/\\\u003cPATH_PREFIX\u003e/some_url]).\n\n`APP_STATIC_DIR` variable contains absolute path to the static\nfolder for this application.\n\nAll views for http requests are dispatched by *routes* dict.\nHttp views are ordinary **aiohttp** views.\n\nAll websocket views are dispatched by *ws_rules* dict.\nSee explanation below.\n\n## Middlewares\n\nYou can pass a list of your middlewares in *main.py*:\n```python\nMainServer(\n    'server.yml', PROJECT_DIR, middlewares=[my_middleware]\n)\n```\n\nMore on **aiohttp** middlewares [here](https://docs.aiohttp.org/en/stable/web_advanced.html#middlewares).\n\n## Staticfiles\n\nThere are two types of static files directories in the project skeleton.\n\nThe first is _**\\\u003cPROJECT_NAME\u003e/common/static/**_ . It contains\ncommon project static files and is available via\n\nhttp://0.0.0.0:3000/static/common/YOUR_GLORIOUS.js\n\nThe second type is app-specific:\n_**\\\u003cPROJECT_NAME\u003e/apps/\\\u003cAPP_NAME\u003e/static**_ .\nAs you may suggest, it can be found here:\n\nhttp://0.0.0.0:3000/static/APP_NAME/ANOTHER_GLORIOUS.js\n\n## Few words about websockets\n\nTo establish websocket messaging you must add websocket rule in\napps/\\\u003capp_name\u003e/routes.py file just like that:\n\n```python\nws_rules = {\n    'get_hello': WSPushHandle.get_hello\n}\n```\n\nNow this view is available via websockets.\nTo call this view function, do something like this on the\nclient side:\n\n```javascript\nvar ws = new WebSocket('ws://0.0.0.0:19719');\n\nws.onmessage = function(response) {\n    console.log(response.data);\n};\n\nws.send('get_hello|');\n```\n\nWe send message to call the view.\nHere is an ugly syntax for that message:\n\n`\u003cfunction_name\u003e|arg1, arg2, arg3, ... `\n\nNow take a look at the websocket view:\n\n```python\nclass WSPushHandle(object):\n\n    @staticmethod\n    async def get_hello(*args, **kwargs):\n        send_func = kwargs['send_func']\n        writer = kwargs['writer']\n\n        while True:\n            await asyncio.sleep(1)\n            await send_func(writer, 'HELLO!')\n```\n\nLast line is a way to send message back to the client:\n\n```python\n            await send_func(writer, 'HELLO!')\n```\n\nAs you can see, `send_func` and `writer` instances are accessible via `**kwargs`.\n\n\n\u003e **Warning:** ~~beware of yellow snow!~~ all websocket routes are\nin the same namespace! Avoid collisions.\n\n\u003e **Another warning:** No security provided! Be sure to verify\nwebsocket request (e.g. pass user session key in WS view parameters)\n\n\n\n## Using aiohttp module\n\nAll of `aiohttp.web` module is accessible via `tranzit.web`.\n\n## Starting stand alone websocket server\n\nYou can use websocket server without http server.\n\nAll you need is an instance of:\n\n*tranzit.web.WebSocketServer(host, port, api)*\n\n*api* is a handler class instance which implements 3 functions\nas shown below:\n\n```python\nclass TranzitWSHandler(object):\n\n    async def handle_text(self, loop, writer, msg):\n        pass\n\n    async def handle_binary(self, loop, writer, msg):\n        pass\n\n    async def handle_buffered(self, loop, reader, writer, first_msg):\n        pass\n```\n\nExample starting stand alone websocket server:\n\n```python\nfrom tranzit.web import WebSocketServer\n\n\nclass MyHandler():\n    def __init__(self, rules={}):\n        self.rules = rules\n\n    async def handle_text(self, loop, writer, msg):\n        response = msg.upper()\n\n        await WebSocketServer.send_text(writer, response)\n\n    async def handle_binary(self, loop, writer, msg):\n        pass\n\n    async def handle_buffered(self, loop, reader, writer, first_msg):\n        pass\n\nws_server = WebSocketServer(\n    host='0.0.0.0', port=19719, api=MyHandler()\n)\n\nws_server.run_forever()\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartkra%2Ftranzit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartkra%2Ftranzit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartkra%2Ftranzit/lists"}