gramlot-py-server 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. gramlot_py_server-0.2.1/.gitignore +13 -0
  2. gramlot_py_server-0.2.1/LICENSE +176 -0
  3. gramlot_py_server-0.2.1/NOTICE +8 -0
  4. gramlot_py_server-0.2.1/PKG-INFO +266 -0
  5. gramlot_py_server-0.2.1/README.md +229 -0
  6. gramlot_py_server-0.2.1/docs/005-introduction.md +165 -0
  7. gramlot_py_server-0.2.1/docs/010-writing-pages.md +149 -0
  8. gramlot_py_server-0.2.1/docs/015-troubleshooting.md +110 -0
  9. gramlot_py_server-0.2.1/docs/105-tutorial.md +188 -0
  10. gramlot_py_server-0.2.1/docs/110-configuration.md +104 -0
  11. gramlot_py_server-0.2.1/docs/115-deployment.md +91 -0
  12. gramlot_py_server-0.2.1/docs/120-reference.md +74 -0
  13. gramlot_py_server-0.2.1/docs/205-django.md +157 -0
  14. gramlot_py_server-0.2.1/docs/305-flask.md +149 -0
  15. gramlot_py_server-0.2.1/docs/405-fastapi.md +158 -0
  16. gramlot_py_server-0.2.1/docs/505-kajenn.md +153 -0
  17. gramlot_py_server-0.2.1/docs/_static/gramlot-logo.png +0 -0
  18. gramlot_py_server-0.2.1/docs/conf.py +25 -0
  19. gramlot_py_server-0.2.1/docs/index.rst +58 -0
  20. gramlot_py_server-0.2.1/docs/internal/905-architecture.md +68 -0
  21. gramlot_py_server-0.2.1/docs/internal/910-verification.md +49 -0
  22. gramlot_py_server-0.2.1/docs_llm/005-introduction.md +165 -0
  23. gramlot_py_server-0.2.1/docs_llm/010-writing-pages.md +149 -0
  24. gramlot_py_server-0.2.1/docs_llm/015-troubleshooting.md +110 -0
  25. gramlot_py_server-0.2.1/docs_llm/105-tutorial.md +188 -0
  26. gramlot_py_server-0.2.1/docs_llm/110-configuration.md +104 -0
  27. gramlot_py_server-0.2.1/docs_llm/115-deployment.md +91 -0
  28. gramlot_py_server-0.2.1/docs_llm/120-reference.md +74 -0
  29. gramlot_py_server-0.2.1/docs_llm/205-django.md +157 -0
  30. gramlot_py_server-0.2.1/docs_llm/305-flask.md +149 -0
  31. gramlot_py_server-0.2.1/docs_llm/405-fastapi.md +158 -0
  32. gramlot_py_server-0.2.1/docs_llm/505-kajenn.md +153 -0
  33. gramlot_py_server-0.2.1/docs_llm/conf.py +8 -0
  34. gramlot_py_server-0.2.1/docs_llm/index.md +52 -0
  35. gramlot_py_server-0.2.1/docs_llm/internal/905-architecture.md +68 -0
  36. gramlot_py_server-0.2.1/docs_llm/internal/910-verification.md +49 -0
  37. gramlot_py_server-0.2.1/examples/django/settings.py +8 -0
  38. gramlot_py_server-0.2.1/examples/django/urls.py +15 -0
  39. gramlot_py_server-0.2.1/examples/fastapi/app.py +15 -0
  40. gramlot_py_server-0.2.1/examples/flask/app.py +15 -0
  41. gramlot_py_server-0.2.1/examples/kajenn/config.py +21 -0
  42. gramlot_py_server-0.2.1/examples/pages/greeting.css +2 -0
  43. gramlot_py_server-0.2.1/examples/pages/greeting.py +13 -0
  44. gramlot_py_server-0.2.1/examples/pages/greeting_aux.js +5 -0
  45. gramlot_py_server-0.2.1/examples/pages/hello.py +13 -0
  46. gramlot_py_server-0.2.1/examples/uvicorn/app.py +11 -0
  47. gramlot_py_server-0.2.1/pyproject.toml +62 -0
  48. gramlot_py_server-0.2.1/src/gramlot_py_server/__init__.py +2 -0
  49. gramlot_py_server-0.2.1/src/gramlot_py_server/django.py +156 -0
  50. gramlot_py_server-0.2.1/src/gramlot_py_server/fastapi.py +191 -0
  51. gramlot_py_server-0.2.1/src/gramlot_py_server/flask.py +159 -0
  52. gramlot_py_server-0.2.1/src/gramlot_py_server/kajenn.py +177 -0
  53. gramlot_py_server-0.2.1/src/gramlot_py_server/py.typed +0 -0
  54. gramlot_py_server-0.2.1/src/gramlot_py_server/uvicorn.py +239 -0
  55. gramlot_py_server-0.2.1/tests/conftest.py +48 -0
  56. gramlot_py_server-0.2.1/tests/django/test_django.py +172 -0
  57. gramlot_py_server-0.2.1/tests/django/test_django_examples.py +50 -0
  58. gramlot_py_server-0.2.1/tests/fastapi/test_fastapi.py +115 -0
  59. gramlot_py_server-0.2.1/tests/fastapi/test_fastapi_examples.py +17 -0
  60. gramlot_py_server-0.2.1/tests/flask/test_flask.py +116 -0
  61. gramlot_py_server-0.2.1/tests/flask/test_flask_examples.py +16 -0
  62. gramlot_py_server-0.2.1/tests/kajenn/test_kajenn.py +196 -0
  63. gramlot_py_server-0.2.1/tests/kajenn/test_kajenn_examples.py +24 -0
  64. gramlot_py_server-0.2.1/tests/test_readme.py +21 -0
  65. gramlot_py_server-0.2.1/tests/uvicorn/test_asgi.py +171 -0
  66. gramlot_py_server-0.2.1/tests/uvicorn/test_uvicorn_examples.py +52 -0
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .coverage
5
+ coverage.xml
6
+ htmlcov/
7
+ docs/_build/
8
+ build/
9
+ dist/
10
+ *.egg-info/
11
+ .venv/
12
+
13
+ .DS_Store
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,8 @@
1
+ Gramlot Uvicorn
2
+ Copyright 2026 Softwell S.r.l.
3
+
4
+ This product includes software developed at Softwell S.r.l.
5
+ (https://www.softwell.it/). It is an adapter for Gramlot,
6
+ Copyright 2025-2026 Softwell S.r.l., Apache License 2.0.
7
+
8
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.5
2
+ Name: gramlot-py-server
3
+ Version: 0.2.1
4
+ Summary: Python server adapters for Gramlot pages: Uvicorn, Django, Flask, FastAPI and Kajenn
5
+ Project-URL: Homepage, https://github.com/gramlot-org/gramlot-py-server
6
+ Project-URL: Repository, https://github.com/gramlot-org/gramlot-py-server
7
+ Project-URL: Issues, https://github.com/gramlot-org/gramlot-py-server/issues
8
+ Project-URL: Documentation, https://gramlot-py-server.readthedocs.io/
9
+ Author-email: Genropy Team <info@softwell.it>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: gramlot>=0.2.1
15
+ Provides-Extra: django
16
+ Requires-Dist: asgiref<4,>=3.8.1; extra == 'django'
17
+ Requires-Dist: django<6.2,>=5.2; extra == 'django'
18
+ Provides-Extra: docs
19
+ Requires-Dist: myst-parser==5.1.0; extra == 'docs'
20
+ Requires-Dist: sphinx-rtd-theme==3.1.0; extra == 'docs'
21
+ Requires-Dist: sphinx==8.2.3; extra == 'docs'
22
+ Provides-Extra: fastapi
23
+ Requires-Dist: fastapi>=0.115; extra == 'fastapi'
24
+ Provides-Extra: flask
25
+ Requires-Dist: flask<4,>=3.1; extra == 'flask'
26
+ Provides-Extra: kajenn
27
+ Requires-Dist: kajenn>=0.1.0; extra == 'kajenn'
28
+ Provides-Extra: test
29
+ Requires-Dist: genro-tytx[msgpack]; extra == 'test'
30
+ Requires-Dist: httpx>=0.27; extra == 'test'
31
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
32
+ Requires-Dist: pytest-cov>=4.0; extra == 'test'
33
+ Requires-Dist: pytest>=7.0; extra == 'test'
34
+ Provides-Extra: uvicorn
35
+ Requires-Dist: uvicorn>=0.30; extra == 'uvicorn'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # gramlot-py-server
39
+
40
+ [![tests](https://github.com/gramlot-org/gramlot-py-server/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/gramlot-org/gramlot-py-server/actions/workflows/tests.yml)
41
+ [![Coverage](https://codecov.io/gh/gramlot-org/gramlot-py-server/branch/main/graph/badge.svg)](https://app.codecov.io/gh/gramlot-org/gramlot-py-server)
42
+ [![Documentation](https://readthedocs.org/projects/gramlot-py-server/badge/?version=latest)](https://gramlot-py-server.readthedocs.io/en/latest/)
43
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue)](LICENSE)
44
+
45
+ Gramlot describes web interfaces in Python or JavaScript and keeps them bound to
46
+ application state in the browser. See
47
+ [The Gramlot family](https://gramlot.readthedocs.io/en/latest/docs/public/055-family.html)
48
+ for the core and the other repositories.
49
+
50
+ ## What this repository is
51
+
52
+ `gramlot-py-server` serves Gramlot pages written in Python from a Python web
53
+ server. One package holds one adapter per framework; each comes with its extra:
54
+
55
+ | Extra | Module | Names |
56
+ | --- | --- | --- |
57
+ | `uvicorn` | `gramlot_py_server.uvicorn` | `Application`, `create_application(pages, **options)`: an ASGI application for Uvicorn or any ASGI server |
58
+ | `django` | `gramlot_py_server.django` | `Pages`: its `urls` go into a URLconf |
59
+ | `flask` | `gramlot_py_server.flask` | `Pages`, `mount_pages(app, pages, **options)` |
60
+ | `fastapi` | `gramlot_py_server.fastapi` | `Pages`, `mount_pages(app, pages, **options)`, `Application` |
61
+ | `kajenn` | `gramlot_py_server.kajenn` | `Application`: a Kajenn routed application |
62
+
63
+ Every adapter serves one folder of `Page` modules through the core `FileHost`:
64
+ it sends the bootstrap document, answers the main and remote Source requests,
65
+ serves the page companions (`.css` and `_aux.js`) and the browser runtime, with
66
+ a mount prefix and a Content Security Policy of your choice. It does not serve
67
+ JavaScript pages
68
+ ([gramlot-js-server](https://github.com/gramlot-org/gramlot-js-server) does)
69
+ and it does not talk to a database.
70
+
71
+ ## Quick start
72
+
73
+ Python 3.11 or later. Install the package with the extra of your framework:
74
+
75
+ ```sh
76
+ python -m pip install "gramlot-py-server[uvicorn]"
77
+ ```
78
+
79
+ Create a folder `pages` and write `pages/hello.py`:
80
+
81
+ ```python
82
+ from gramlot import Page as BasePage
83
+
84
+
85
+ class Page(BasePage):
86
+ title = "Hello"
87
+
88
+ def main(self, root):
89
+ pane = root.div(datapath="person")
90
+ pane.html_label("Name", for_="name")
91
+ pane.input(id="name", value="^.name", live=True)
92
+ pane.p("^.greeting")
93
+ pane.dataFormula(".greeting", "'Hello, ' + name", name="^.name", _init=True)
94
+ pane.dataSetter(".name", "Ada")
95
+ ```
96
+
97
+ The formula of this page is inline code, so every example below sends the
98
+ permissive Content Security Policy profile. Each one lives in
99
+ [`examples/`](examples/), beside a folder `pages`; the docstring of each file
100
+ gives the command that starts it. The page opens at
101
+ <http://127.0.0.1:8000/hello>, on port 5000 for the Flask development server.
102
+ FastAPI needs a server: install `gramlot-py-server[fastapi,uvicorn]`.
103
+
104
+ Uvicorn, `examples/uvicorn/app.py`:
105
+
106
+ ```python
107
+ """Serve the example pages with Uvicorn: ``uvicorn app:application``."""
108
+ from pathlib import Path
109
+
110
+ from gramlot_py_server.uvicorn import create_application
111
+
112
+ PAGES = Path(__file__).resolve().parents[1] / "pages"
113
+
114
+ application = create_application(
115
+ PAGES,
116
+ content_security_policy="script-src 'nonce-{nonce}' 'unsafe-eval'; object-src 'none'; base-uri 'none'",
117
+ )
118
+ ```
119
+
120
+ Django, `examples/django/settings.py` and `examples/django/urls.py`:
121
+
122
+ ```python
123
+ """Django settings of the example: ``django-admin runserver --settings=settings --pythonpath=.``."""
124
+
125
+ SECRET_KEY = "example-only-change-me"
126
+ DEBUG = True
127
+ ALLOWED_HOSTS = ["127.0.0.1", "localhost", "testserver"]
128
+ ROOT_URLCONF = "urls"
129
+ INSTALLED_APPS: list[str] = []
130
+ MIDDLEWARE = ["django.middleware.csrf.CsrfViewMiddleware"]
131
+ ```
132
+
133
+ ```python
134
+ """URLconf of the example: the Gramlot pages at the site root."""
135
+ from pathlib import Path
136
+
137
+ from django.urls import include, path
138
+
139
+ from gramlot_py_server.django import Pages
140
+
141
+ PAGES = Path(__file__).resolve().parents[1] / "pages"
142
+
143
+ pages = Pages(
144
+ PAGES,
145
+ content_security_policy="script-src 'nonce-{nonce}' 'unsafe-eval'; object-src 'none'; base-uri 'none'",
146
+ )
147
+
148
+ urlpatterns = [path("", include(pages.urls))]
149
+ ```
150
+
151
+ Flask, `examples/flask/app.py`:
152
+
153
+ ```python
154
+ """Serve the example pages inside a Flask app: ``flask --app app run``."""
155
+ from pathlib import Path
156
+
157
+ from flask import Flask
158
+
159
+ from gramlot_py_server.flask import mount_pages
160
+
161
+ PAGES = Path(__file__).resolve().parents[1] / "pages"
162
+
163
+ app = Flask(__name__)
164
+ mount_pages(
165
+ app,
166
+ PAGES,
167
+ content_security_policy="script-src 'nonce-{nonce}' 'unsafe-eval'; object-src 'none'; base-uri 'none'",
168
+ )
169
+ ```
170
+
171
+ FastAPI, `examples/fastapi/app.py`:
172
+
173
+ ```python
174
+ """Serve the example pages inside a FastAPI app: ``fastapi dev app.py`` or ``uvicorn app:app``."""
175
+ from pathlib import Path
176
+
177
+ from fastapi import FastAPI
178
+
179
+ from gramlot_py_server.fastapi import mount_pages
180
+
181
+ PAGES = Path(__file__).resolve().parents[1] / "pages"
182
+
183
+ app = FastAPI()
184
+ mount_pages(
185
+ app,
186
+ PAGES,
187
+ content_security_policy="script-src 'nonce-{nonce}' 'unsafe-eval'; object-src 'none'; base-uri 'none'",
188
+ )
189
+ ```
190
+
191
+ Kajenn, `examples/kajenn/config.py` (the page opens at
192
+ <http://127.0.0.1:8000/pages/hello>):
193
+
194
+ ```python
195
+ """Kajenn site of the example: ``kajenn serve config.py --port 8000``, pages under ``/pages``."""
196
+ from pathlib import Path
197
+
198
+ from kajenn.config.templates import DefaultConfiguration
199
+
200
+ from gramlot_py_server.kajenn import Application
201
+
202
+ PAGES = Path(__file__).resolve().parents[1] / "pages"
203
+
204
+
205
+ class Site(DefaultConfiguration):
206
+ def applications_section(self, cfg):
207
+ cfg.applications().application(
208
+ code="pages",
209
+ mount="pages",
210
+ app_class=Application,
211
+ pages=PAGES,
212
+ content_security_policy=(
213
+ "script-src 'nonce-{nonce}' 'unsafe-eval'; object-src 'none'; base-uri 'none'"
214
+ ),
215
+ ).request(body="raw")
216
+ ```
217
+
218
+ The page shows a field with `Ada` and the text `Hello, Ada`. Typing `Grace` in
219
+ the field changes the text to `Hello, Grace` at every keystroke. The tests
220
+ `tests/<framework>/test_<framework>_examples.py` serve these examples in CI, and
221
+ `tests/test_readme.py` checks that this README shows the same files.
222
+
223
+ ## Next steps
224
+
225
+ - The guides on Read the Docs, sources in [docs/](docs/) and the concise view
226
+ in [docs_llm/](docs_llm/):
227
+ - common: [Introduction](https://gramlot-py-server.readthedocs.io/en/latest/005-introduction.html),
228
+ [Writing pages for these hosts](https://gramlot-py-server.readthedocs.io/en/latest/010-writing-pages.html),
229
+ [Troubleshooting](https://gramlot-py-server.readthedocs.io/en/latest/015-troubleshooting.html);
230
+ - Uvicorn: [Tutorial](https://gramlot-py-server.readthedocs.io/en/latest/105-tutorial.html),
231
+ [Configuration](https://gramlot-py-server.readthedocs.io/en/latest/110-configuration.html),
232
+ [Deployment](https://gramlot-py-server.readthedocs.io/en/latest/115-deployment.html),
233
+ [Reference](https://gramlot-py-server.readthedocs.io/en/latest/120-reference.html);
234
+ - [Django](https://gramlot-py-server.readthedocs.io/en/latest/205-django.html), [Flask](https://gramlot-py-server.readthedocs.io/en/latest/305-flask.html),
235
+ [FastAPI](https://gramlot-py-server.readthedocs.io/en/latest/405-fastapi.html), [Kajenn](https://gramlot-py-server.readthedocs.io/en/latest/505-kajenn.html).
236
+ - The core: [The Gramlot family](https://gramlot.readthedocs.io/en/latest/docs/public/055-family.html),
237
+ [Classes, repository and server adapters](https://gramlot.readthedocs.io/en/latest/docs/public/090-classes-and-hosts.html)
238
+ (the shared adapter contract: mount prefix, companions, CSP profiles),
239
+ [Writing pages](https://gramlot.readthedocs.io/en/latest/docs/public/095-writing-pages.html).
240
+
241
+ ## Compatibility
242
+
243
+ | | Verified |
244
+ | --- | --- |
245
+ | Gramlot core | 0.2.1 (PyPI `gramlot`) |
246
+ | Python | 3.11 and 3.12 in CI; 3.12.12 locally |
247
+ | Frameworks | Uvicorn 0.54.0, Django 6.1.1 with asgiref 3.12.1, Flask 3.1.3, FastAPI 0.142.2, Kajenn 0.1.0 |
248
+ | Browsers | not run for this package; the core runtime it serves, unchanged since 0.2.0, passed the core 0.2.0 qualification on Chromium 153, WebKit 26.6 and Firefox 155 |
249
+
250
+ ## Tests and contributing
251
+
252
+ ```sh
253
+ python -m pip install -e ".[uvicorn,django,flask,fastapi,kajenn,test]"
254
+ python -m pytest -q # every adapter
255
+ python -m pytest -q tests/flask # one adapter, with its extra only
256
+ python scripts/check_docs.py # paired guides and Sphinx build
257
+ ```
258
+
259
+ CI runs each adapter with its own extra against the released core and, as an
260
+ informational job, every adapter against the core's `main` checkout, and builds
261
+ the documentation; coverage goes to Codecov with one flag per framework. See
262
+ [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md); the internal
263
+ notes are in [docs/internal/](docs/internal/).
264
+
265
+ Apache License 2.0. Copyright 2026 Softwell S.r.l. See [LICENSE](LICENSE) and
266
+ [NOTICE](NOTICE).