genro-asgi 0.2.0__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 (77) hide show
  1. genro_asgi-0.2.0/LICENSE +201 -0
  2. genro_asgi-0.2.0/NOTICE +9 -0
  3. genro_asgi-0.2.0/PKG-INFO +230 -0
  4. genro_asgi-0.2.0/README.md +171 -0
  5. genro_asgi-0.2.0/pyproject.toml +104 -0
  6. genro_asgi-0.2.0/setup.cfg +4 -0
  7. genro_asgi-0.2.0/src/genro_asgi/__init__.py +150 -0
  8. genro_asgi-0.2.0/src/genro_asgi/__main__.py +99 -0
  9. genro_asgi-0.2.0/src/genro_asgi/applications/__init__.py +9 -0
  10. genro_asgi-0.2.0/src/genro_asgi/applications/asgi_application.py +146 -0
  11. genro_asgi-0.2.0/src/genro_asgi/applications/mcp_application.py +360 -0
  12. genro_asgi-0.2.0/src/genro_asgi/authentication/__init__.py +28 -0
  13. genro_asgi-0.2.0/src/genro_asgi/authentication/base.py +204 -0
  14. genro_asgi-0.2.0/src/genro_asgi/context.py +104 -0
  15. genro_asgi-0.2.0/src/genro_asgi/datastructures/__init__.py +59 -0
  16. genro_asgi-0.2.0/src/genro_asgi/datastructures/address.py +103 -0
  17. genro_asgi-0.2.0/src/genro_asgi/datastructures/headers.py +259 -0
  18. genro_asgi-0.2.0/src/genro_asgi/datastructures/query_params.py +276 -0
  19. genro_asgi-0.2.0/src/genro_asgi/datastructures/state.py +149 -0
  20. genro_asgi-0.2.0/src/genro_asgi/datastructures/url.py +168 -0
  21. genro_asgi-0.2.0/src/genro_asgi/exceptions.py +293 -0
  22. genro_asgi-0.2.0/src/genro_asgi/executors/__init__.py +46 -0
  23. genro_asgi-0.2.0/src/genro_asgi/executors/base.py +180 -0
  24. genro_asgi-0.2.0/src/genro_asgi/executors/local.py +278 -0
  25. genro_asgi-0.2.0/src/genro_asgi/executors/registry.py +250 -0
  26. genro_asgi-0.2.0/src/genro_asgi/lifespan.py +189 -0
  27. genro_asgi-0.2.0/src/genro_asgi/loader.py +314 -0
  28. genro_asgi-0.2.0/src/genro_asgi/middleware/__init__.py +222 -0
  29. genro_asgi-0.2.0/src/genro_asgi/middleware/authentication.py +367 -0
  30. genro_asgi-0.2.0/src/genro_asgi/middleware/cache.py +281 -0
  31. genro_asgi-0.2.0/src/genro_asgi/middleware/compression.py +231 -0
  32. genro_asgi-0.2.0/src/genro_asgi/middleware/cors.py +266 -0
  33. genro_asgi-0.2.0/src/genro_asgi/middleware/errors.py +186 -0
  34. genro_asgi-0.2.0/src/genro_asgi/middleware/logging.py +155 -0
  35. genro_asgi-0.2.0/src/genro_asgi/request.py +701 -0
  36. genro_asgi-0.2.0/src/genro_asgi/resources.py +205 -0
  37. genro_asgi-0.2.0/src/genro_asgi/response.py +476 -0
  38. genro_asgi-0.2.0/src/genro_asgi/routers/__init__.py +12 -0
  39. genro_asgi-0.2.0/src/genro_asgi/routers/static_router.py +385 -0
  40. genro_asgi-0.2.0/src/genro_asgi/server/__init__.py +16 -0
  41. genro_asgi-0.2.0/src/genro_asgi/server/dispatcher.py +105 -0
  42. genro_asgi-0.2.0/src/genro_asgi/server/server.py +333 -0
  43. genro_asgi-0.2.0/src/genro_asgi/server/server_app/__init__.py +8 -0
  44. genro_asgi-0.2.0/src/genro_asgi/server/server_app/server_app.py +199 -0
  45. genro_asgi-0.2.0/src/genro_asgi/server/server_config.py +221 -0
  46. genro_asgi-0.2.0/src/genro_asgi/storage.py +409 -0
  47. genro_asgi-0.2.0/src/genro_asgi/sys_applications/__init__.py +15 -0
  48. genro_asgi-0.2.0/src/genro_asgi/sys_applications/genro_api/__init__.py +8 -0
  49. genro_asgi-0.2.0/src/genro_asgi/sys_applications/genro_api/genro_api_app.py +167 -0
  50. genro_asgi-0.2.0/src/genro_asgi/sys_applications/swagger/__init__.py +8 -0
  51. genro_asgi-0.2.0/src/genro_asgi/sys_applications/swagger/swagger_app.py +83 -0
  52. genro_asgi-0.2.0/src/genro_asgi/types.py +174 -0
  53. genro_asgi-0.2.0/src/genro_asgi/utils/__init__.py +34 -0
  54. genro_asgi-0.2.0/src/genro_asgi/utils/binder.py +142 -0
  55. genro_asgi-0.2.0/src/genro_asgi/websocket.py +1467 -0
  56. genro_asgi-0.2.0/src/genro_asgi/wsx/__init__.py +42 -0
  57. genro_asgi-0.2.0/src/genro_asgi/wsx/protocol.py +191 -0
  58. genro_asgi-0.2.0/src/genro_asgi/wsx/registry.py +0 -0
  59. genro_asgi-0.2.0/src/genro_asgi.egg-info/PKG-INFO +230 -0
  60. genro_asgi-0.2.0/src/genro_asgi.egg-info/SOURCES.txt +75 -0
  61. genro_asgi-0.2.0/src/genro_asgi.egg-info/dependency_links.txt +1 -0
  62. genro_asgi-0.2.0/src/genro_asgi.egg-info/entry_points.txt +2 -0
  63. genro_asgi-0.2.0/src/genro_asgi.egg-info/requires.txt +35 -0
  64. genro_asgi-0.2.0/src/genro_asgi.egg-info/top_level.txt +1 -0
  65. genro_asgi-0.2.0/tests/test_authentication.py +421 -0
  66. genro_asgi-0.2.0/tests/test_basic.py +28 -0
  67. genro_asgi-0.2.0/tests/test_cache_middleware.py +317 -0
  68. genro_asgi-0.2.0/tests/test_datastructures.py +523 -0
  69. genro_asgi-0.2.0/tests/test_exceptions.py +328 -0
  70. genro_asgi-0.2.0/tests/test_executors.py +412 -0
  71. genro_asgi-0.2.0/tests/test_mcp_application.py +430 -0
  72. genro_asgi-0.2.0/tests/test_response.py +472 -0
  73. genro_asgi-0.2.0/tests/test_server_application.py +69 -0
  74. genro_asgi-0.2.0/tests/test_static_router.py +265 -0
  75. genro_asgi-0.2.0/tests/test_storage.py +354 -0
  76. genro_asgi-0.2.0/tests/test_types.py +270 -0
  77. genro_asgi-0.2.0/tests/test_wsx.py +308 -0
@@ -0,0 +1,201 @@
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 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
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Softwell S.r.l.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ Genro Project
2
+ Copyright 2025 Softwell S.r.l.
3
+
4
+ This product includes software developed by Softwell S.r.l.
5
+
6
+ Licensed under the Apache License 2.0.
7
+ You may obtain a copy of the License at:
8
+
9
+ https://www.apache.org/licenses/LICENSE-2.0
@@ -0,0 +1,230 @@
1
+ Metadata-Version: 2.4
2
+ Name: genro-asgi
3
+ Version: 0.2.0
4
+ Summary: A minimal, stable ASGI foundation - framework-agnostic toolkit for building high-performance web services
5
+ Author-email: "Softwell S.r.l." <info@softwell.it>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/genropy/genro-asgi
8
+ Project-URL: Documentation, https://genro-asgi.readthedocs.io
9
+ Project-URL: Repository, https://github.com/genropy/genro-asgi
10
+ Project-URL: Bug Tracker, https://github.com/genropy/genro-asgi/issues
11
+ Keywords: asgi,web,async,http,server,framework-agnostic
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Framework :: AsyncIO
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ License-File: NOTICE
27
+ Requires-Dist: genro-toolbox>=0.2.0
28
+ Requires-Dist: genro-routes>=0.1.0
29
+ Requires-Dist: genro-tytx>=0.1.0
30
+ Requires-Dist: uvicorn>=0.30.0
31
+ Requires-Dist: pyyaml>=6.0
32
+ Provides-Extra: json
33
+ Requires-Dist: orjson>=3.9.0; extra == "json"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
37
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
38
+ Requires-Dist: black>=23.0; extra == "dev"
39
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
40
+ Requires-Dist: mypy>=1.0; extra == "dev"
41
+ Provides-Extra: docs
42
+ Requires-Dist: sphinx>=8.0.0; extra == "docs"
43
+ Requires-Dist: sphinx-rtd-theme>=3.0.0; extra == "docs"
44
+ Requires-Dist: sphinx-autodoc-typehints>=3.0.0; extra == "docs"
45
+ Requires-Dist: myst-parser>=4.0.0; extra == "docs"
46
+ Provides-Extra: all
47
+ Requires-Dist: orjson>=3.9.0; extra == "all"
48
+ Requires-Dist: pytest>=7.0; extra == "all"
49
+ Requires-Dist: pytest-cov>=4.0; extra == "all"
50
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "all"
51
+ Requires-Dist: black>=23.0; extra == "all"
52
+ Requires-Dist: ruff>=0.1.0; extra == "all"
53
+ Requires-Dist: mypy>=1.0; extra == "all"
54
+ Requires-Dist: sphinx>=8.0.0; extra == "all"
55
+ Requires-Dist: sphinx-rtd-theme>=3.0.0; extra == "all"
56
+ Requires-Dist: sphinx-autodoc-typehints>=3.0.0; extra == "all"
57
+ Requires-Dist: myst-parser>=4.0.0; extra == "all"
58
+ Dynamic: license-file
59
+
60
+ # Genro ASGI
61
+
62
+ **A minimal, stable ASGI foundation** - framework-agnostic toolkit for building high-performance web services.
63
+
64
+ [![PyPI version](https://img.shields.io/pypi/v/genro-asgi.svg)](https://pypi.org/project/genro-asgi/)
65
+ [![Python Support](https://img.shields.io/pypi/pyversions/genro-asgi.svg)](https://pypi.org/project/genro-asgi/)
66
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
67
+ [![Documentation](https://readthedocs.org/projects/genro-asgi/badge/?version=latest)](https://genro-asgi.readthedocs.io)
68
+
69
+ ## Overview
70
+
71
+ Genro ASGI provides a minimal, production-ready ASGI server and application toolkit built on top of `genro-routes` for routing. It offers essential components for building web services with full type safety.
72
+
73
+ ### Key Features
74
+
75
+ - **Minimal Core**: Essential components only, no bloat
76
+ - **Router Integration**: Uses `genro-routes` for flexible, decorator-based routing
77
+ - **MCP Support**: Built-in MCP Streamable HTTP transport via `McpApplication`
78
+ - **Production-Ready**: Tested, typed, and stable
79
+ - **Type-Safe**: Full type hints throughout
80
+ - **Essential Components**:
81
+ - ASGI server with config-driven application mounting
82
+ - HTTP request/response utilities
83
+ - Lifespan management
84
+ - Middleware (authentication, CORS, errors, compression, cache, logging)
85
+ - Static file serving via `StaticRouter`
86
+ - WebSocket support with WSX extension protocol
87
+ - Filesystem storage with mount system
88
+
89
+ ## Installation
90
+
91
+ ```bash
92
+ # Basic installation
93
+ pip install genro-asgi
94
+
95
+ # With fast JSON support
96
+ pip install genro-asgi[json]
97
+
98
+ # Development installation
99
+ pip install genro-asgi[dev]
100
+
101
+ # Documentation build
102
+ pip install genro-asgi[docs]
103
+ ```
104
+
105
+ ## Quick Start
106
+
107
+ ### CLI - Serve static files
108
+
109
+ ```bash
110
+ # Create config.yaml
111
+ cat > config.yaml << EOF
112
+ server:
113
+ host: "127.0.0.1"
114
+ port: 8000
115
+
116
+ apps:
117
+ static:
118
+ module: "genro_asgi:StaticRouter"
119
+ directory: "./public"
120
+ index: "index.html"
121
+ EOF
122
+
123
+ # Run server
124
+ python -m genro_asgi serve .
125
+ ```
126
+
127
+ ### Python - Custom server
128
+
129
+ ```python
130
+ from genro_asgi import AsgiServer
131
+
132
+ server = AsgiServer(server_dir=".")
133
+ server.run() # Starts uvicorn
134
+ ```
135
+
136
+ ## Architecture
137
+
138
+ Genro ASGI is designed around these principles:
139
+
140
+ 1. **Instance Isolation**: Server and apps are isolated instances, not global functions
141
+ 2. **Composability**: Mix and match components as needed
142
+ 3. **Type Safety**: Full type hints throughout
143
+ 4. **Dual Parent-Child**: Child objects hold a semantic reference to their parent
144
+
145
+ ### Core Components
146
+
147
+ - **AsgiServer**: ASGI entry point, loads config, mounts apps
148
+ - **AsgiApplication**: Base class for mountable applications
149
+ - **McpApplication**: MCP Streamable HTTP transport
150
+ - **HttpRequest**: HTTP request wrapper with headers, query, body
151
+ - **Response**: HTTP response with auto content-type detection
152
+ - **Lifespan / ServerLifespan**: Startup/shutdown event management
153
+ - **Dispatcher**: Request routing and dispatch
154
+ - **StaticRouter**: Filesystem-backed static file serving
155
+ - **LocalStorage**: Filesystem storage with mount system
156
+
157
+ ### Middleware
158
+
159
+ - **AuthMiddleware**: O(1) authentication (bearer, basic, JWT)
160
+ - **CORSMiddleware**: Cross-Origin Resource Sharing headers
161
+ - **ErrorMiddleware**: Exception handling and error responses
162
+ - **CompressionMiddleware**: Gzip response compression
163
+ - **CacheMiddleware**: HTTP response caching
164
+ - **LoggingMiddleware**: Request/response logging
165
+
166
+ ## Documentation
167
+
168
+ Full documentation available at: https://genro-asgi.readthedocs.io
169
+
170
+ ## Development
171
+
172
+ ### Setup
173
+
174
+ ```bash
175
+ # Clone repository
176
+ git clone https://github.com/genropy/genro-asgi.git
177
+ cd genro-asgi
178
+
179
+ # Install in development mode
180
+ pip install -e .[dev]
181
+ ```
182
+
183
+ ### Testing
184
+
185
+ ```bash
186
+ # Run tests
187
+ pytest
188
+
189
+ # With coverage
190
+ pytest --cov=genro_asgi --cov-report=html
191
+ ```
192
+
193
+ ### Code Quality
194
+
195
+ ```bash
196
+ # Lint code
197
+ ruff check .
198
+
199
+ # Type check
200
+ mypy src
201
+ ```
202
+
203
+ ## License
204
+
205
+ This project is licensed under the **Apache License 2.0**.
206
+
207
+ Copyright © 2025-2026
208
+ **Softwell S.r.l.**
209
+
210
+ You may obtain a copy of the license at:
211
+
212
+ https://www.apache.org/licenses/LICENSE-2.0
213
+
214
+ This project may include third-party components distributed under separate open-source licenses.
215
+ See the `NOTICE` file for additional attribution.
216
+
217
+ ## Contributing
218
+
219
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
220
+
221
+ ## Links
222
+
223
+ - **GitHub**: https://github.com/genropy/genro-asgi
224
+ - **PyPI**: https://pypi.org/project/genro-asgi/
225
+ - **Documentation**: https://genro-asgi.readthedocs.io
226
+ - **Issue Tracker**: https://github.com/genropy/genro-asgi/issues
227
+
228
+ ## Credits
229
+
230
+ Developed by [Softwell S.r.l.](https://www.softwell.it/)
@@ -0,0 +1,171 @@
1
+ # Genro ASGI
2
+
3
+ **A minimal, stable ASGI foundation** - framework-agnostic toolkit for building high-performance web services.
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/genro-asgi.svg)](https://pypi.org/project/genro-asgi/)
6
+ [![Python Support](https://img.shields.io/pypi/pyversions/genro-asgi.svg)](https://pypi.org/project/genro-asgi/)
7
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
8
+ [![Documentation](https://readthedocs.org/projects/genro-asgi/badge/?version=latest)](https://genro-asgi.readthedocs.io)
9
+
10
+ ## Overview
11
+
12
+ Genro ASGI provides a minimal, production-ready ASGI server and application toolkit built on top of `genro-routes` for routing. It offers essential components for building web services with full type safety.
13
+
14
+ ### Key Features
15
+
16
+ - **Minimal Core**: Essential components only, no bloat
17
+ - **Router Integration**: Uses `genro-routes` for flexible, decorator-based routing
18
+ - **MCP Support**: Built-in MCP Streamable HTTP transport via `McpApplication`
19
+ - **Production-Ready**: Tested, typed, and stable
20
+ - **Type-Safe**: Full type hints throughout
21
+ - **Essential Components**:
22
+ - ASGI server with config-driven application mounting
23
+ - HTTP request/response utilities
24
+ - Lifespan management
25
+ - Middleware (authentication, CORS, errors, compression, cache, logging)
26
+ - Static file serving via `StaticRouter`
27
+ - WebSocket support with WSX extension protocol
28
+ - Filesystem storage with mount system
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ # Basic installation
34
+ pip install genro-asgi
35
+
36
+ # With fast JSON support
37
+ pip install genro-asgi[json]
38
+
39
+ # Development installation
40
+ pip install genro-asgi[dev]
41
+
42
+ # Documentation build
43
+ pip install genro-asgi[docs]
44
+ ```
45
+
46
+ ## Quick Start
47
+
48
+ ### CLI - Serve static files
49
+
50
+ ```bash
51
+ # Create config.yaml
52
+ cat > config.yaml << EOF
53
+ server:
54
+ host: "127.0.0.1"
55
+ port: 8000
56
+
57
+ apps:
58
+ static:
59
+ module: "genro_asgi:StaticRouter"
60
+ directory: "./public"
61
+ index: "index.html"
62
+ EOF
63
+
64
+ # Run server
65
+ python -m genro_asgi serve .
66
+ ```
67
+
68
+ ### Python - Custom server
69
+
70
+ ```python
71
+ from genro_asgi import AsgiServer
72
+
73
+ server = AsgiServer(server_dir=".")
74
+ server.run() # Starts uvicorn
75
+ ```
76
+
77
+ ## Architecture
78
+
79
+ Genro ASGI is designed around these principles:
80
+
81
+ 1. **Instance Isolation**: Server and apps are isolated instances, not global functions
82
+ 2. **Composability**: Mix and match components as needed
83
+ 3. **Type Safety**: Full type hints throughout
84
+ 4. **Dual Parent-Child**: Child objects hold a semantic reference to their parent
85
+
86
+ ### Core Components
87
+
88
+ - **AsgiServer**: ASGI entry point, loads config, mounts apps
89
+ - **AsgiApplication**: Base class for mountable applications
90
+ - **McpApplication**: MCP Streamable HTTP transport
91
+ - **HttpRequest**: HTTP request wrapper with headers, query, body
92
+ - **Response**: HTTP response with auto content-type detection
93
+ - **Lifespan / ServerLifespan**: Startup/shutdown event management
94
+ - **Dispatcher**: Request routing and dispatch
95
+ - **StaticRouter**: Filesystem-backed static file serving
96
+ - **LocalStorage**: Filesystem storage with mount system
97
+
98
+ ### Middleware
99
+
100
+ - **AuthMiddleware**: O(1) authentication (bearer, basic, JWT)
101
+ - **CORSMiddleware**: Cross-Origin Resource Sharing headers
102
+ - **ErrorMiddleware**: Exception handling and error responses
103
+ - **CompressionMiddleware**: Gzip response compression
104
+ - **CacheMiddleware**: HTTP response caching
105
+ - **LoggingMiddleware**: Request/response logging
106
+
107
+ ## Documentation
108
+
109
+ Full documentation available at: https://genro-asgi.readthedocs.io
110
+
111
+ ## Development
112
+
113
+ ### Setup
114
+
115
+ ```bash
116
+ # Clone repository
117
+ git clone https://github.com/genropy/genro-asgi.git
118
+ cd genro-asgi
119
+
120
+ # Install in development mode
121
+ pip install -e .[dev]
122
+ ```
123
+
124
+ ### Testing
125
+
126
+ ```bash
127
+ # Run tests
128
+ pytest
129
+
130
+ # With coverage
131
+ pytest --cov=genro_asgi --cov-report=html
132
+ ```
133
+
134
+ ### Code Quality
135
+
136
+ ```bash
137
+ # Lint code
138
+ ruff check .
139
+
140
+ # Type check
141
+ mypy src
142
+ ```
143
+
144
+ ## License
145
+
146
+ This project is licensed under the **Apache License 2.0**.
147
+
148
+ Copyright © 2025-2026
149
+ **Softwell S.r.l.**
150
+
151
+ You may obtain a copy of the license at:
152
+
153
+ https://www.apache.org/licenses/LICENSE-2.0
154
+
155
+ This project may include third-party components distributed under separate open-source licenses.
156
+ See the `NOTICE` file for additional attribution.
157
+
158
+ ## Contributing
159
+
160
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
161
+
162
+ ## Links
163
+
164
+ - **GitHub**: https://github.com/genropy/genro-asgi
165
+ - **PyPI**: https://pypi.org/project/genro-asgi/
166
+ - **Documentation**: https://genro-asgi.readthedocs.io
167
+ - **Issue Tracker**: https://github.com/genropy/genro-asgi/issues
168
+
169
+ ## Credits
170
+
171
+ Developed by [Softwell S.r.l.](https://www.softwell.it/)