{"id":13595346,"url":"https://github.com/Textualize/textual-serve","last_synced_at":"2025-04-09T10:33:27.878Z","repository":{"id":245063313,"uuid":"813157909","full_name":"Textualize/textual-serve","owner":"Textualize","description":"Serve Textual apps locally","archived":false,"fork":false,"pushed_at":"2024-09-10T09:38:53.000Z","size":583,"stargazers_count":232,"open_issues_count":11,"forks_count":10,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-07T14:11:12.726Z","etag":null,"topics":[],"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/Textualize.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-10T15:21:54.000Z","updated_at":"2025-04-06T13:44:50.000Z","dependencies_parsed_at":"2024-06-19T13:48:10.208Z","dependency_job_id":"59241ed6-12e4-485c-a3a4-659fdd902d5d","html_url":"https://github.com/Textualize/textual-serve","commit_stats":null,"previous_names":["textualize/textual-serve"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Textualize%2Ftextual-serve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Textualize%2Ftextual-serve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Textualize%2Ftextual-serve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Textualize%2Ftextual-serve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Textualize","download_url":"https://codeload.github.com/Textualize/textual-serve/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248020593,"owners_count":21034459,"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":[],"created_at":"2024-08-01T16:01:48.279Z","updated_at":"2025-04-09T10:33:27.828Z","avatar_url":"https://github.com/Textualize.png","language":"Python","readme":"# textual-serve\n\nEvery [Textual](https://github.com/textualize/textual) application is now a web application.\n\nWith 3 lines of code, any Textual app can run in the browser.\n\n\n\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003cp\u003eThis is \u003ca href=\"https://github.com/darrenburns/posting\"\u003ePosting\u003c/a\u003e running in the terminal.\u003c/p\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e      \n      \u003cimg src=\"https://github.com/Textualize/textual-serve/assets/554369/14120e6e-bd8c-4620-a9fc-7cf41e3e994b\" width=\"100%\"/\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003cp\u003eThis is \u003ca href=\"https://github.com/darrenburns/posting\"\u003ePosting\u003c/a\u003e running in the \u003cem\u003ebrowser\u003c/em\u003e.\u003c/p\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e    \n      \u003cimg src=\"https://github.com/Textualize/textual-serve/assets/554369/cfa66f9b-02a0-4335-a127-e5a75c6f859d\" width=\"100%\"/\u003e\n    \u003c/td\u003e    \n  \u003c/tr\u003e  \n\u003c/table\u003e\n\n---\n\n## Getting Started\n\nFirst, [install (or upgrade) Textual](https://textual.textualize.io/getting_started/#installation).\n\nThen install `textual-serve` from PyPI:\n\n\n```\npip install textual-serve\n```\n\n## Creating a server\n\nFirst import the Server class:\n\n```python\nfrom textual_serve.server import Server\n```\n\nThen create a `Server` instance and pass the command that launches your Textual app:\n\n```python\nserver = Server(\"python -m textual\")\n```\n\nThe command can be anything you would enter in the shell, as long as it results in a Textual app running.\n\nFinally, call the `serve` method:\n\n```python\nserver.serve()\n```\n\nYou will now be able to click on the link in the terminal to run your app in a browser.\n\n### Summary\n\nRun this code, visit http://localhost:8000\n\n```python\nfrom textual_serve.server import Server\n\nserver = Server(\"python -m textual\")\nserver.serve()\n```\n\n## Configuration\n\nThe `Server` class has the following parameters:\n\n| parameter      | description                                                                        |\n| -------------- | ---------------------------------------------------------------------------------- |\n| command        | A shell command to launch a Textual app.                                           |\n| host           | The host of the web application (defaults to \"localhost\").                         |\n| port           | The port for the web application (defaults to 8000).                               |\n| title          | The title show in the web app on load, leave as `None` to use the command.         |\n| public_url     | The public URL, if the server is behind a proxy. `None` for the local URL.         |\n| statics_path   | Path to statics folder, relative to server.py. Default uses directory in module.   |\n| templates_path | Path to templates folder, relative to server.py. Default uses directory in module. |\n\nThe `Server.serve` method accepts a `debug` parameter.\nWhen set to `True`, this will enable [textual devtools](https://textual.textualize.io/guide/devtools/).\n\n## How does it work?\n\nWhen you visit the app URL, the server launches an instance of your app in a subprocess, and communicates with it via a websocket.\n\nThis means that you can serve multiple Textual apps across all the CPUs on your system.\n\n\nNote that Textual-serve uses a custom protocol to communicate with Textual apps.\nIt *does not* simply expose a shell in your browser.\nThere is no way for a malicious user to do anything the app-author didn't intend.\n\n## See also\n\nSee also [textual-web](https://github.com/Textualize/textual-web) which serves Textual apps on a public URL.\n\nYou can consider this project to essentially be a self-hosted equivalent of Textual-web.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTextualize%2Ftextual-serve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTextualize%2Ftextual-serve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTextualize%2Ftextual-serve/lists"}