Name | gladius JSON |
Version |
0.2.8
JSON |
| download |
home_page | https://github.com/tangledgroup/gladius |
Summary | Gladius is a library facilitating web application development exclusively in pure Python |
upload_time | 2025-02-14 15:10:57 |
maintainer | None |
docs_url | None |
author | Tangled Group, Inc |
requires_python | <4.0,>=3.10 |
license | MIT |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# gladius
<!--
[![Build][build-image]]()
[![Status][status-image]][pypi-project-url]
[![Stable Version][stable-ver-image]][pypi-project-url]
[![Coverage][coverage-image]]()
[![Python][python-ver-image]][pypi-project-url]
[![License][mit-image]][mit-url]
-->
[](https://pypistats.org/packages/gladius)
[](https://pypi.org/project/gladius)
[](https://opensource.org/licenses/MIT)
<img src="https://github.com/mtasic85/gladius/raw/main/misc/logo/logo-1.png" alt="" style="display: block; margin: auto; width: 128px; height: 128px;" />
**Gladius** aka "gladius" is a library facilitating web application development exclusively in pure **Python**, eliminating the need for HTML, CSS, or JavaScript/TypeScript.
Built 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. These developers often blend Python on the server with traditional JavaScript/CSS tools for frontend UI—Gladius simplifies this workflow by enabling Python-driven UI development, reducing context-switching between languages.
For traditional frontend developers, Gladius offers a comfortable transition by exposing all standard Web APIs available in browsers. This ensures compatibility with existing NPM packages (from npmjs), allowing seamless integration of JavaScript libraries when needed.
By 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.
## Install
```bash
pip install gladius[all]
```
## Hello World
Create `app.py` file with content:
```python
from aiohttp import web
from gladius.starter import create_aiohttp_app
# required npm packages
npm_packages = {
'@picocss/pico': ['css/pico.css'],
'nprogress': ['nprogress.js', 'nprogress.css'],
}
# client-side click handler
def ready():
from pyscript import when
from pyscript.web import page
from pyscript.js_modules.nprogress import default as NProgress
btn = page['#hello-button'][0] # get server-created button
clicked = 0 # track clicks
@when('click', btn)
def on_click(event):
global clicked
NProgress.start()
clicked += 1
btn.innerText = f'Clicked {clicked} time{"s" if clicked !=1 else ""}!'
NProgress.done()
# create simple aiohttp web server
g, page, app = create_aiohttp_app(
npm_packages=npm_packages, # type: ignore
ready=ready,
)
# server-side structure
with page:
with g.body(x_data=None):
with g.main(class_='container'):
g.h1('Gladius Demo')
g.button('Click me!', id='hello-button') # create button on server
# start application
if __name__ == '__main__':
web.run_app(app, host='0.0.0.0', port=5000)
```
Run python app with simple server in background:
```bash
python -B app.py
```
Or, in case you want to rebuild on code change:
```bash
python -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'app:app'
```
<!--
**Gladius** aka "gladius" is a **full-stack web framework** facilitating web application development exclusively in pure **Python**, eliminating the need for HTML, CSS, or JavaScript. It is built for those who prefer to use Python, providing access to features typically found in modern web frameworks.
In essence, gladius offers a simplified and cohesive development experience, making it a practical choice for developers seeking a Python-centric approach to both frontend and backend development.
## Hello World
```python
# ...
```
## Install
```bash
pip install gladius
```
## Run Examples
```bash
git clone https://github.com/tangledgroup/gladius.git
cd gladius
python -m venv venv
source venv/bin/activate
pip install -U -r requirements.txt
```
```bash
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_preview/app.py
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_tailwind_lite/app.py
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_demo_0/app.py
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_demo_1/app.py
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_demo_2/app.py
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_demo_3/app.py
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_demo_4/app.py
watchmedo auto-restart --directory=./ --pattern="*.py;*.html;*.hbs;*.css;*.js" --recursive -- python -B examples/pico_demo_5/app.py
```
```bash
python -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_1.app:app'
python -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_2.app:app'
python -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_3.app:app'
python -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_4.app:app'
python -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_5.app:app'
```
-->
Raw data
{
"_id": null,
"home_page": "https://github.com/tangledgroup/gladius",
"name": "gladius",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Tangled Group, Inc",
"author_email": "info@tangledgroup.com",
"download_url": "https://files.pythonhosted.org/packages/a4/14/3fa4faa1d29347444b7db5d439db41c6b73d48ea75025c2ee539ce71e192/gladius-0.2.8.tar.gz",
"platform": null,
"description": "# gladius\n\n<!--\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-->\n[](https://pypistats.org/packages/gladius)\n[](https://pypi.org/project/gladius)\n[](https://opensource.org/licenses/MIT)\n\n<img src=\"https://github.com/mtasic85/gladius/raw/main/misc/logo/logo-1.png\" alt=\"\" style=\"display: block; margin: auto; width: 128px; height: 128px;\" />\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. These developers often blend Python on the server with traditional JavaScript/CSS tools for frontend UI\u2014Gladius simplifies this workflow by enabling Python-driven UI development, reducing context-switching between languages.\n\nFor traditional frontend developers, Gladius offers a comfortable transition by exposing all standard Web APIs available in browsers. This ensures compatibility with existing NPM packages (from npmjs), allowing seamless integration of JavaScript libraries when needed.\n\nBy unifying frontend and backend development under Python, Gladius delivers a cohesive, intuitive experience\u2014ideal 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 aiohttp import web\nfrom gladius.starter import create_aiohttp_app\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 pyscript import when\n from pyscript.web import page\n from pyscript.js_modules.nprogress import default as NProgress\n\n btn = page['#hello-button'][0] # get server-created button\n clicked = 0 # track clicks\n\n @when('click', btn)\n def on_click(event):\n global clicked\n NProgress.start()\n clicked += 1\n btn.innerText = f'Clicked {clicked} time{\"s\" if clicked !=1 else \"\"}!'\n NProgress.done()\n\n# create simple aiohttp web server\ng, page, app = create_aiohttp_app(\n npm_packages=npm_packages, # type: ignore\n ready=ready,\n)\n\n# server-side structure\nwith page:\n with g.body(x_data=None):\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 web.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\n<!--\n**Gladius** aka \"gladius\" is a **full-stack web framework** facilitating web application development exclusively in pure **Python**, eliminating the need for HTML, CSS, or JavaScript. It is built for those who prefer to use Python, providing access to features typically found in modern web frameworks.\n\nIn essence, gladius offers a simplified and cohesive development experience, making it a practical choice for developers seeking a Python-centric approach to both frontend and backend development.\n\n## Hello World\n\n```python\n# ...\n```\n\n## Install\n```bash\npip install gladius\n```\n\n## Run Examples\n\n```bash\ngit clone https://github.com/tangledgroup/gladius.git\ncd gladius\npython -m venv venv\nsource venv/bin/activate\npip install -U -r requirements.txt\n```\n\n```bash\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_preview/app.py\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_tailwind_lite/app.py\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_demo_0/app.py\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_demo_1/app.py\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_demo_2/app.py\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_demo_3/app.py\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_demo_4/app.py\nwatchmedo auto-restart --directory=./ --pattern=\"*.py;*.html;*.hbs;*.css;*.js\" --recursive -- python -B examples/pico_demo_5/app.py\n```\n\n```bash\npython -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_1.app:app'\npython -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_2.app:app'\npython -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_3.app:app'\npython -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_4.app:app'\npython -B -u -m gunicorn --reload --bind '0.0.0.0:5000' --timeout 300 --workers 1 --worker-class aiohttp.GunicornWebWorker 'examples.pico_demo_5.app:app'\n```\n-->\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Gladius is a library facilitating web application development exclusively in pure Python",
"version": "0.2.8",
"project_urls": {
"Bug Tracker": "https://github.com/tangledgroup/gladius/issues",
"Documentation": "https://github.com/tangledgroup/gladius",
"Homepage": "https://github.com/tangledgroup/gladius",
"Repository": "https://github.com/tangledgroup/gladius"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7cf073f130256f3f8105498510d5f28573d3d49f86a6fee28dedc02318f21989",
"md5": "4914684ae12dd94beaa9b15cf6d1ee63",
"sha256": "63f851441dc84eb1090dc4d03a9c0b3e6985583faaa0d98643a86d9c8ba13aba"
},
"downloads": -1,
"filename": "gladius-0.2.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4914684ae12dd94beaa9b15cf6d1ee63",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 35542,
"upload_time": "2025-02-14T15:10:55",
"upload_time_iso_8601": "2025-02-14T15:10:55.169218Z",
"url": "https://files.pythonhosted.org/packages/7c/f0/73f130256f3f8105498510d5f28573d3d49f86a6fee28dedc02318f21989/gladius-0.2.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a4143fa4faa1d29347444b7db5d439db41c6b73d48ea75025c2ee539ce71e192",
"md5": "1e23f72824f61d86e6d4a00a48b9aeee",
"sha256": "56edb3b8b84967621772490dab90f0c50436383e849c7f55047c712becb9f659"
},
"downloads": -1,
"filename": "gladius-0.2.8.tar.gz",
"has_sig": false,
"md5_digest": "1e23f72824f61d86e6d4a00a48b9aeee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 36637,
"upload_time": "2025-02-14T15:10:57",
"upload_time_iso_8601": "2025-02-14T15:10:57.111503Z",
"url": "https://files.pythonhosted.org/packages/a4/14/3fa4faa1d29347444b7db5d439db41c6b73d48ea75025c2ee539ce71e192/gladius-0.2.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-14 15:10:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tangledgroup",
"github_project": "gladius",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "gladius"
}