@@ -113,6 +113,56 @@ There will also be tutorials on how to develop your own AI agent/chatbot using l
113
113
114
114
Lihil's plugin system enables you to integrate external libraries seamlessly into your application as if they were built-in features. Any plugin that implements the ` IPlugin ` protocol can access endpoint information and wrap functionality around your endpoints.
115
115
116
+ ### Plugin Execution Flow
117
+
118
+ When you apply multiple plugins like ` @app.sub("/api/data").get(plugins=[plugin1.dec, plugin2.dec]) ` , here's how they execute:
119
+
120
+ ```
121
+ 📦 Plugin Application (Setup Time - Left to Right)
122
+ ┌─────────────────────────────────────────────────────────────┐
123
+ │ original_func → plugin1(ep_info) → plugin2(ep_info) │
124
+ │ │
125
+ │ Result: plugin2(plugin1(original_func)) │
126
+ └─────────────────────────────────────────────────────────────┘
127
+
128
+ 🚀 Request Execution (Runtime - Nested/Onion Pattern)
129
+ ┌─────────────────────────────────────────────────────────────┐
130
+ │ │
131
+ │ 📨 Request │
132
+ │ │ │
133
+ │ ▼ │
134
+ │ ┌─────────────────────────────────────────────────────┐ │
135
+ │ │ Plugin2 (Outermost) │ │
136
+ │ │ ┌─────────────────────────────────────────────────┐ │ │
137
+ │ │ │ Plugin1 (Middle) │ │ │
138
+ │ │ │ ┌─────────────────────────────────────────────┐ │ │ │
139
+ │ │ │ │ Original Function (Core) │ │ │ │
140
+ │ │ │ │ │ │ │ │
141
+ │ │ │ │ async def get_data(): │ │ │ │
142
+ │ │ │ │ return {"data": "value"} │ │ │ │
143
+ │ │ │ │ │ │ │ │
144
+ │ │ │ └─────────────────────────────────────────────┘ │ │ │
145
+ │ │ └─────────────────────────────────────────────────┘ │ │
146
+ │ └─────────────────────────────────────────────────────┘ │
147
+ │ │ │
148
+ │ ▼ │
149
+ │ 📤 Response │
150
+ │ │
151
+ └─────────────────────────────────────────────────────────────┘
152
+
153
+ 🔄 Execution Order:
154
+ Request → Plugin2 → Plugin1 → get_data() → Plugin1 → Plugin2 → Response
155
+
156
+ 📋 Real Example with Premier Plugins:
157
+ @app.sub("/api").get(plugins=[
158
+ plugin.timeout(5), # Applied 1st → Executes Outermost
159
+ plugin.retry(max_attempts=3), # Applied 2nd → Executes Middle
160
+ plugin.cache(expire_s=60), # Applied 3rd → Executes Innermost
161
+ ])
162
+
163
+ Flow: Request → timeout → retry → cache → endpoint → cache → retry → timeout → Response
164
+ ```
165
+
116
166
### Creating a Custom Plugin
117
167
118
168
A plugin is anything that implements the ` IPlugin ` protocol - either a callable or a class with a ` decorate ` method:
@@ -370,23 +420,35 @@ lihil follows semantic versioning after v1.0.0, where a version in x.y.z represe
370
420
- y: minor, feature updates
371
421
- z: patch, bug fixes, typing updates
372
422
373
- ## Contributions & Roadmap
423
+ ## Contributing
424
+
425
+ We welcome all contributions! Whether you're fixing bugs, adding features, improving documentation, or enhancing tests - every contribution matters.
426
+
427
+ ### Quick Start for Contributors
428
+
429
+ 1 . ** Fork & Clone** : Fork the repository and clone your fork
430
+ 2 . ** Find Latest Branch** : Use ` git branch -r | grep "version/" ` to find the latest development branch (e.g., ` version/0.2.23 ` )
431
+ 3 . ** Create Feature Branch** : Branch from the latest version branch
432
+ 4 . ** Make Changes** : Follow existing code conventions and add tests
433
+ 5 . ** Submit PR** : Target your PR to the latest development branch
434
+
435
+ For detailed contributing guidelines, workflow, and project conventions, see our [ Contributing Guide] ( .github/CONTRIBUTING.md ) .
374
436
375
- All contributions are welcome
437
+ ## Roadmap
376
438
377
- Road Map before v1.0.0
439
+ ### Road Map before v1.0.0
378
440
379
- - [x] v0.1.x: Feature parity (alpha stage)
441
+ - [x] ** v0.1.x: Feature parity** (alpha stage)
380
442
381
443
Implementing core functionalities of lihil, feature parity with fastapi
382
444
383
- - [x] v0.2.x: Official Plugins (current stage)
445
+ - [x] ** v0.2.x: Official Plugins** (current stage)
384
446
385
447
We would keep adding new features & plugins to lihil without making breaking changes.
386
448
This might be the last minor versions before v1.0.0.
387
449
388
- - [ ] v0.3.x: Performance boost
450
+ - [ ] ** v0.3.x: Performance boost**
389
451
390
452
The plan is to rewrite some components in c, roll out a server in c, or other performance optimizations in 0.3.x.
391
453
392
- If we can do this without affect current implementations in 0.2.0 at all, 0.3.x may never occur and we would go stright to v1.0.0 from v0.2.x
454
+ If we can do this without affect current implementations in 0.2.0 at all, 0.3.x may never occur and we would go straight to v1.0.0 from v0.2.x
0 commit comments