{"id":24466241,"url":"https://github.com/tangledgroup/gladius","last_synced_at":"2025-04-13T09:03:43.171Z","repository":{"id":196234383,"uuid":"695289485","full_name":"tangledgroup/gladius","owner":"tangledgroup","description":"Full-stack web apps in Python","archived":false,"fork":false,"pushed_at":"2025-04-07T09:57:05.000Z","size":8805,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T10:24:21.018Z","etag":null,"topics":["full-stack","python","web"],"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/tangledgroup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2023-09-22T19:24:44.000Z","updated_at":"2025-04-07T09:57:08.000Z","dependencies_parsed_at":"2025-03-21T13:24:11.373Z","dependency_job_id":"f2a0b25c-3f91-4af9-a649-861b45a6529f","html_url":"https://github.com/tangledgroup/gladius","commit_stats":null,"previous_names":["mtasic85/gladius","tangledgroup/gladius"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fgladius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fgladius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fgladius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fgladius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangledgroup","download_url":"https://codeload.github.com/tangledgroup/gladius/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248688571,"owners_count":21145766,"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":["full-stack","python","web"],"created_at":"2025-01-21T06:14:01.230Z","updated_at":"2025-04-13T09:03:43.157Z","avatar_url":"https://github.com/tangledgroup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gladius\n\n\u003c!--\n[![Build][build-image]]()\n[![Status][status-image]][pypi-project-url]\n[![Stable Version][stable-ver-image]][pypi-project-url]\n[![Coverage][coverage-image]]()\n[![Python][python-ver-image]][pypi-project-url]\n[![License][mit-image]][mit-url]\n--\u003e\n[![Downloads](https://img.shields.io/pypi/dm/gladius)](https://pypistats.org/packages/gladius)\n[![Supported Versions](https://img.shields.io/pypi/pyversions/gladius)](https://pypi.org/project/gladius)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\u003cimg src=\"https://github.com/mtasic85/gladius/raw/main/misc/logo/logo-1.png\" alt=\"\" style=\"display: block; margin: auto; width: 128px; height: 128px;\" /\u003e\n\n**Gladius** aka \"gladius\" is a library facilitating web application development exclusively in pure **Python**, eliminating the need for HTML, CSS, or JavaScript/TypeScript.\n\nBuilt for developers who want to leverage Python across the entire stack, Gladius provides access to modern web framework features while mirroring patterns familiar to full-stack Python developers.\n\nFor traditional frontend developers, Gladius offers a comfortable transition by exposing all standard Web APIs available in browsers. This ensures compatibility with modern browsers and existing NPM packages (from npmjs), allowing seamless integration of JavaScript (and TypeScript) libraries when needed.\n\nBy unifying frontend and backend development under Python, Gladius delivers a cohesive, intuitive experience, ideal for developers seeking a Python, centric approach without sacrificing access to the broader web ecosystem.\n\n\n## Install\n```bash\npip install gladius[all]\n```\n\n## Hello World\n\nCreate `app.py` file with content:\n\n```python\nfrom gladius import create_app, run_app\n\n\n# required npm packages\nnpm_packages = {\n    '@picocss/pico': ['css/pico.css'],\n    'nprogress': ['nprogress.js', 'nprogress.css'],\n}\n\n# client-side click handler\ndef ready():\n    from gladius import window, document, bind # type: ignore\n\n    NProgress = window.nprogress.default\n\n    btn = document.getElementById('hello-button') # get server-created button\n    clicked = 0                                   # track clicks # noqa\n\n\n    @bind(btn, 'click')\n    def on_click(event):\n        global clicked\n        NProgress.start()\n        clicked += 1 # type: ignore\n        btn.innerText = f'Clicked {clicked} time{\"s\" if clicked !=1 else \"\"}!'\n        NProgress.done()\n\n\n# create simple aiohttp web server\ng, page, app = create_app(\n    npm_packages=npm_packages, # type: ignore\n    ready=ready,\n    app_init_args={\n        'client_max_size': 1024 ** 3,\n    }\n)\n\n# server-side structure\nwith page:\n    with g.body():\n        with g.main(class_='container'):\n            g.h1('Gladius Demo')\n            g.button('Click me!', id='hello-button')    # create button on server\n\n# start application\nif __name__ == '__main__':\n    run_app(app, host='0.0.0.0', port=5000)\n```\n\nRun python app with simple server in background:\n\n```bash\npython -B app.py\n```\n\nOr, in case you want to rebuild on code change:\n\n```bash\npython -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'app:app'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangledgroup%2Fgladius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangledgroup%2Fgladius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangledgroup%2Fgladius/lists"}