tachyon-api 0.5.5__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.
Potentially problematic release.
This version of tachyon-api might be problematic. Click here for more details.
- tachyon_api-0.5.5/LICENSE +17 -0
- tachyon_api-0.5.5/PKG-INFO +239 -0
- tachyon_api-0.5.5/README.md +216 -0
- tachyon_api-0.5.5/pyproject.toml +26 -0
- tachyon_api-0.5.5/tachyon_api/__init__.py +31 -0
- tachyon_api-0.5.5/tachyon_api/app.py +607 -0
- tachyon_api-0.5.5/tachyon_api/di.py +59 -0
- tachyon_api-0.5.5/tachyon_api/middlewares/__init__.py +5 -0
- tachyon_api-0.5.5/tachyon_api/middlewares/core.py +40 -0
- tachyon_api-0.5.5/tachyon_api/middlewares/cors.py +142 -0
- tachyon_api-0.5.5/tachyon_api/middlewares/logger.py +119 -0
- tachyon_api-0.5.5/tachyon_api/models.py +73 -0
- tachyon_api-0.5.5/tachyon_api/openapi.py +362 -0
- tachyon_api-0.5.5/tachyon_api/params.py +90 -0
- tachyon_api-0.5.5/tachyon_api/responses.py +49 -0
- tachyon_api-0.5.5/tachyon_api/router.py +129 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2025 Juan Manuel Panozzo Zรฉnere
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: tachyon-api
|
|
3
|
+
Version: 0.5.5
|
|
4
|
+
Summary: A lightweight, FastAPI-inspired web framework
|
|
5
|
+
License: GPL-3.0-or-later
|
|
6
|
+
Author: Juan Manuel Panozzo Zรฉnere
|
|
7
|
+
Author-email: jm.panozzozenere@gmail.com
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Dist: msgspec (>=0.19.0,<0.20.0)
|
|
16
|
+
Requires-Dist: orjson (>=3.11.1,<4.0.0)
|
|
17
|
+
Requires-Dist: ruff (>=0.12.7,<0.13.0)
|
|
18
|
+
Requires-Dist: starlette (>=0.47.2,<0.48.0)
|
|
19
|
+
Requires-Dist: typer (>=0.16.0,<0.17.0)
|
|
20
|
+
Requires-Dist: uvicorn (>=0.35.0,<0.36.0)
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# ๐ Tachyon API
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
**A lightweight, high-performance API framework for Python with the elegance of FastAPI and the speed of light.**
|
|
31
|
+
|
|
32
|
+
Tachyon API combines the intuitive decorator-based syntax you love with minimal dependencies and maximal performance. Built with Test-Driven Development from the ground up, it offers a cleaner, faster alternative with full ASGI compatibility.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from tachyon_api import Tachyon
|
|
36
|
+
from tachyon_api.models import Struct
|
|
37
|
+
|
|
38
|
+
app = Tachyon()
|
|
39
|
+
|
|
40
|
+
class User(Struct):
|
|
41
|
+
name: str
|
|
42
|
+
age: int
|
|
43
|
+
|
|
44
|
+
@app.get("/")
|
|
45
|
+
def hello_world():
|
|
46
|
+
return {"message": "Tachyon is running at lightspeed!"}
|
|
47
|
+
|
|
48
|
+
@app.post("/users")
|
|
49
|
+
def create_user(user: User):
|
|
50
|
+
return {"created": user.name}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## โจ Features
|
|
54
|
+
|
|
55
|
+
- ๐ **Intuitive API** - Elegant decorator-based routing inspired by FastAPI
|
|
56
|
+
- ๐งฉ **Implicit & Explicit Dependency Injection** - Both supported for maximum flexibility
|
|
57
|
+
- ๐ **Automatic OpenAPI Documentation** - With Scalar UI, Swagger UI, and ReDoc support
|
|
58
|
+
- ๐ ๏ธ **Router System** - Organize your API endpoints with powerful route grouping
|
|
59
|
+
- ๐งช **Built with TDD** - Comprehensive test suite ensures stability and correctness
|
|
60
|
+
- ๐ **Middleware Support** - Both class-based and decorator-based approaches
|
|
61
|
+
- ๐ **High-Performance JSON** - Powered by msgspec and orjson for lightning-fast processing
|
|
62
|
+
- ๐ชถ **Minimal Dependencies** - Lean core with only what you really need
|
|
63
|
+
|
|
64
|
+
## ๐ฆ Installation
|
|
65
|
+
|
|
66
|
+
Tachyon API is currently in beta. The package will be available on PyPI and Poetry repositories soon!
|
|
67
|
+
|
|
68
|
+
### From source (Currently the only method)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/jmpanozzoz/tachyon_api.git
|
|
72
|
+
cd tachyon-api
|
|
73
|
+
pip install -r requirements.txt
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> **Note:** The `pip install tachyon-api` and `poetry add tachyon-api` commands will be available once the package is published to PyPI.
|
|
77
|
+
|
|
78
|
+
## ๐ Key Differences from FastAPI
|
|
79
|
+
|
|
80
|
+
While inspired by FastAPI's elegant API design, Tachyon API takes a different approach in several key areas:
|
|
81
|
+
|
|
82
|
+
| Feature | Tachyon API | FastAPI |
|
|
83
|
+
|---------|------------|---------|
|
|
84
|
+
| **Core Dependencies** | Minimalist: Starlette + msgspec + orjson | Pydantic + multiple dependencies |
|
|
85
|
+
| **Validation Engine** | msgspec (faster, lighter) | Pydantic (more features, heavier) |
|
|
86
|
+
| **Dependency Injection** | Both implicit and explicit | Primarily explicit |
|
|
87
|
+
| **Middleware Approach** | Dual API (class + decorator) | Class-based |
|
|
88
|
+
| **Development Approach** | Test-Driven from the start | Feature-driven |
|
|
89
|
+
| **Documentation UI** | Scalar UI (default), Swagger, ReDoc | Swagger UI (default), ReDoc |
|
|
90
|
+
| **Size** | Lightweight, focused | Comprehensive, full-featured |
|
|
91
|
+
|
|
92
|
+
## ๐งช Test-Driven Development
|
|
93
|
+
|
|
94
|
+
Tachyon API is built with TDD principles at its core:
|
|
95
|
+
|
|
96
|
+
- Every feature starts with a test
|
|
97
|
+
- Comprehensive test coverage
|
|
98
|
+
- Self-contained test architecture
|
|
99
|
+
- Clear test documentation
|
|
100
|
+
|
|
101
|
+
This ensures stability, maintainability, and prevents regressions as the framework evolves.
|
|
102
|
+
|
|
103
|
+
## ๐ Core Dependencies
|
|
104
|
+
|
|
105
|
+
Tachyon API maintains a minimal, carefully selected set of dependencies:
|
|
106
|
+
|
|
107
|
+
- **[Starlette](https://www.starlette.io/)**: ASGI framework providing solid foundations
|
|
108
|
+
- **[msgspec](https://jcristharif.com/msgspec/)**: Ultra-fast serialization and validation
|
|
109
|
+
- **[orjson](https://github.com/ijl/orjson)**: High-performance JSON parser
|
|
110
|
+
- **[uvicorn](https://www.uvicorn.org/)**: ASGI server for development and production
|
|
111
|
+
|
|
112
|
+
These were chosen for their performance, lightweight nature, and focused functionality.
|
|
113
|
+
|
|
114
|
+
## ๐ Dependency Injection System
|
|
115
|
+
|
|
116
|
+
Tachyon API offers a flexible dependency injection system:
|
|
117
|
+
|
|
118
|
+
### Implicit Injection
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
@injectable
|
|
122
|
+
class UserService:
|
|
123
|
+
def __init__(self, repository: UserRepository): # Auto-injected!
|
|
124
|
+
self.repository = repository
|
|
125
|
+
|
|
126
|
+
@app.get("/users/{user_id}")
|
|
127
|
+
def get_user(user_id: int, service: UserService): # Auto-injected!
|
|
128
|
+
return service.get_user(user_id)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Explicit Injection
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
@app.get("/users/{user_id}")
|
|
135
|
+
def get_user(user_id: int, service: UserService = Depends()):
|
|
136
|
+
return service.get_user(user_id)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## ๐ Middleware Support
|
|
140
|
+
|
|
141
|
+
Tachyon API supports middlewares in two elegant ways:
|
|
142
|
+
|
|
143
|
+
### Class-based Approach
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from tachyon_api.middlewares import CORSMiddleware, LoggerMiddleware
|
|
147
|
+
|
|
148
|
+
# Add built-in CORS middleware
|
|
149
|
+
app.add_middleware(
|
|
150
|
+
CORSMiddleware,
|
|
151
|
+
allow_origins=["*"],
|
|
152
|
+
allow_methods=["*"],
|
|
153
|
+
allow_headers=["*"],
|
|
154
|
+
allow_credentials=False,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
# Add built-in Logger middleware
|
|
158
|
+
app.add_middleware(
|
|
159
|
+
LoggerMiddleware,
|
|
160
|
+
include_headers=True,
|
|
161
|
+
redact_headers=["authorization"],
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Decorator-based Approach
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
@app.middleware()
|
|
169
|
+
async def timing_middleware(scope, receive, send, app):
|
|
170
|
+
start_time = time.time()
|
|
171
|
+
await app(scope, receive, send)
|
|
172
|
+
print(f"Request took {time.time() - start_time:.4f}s")
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Built-in Middlewares
|
|
176
|
+
|
|
177
|
+
- CORSMiddleware: Handles preflight requests and injects CORS headers into responses. Highly configurable with allow_origins, allow_methods, allow_headers, allow_credentials, expose_headers, and max_age.
|
|
178
|
+
- LoggerMiddleware: Logs request start/end, duration, status code, and optionally headers and a non-intrusive body preview.
|
|
179
|
+
|
|
180
|
+
Both middlewares are standard ASGI middlewares and can be used with `app.add_middleware(...)`.
|
|
181
|
+
|
|
182
|
+
## ๐ Example Application
|
|
183
|
+
|
|
184
|
+
For a complete example showcasing all features, see the [example directory](./example). It demonstrates:
|
|
185
|
+
|
|
186
|
+
- Clean architecture with models, services, and repositories
|
|
187
|
+
- Router organization
|
|
188
|
+
- Middleware implementation
|
|
189
|
+
- Dependency injection patterns
|
|
190
|
+
- OpenAPI documentation
|
|
191
|
+
|
|
192
|
+
Built-in CORS and Logger middlewares are integrated in the example for convenience. You can toggle settings in `example/app.py`.
|
|
193
|
+
|
|
194
|
+
Run the example with:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
cd example
|
|
198
|
+
python app.py
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Then visit:
|
|
202
|
+
- **API**: http://localhost:8000/
|
|
203
|
+
- **Documentation**: http://localhost:8000/docs
|
|
204
|
+
|
|
205
|
+
## ๐ Contributing
|
|
206
|
+
|
|
207
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
208
|
+
|
|
209
|
+
1. Fork the repository
|
|
210
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
211
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
212
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
213
|
+
5. Open a Pull Request
|
|
214
|
+
|
|
215
|
+
## ๐ License
|
|
216
|
+
|
|
217
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
218
|
+
|
|
219
|
+
## ๐ฎ Roadmap
|
|
220
|
+
|
|
221
|
+
- [ ] **Exception System**: Standardized exception handling and error responses
|
|
222
|
+
- [ ] **Environment Management**: Built-in environment variable handling and uvicorn integration
|
|
223
|
+
- [ ] **CLI Tool**: Project scaffolding and service generation
|
|
224
|
+
- Directory structure generation
|
|
225
|
+
- Service and repository templates
|
|
226
|
+
- API endpoint generation
|
|
227
|
+
- [ ] **Code Quality Tools**: Ruff integration for linting and formatting
|
|
228
|
+
- [ ] **Performance Optimization**: Cython compilation for service layer via CLI
|
|
229
|
+
- [ ] **Authentication Middleware**: Built-in auth patterns and middleware
|
|
230
|
+
- [ ] **Performance Benchmarks**: Comparisons against other frameworks
|
|
231
|
+
- [ ] **More Example Applications**: Demonstrating different use cases
|
|
232
|
+
- [ ] **Plugin System**: Extensibility through plugins
|
|
233
|
+
- [ ] **Deployment Guides**: Documentation for various deployment scenarios
|
|
234
|
+
- [ ] **And much more!**
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
*Built with ๐ by developers, for developers*
|
|
239
|
+
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# ๐ Tachyon API
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
**A lightweight, high-performance API framework for Python with the elegance of FastAPI and the speed of light.**
|
|
9
|
+
|
|
10
|
+
Tachyon API combines the intuitive decorator-based syntax you love with minimal dependencies and maximal performance. Built with Test-Driven Development from the ground up, it offers a cleaner, faster alternative with full ASGI compatibility.
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from tachyon_api import Tachyon
|
|
14
|
+
from tachyon_api.models import Struct
|
|
15
|
+
|
|
16
|
+
app = Tachyon()
|
|
17
|
+
|
|
18
|
+
class User(Struct):
|
|
19
|
+
name: str
|
|
20
|
+
age: int
|
|
21
|
+
|
|
22
|
+
@app.get("/")
|
|
23
|
+
def hello_world():
|
|
24
|
+
return {"message": "Tachyon is running at lightspeed!"}
|
|
25
|
+
|
|
26
|
+
@app.post("/users")
|
|
27
|
+
def create_user(user: User):
|
|
28
|
+
return {"created": user.name}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## โจ Features
|
|
32
|
+
|
|
33
|
+
- ๐ **Intuitive API** - Elegant decorator-based routing inspired by FastAPI
|
|
34
|
+
- ๐งฉ **Implicit & Explicit Dependency Injection** - Both supported for maximum flexibility
|
|
35
|
+
- ๐ **Automatic OpenAPI Documentation** - With Scalar UI, Swagger UI, and ReDoc support
|
|
36
|
+
- ๐ ๏ธ **Router System** - Organize your API endpoints with powerful route grouping
|
|
37
|
+
- ๐งช **Built with TDD** - Comprehensive test suite ensures stability and correctness
|
|
38
|
+
- ๐ **Middleware Support** - Both class-based and decorator-based approaches
|
|
39
|
+
- ๐ **High-Performance JSON** - Powered by msgspec and orjson for lightning-fast processing
|
|
40
|
+
- ๐ชถ **Minimal Dependencies** - Lean core with only what you really need
|
|
41
|
+
|
|
42
|
+
## ๐ฆ Installation
|
|
43
|
+
|
|
44
|
+
Tachyon API is currently in beta. The package will be available on PyPI and Poetry repositories soon!
|
|
45
|
+
|
|
46
|
+
### From source (Currently the only method)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/jmpanozzoz/tachyon_api.git
|
|
50
|
+
cd tachyon-api
|
|
51
|
+
pip install -r requirements.txt
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **Note:** The `pip install tachyon-api` and `poetry add tachyon-api` commands will be available once the package is published to PyPI.
|
|
55
|
+
|
|
56
|
+
## ๐ Key Differences from FastAPI
|
|
57
|
+
|
|
58
|
+
While inspired by FastAPI's elegant API design, Tachyon API takes a different approach in several key areas:
|
|
59
|
+
|
|
60
|
+
| Feature | Tachyon API | FastAPI |
|
|
61
|
+
|---------|------------|---------|
|
|
62
|
+
| **Core Dependencies** | Minimalist: Starlette + msgspec + orjson | Pydantic + multiple dependencies |
|
|
63
|
+
| **Validation Engine** | msgspec (faster, lighter) | Pydantic (more features, heavier) |
|
|
64
|
+
| **Dependency Injection** | Both implicit and explicit | Primarily explicit |
|
|
65
|
+
| **Middleware Approach** | Dual API (class + decorator) | Class-based |
|
|
66
|
+
| **Development Approach** | Test-Driven from the start | Feature-driven |
|
|
67
|
+
| **Documentation UI** | Scalar UI (default), Swagger, ReDoc | Swagger UI (default), ReDoc |
|
|
68
|
+
| **Size** | Lightweight, focused | Comprehensive, full-featured |
|
|
69
|
+
|
|
70
|
+
## ๐งช Test-Driven Development
|
|
71
|
+
|
|
72
|
+
Tachyon API is built with TDD principles at its core:
|
|
73
|
+
|
|
74
|
+
- Every feature starts with a test
|
|
75
|
+
- Comprehensive test coverage
|
|
76
|
+
- Self-contained test architecture
|
|
77
|
+
- Clear test documentation
|
|
78
|
+
|
|
79
|
+
This ensures stability, maintainability, and prevents regressions as the framework evolves.
|
|
80
|
+
|
|
81
|
+
## ๐ Core Dependencies
|
|
82
|
+
|
|
83
|
+
Tachyon API maintains a minimal, carefully selected set of dependencies:
|
|
84
|
+
|
|
85
|
+
- **[Starlette](https://www.starlette.io/)**: ASGI framework providing solid foundations
|
|
86
|
+
- **[msgspec](https://jcristharif.com/msgspec/)**: Ultra-fast serialization and validation
|
|
87
|
+
- **[orjson](https://github.com/ijl/orjson)**: High-performance JSON parser
|
|
88
|
+
- **[uvicorn](https://www.uvicorn.org/)**: ASGI server for development and production
|
|
89
|
+
|
|
90
|
+
These were chosen for their performance, lightweight nature, and focused functionality.
|
|
91
|
+
|
|
92
|
+
## ๐ Dependency Injection System
|
|
93
|
+
|
|
94
|
+
Tachyon API offers a flexible dependency injection system:
|
|
95
|
+
|
|
96
|
+
### Implicit Injection
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
@injectable
|
|
100
|
+
class UserService:
|
|
101
|
+
def __init__(self, repository: UserRepository): # Auto-injected!
|
|
102
|
+
self.repository = repository
|
|
103
|
+
|
|
104
|
+
@app.get("/users/{user_id}")
|
|
105
|
+
def get_user(user_id: int, service: UserService): # Auto-injected!
|
|
106
|
+
return service.get_user(user_id)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Explicit Injection
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
@app.get("/users/{user_id}")
|
|
113
|
+
def get_user(user_id: int, service: UserService = Depends()):
|
|
114
|
+
return service.get_user(user_id)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## ๐ Middleware Support
|
|
118
|
+
|
|
119
|
+
Tachyon API supports middlewares in two elegant ways:
|
|
120
|
+
|
|
121
|
+
### Class-based Approach
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from tachyon_api.middlewares import CORSMiddleware, LoggerMiddleware
|
|
125
|
+
|
|
126
|
+
# Add built-in CORS middleware
|
|
127
|
+
app.add_middleware(
|
|
128
|
+
CORSMiddleware,
|
|
129
|
+
allow_origins=["*"],
|
|
130
|
+
allow_methods=["*"],
|
|
131
|
+
allow_headers=["*"],
|
|
132
|
+
allow_credentials=False,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Add built-in Logger middleware
|
|
136
|
+
app.add_middleware(
|
|
137
|
+
LoggerMiddleware,
|
|
138
|
+
include_headers=True,
|
|
139
|
+
redact_headers=["authorization"],
|
|
140
|
+
)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Decorator-based Approach
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
@app.middleware()
|
|
147
|
+
async def timing_middleware(scope, receive, send, app):
|
|
148
|
+
start_time = time.time()
|
|
149
|
+
await app(scope, receive, send)
|
|
150
|
+
print(f"Request took {time.time() - start_time:.4f}s")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Built-in Middlewares
|
|
154
|
+
|
|
155
|
+
- CORSMiddleware: Handles preflight requests and injects CORS headers into responses. Highly configurable with allow_origins, allow_methods, allow_headers, allow_credentials, expose_headers, and max_age.
|
|
156
|
+
- LoggerMiddleware: Logs request start/end, duration, status code, and optionally headers and a non-intrusive body preview.
|
|
157
|
+
|
|
158
|
+
Both middlewares are standard ASGI middlewares and can be used with `app.add_middleware(...)`.
|
|
159
|
+
|
|
160
|
+
## ๐ Example Application
|
|
161
|
+
|
|
162
|
+
For a complete example showcasing all features, see the [example directory](./example). It demonstrates:
|
|
163
|
+
|
|
164
|
+
- Clean architecture with models, services, and repositories
|
|
165
|
+
- Router organization
|
|
166
|
+
- Middleware implementation
|
|
167
|
+
- Dependency injection patterns
|
|
168
|
+
- OpenAPI documentation
|
|
169
|
+
|
|
170
|
+
Built-in CORS and Logger middlewares are integrated in the example for convenience. You can toggle settings in `example/app.py`.
|
|
171
|
+
|
|
172
|
+
Run the example with:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
cd example
|
|
176
|
+
python app.py
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Then visit:
|
|
180
|
+
- **API**: http://localhost:8000/
|
|
181
|
+
- **Documentation**: http://localhost:8000/docs
|
|
182
|
+
|
|
183
|
+
## ๐ Contributing
|
|
184
|
+
|
|
185
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
186
|
+
|
|
187
|
+
1. Fork the repository
|
|
188
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
189
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
190
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
191
|
+
5. Open a Pull Request
|
|
192
|
+
|
|
193
|
+
## ๐ License
|
|
194
|
+
|
|
195
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
196
|
+
|
|
197
|
+
## ๐ฎ Roadmap
|
|
198
|
+
|
|
199
|
+
- [ ] **Exception System**: Standardized exception handling and error responses
|
|
200
|
+
- [ ] **Environment Management**: Built-in environment variable handling and uvicorn integration
|
|
201
|
+
- [ ] **CLI Tool**: Project scaffolding and service generation
|
|
202
|
+
- Directory structure generation
|
|
203
|
+
- Service and repository templates
|
|
204
|
+
- API endpoint generation
|
|
205
|
+
- [ ] **Code Quality Tools**: Ruff integration for linting and formatting
|
|
206
|
+
- [ ] **Performance Optimization**: Cython compilation for service layer via CLI
|
|
207
|
+
- [ ] **Authentication Middleware**: Built-in auth patterns and middleware
|
|
208
|
+
- [ ] **Performance Benchmarks**: Comparisons against other frameworks
|
|
209
|
+
- [ ] **More Example Applications**: Demonstrating different use cases
|
|
210
|
+
- [ ] **Plugin System**: Extensibility through plugins
|
|
211
|
+
- [ ] **Deployment Guides**: Documentation for various deployment scenarios
|
|
212
|
+
- [ ] **And much more!**
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
*Built with ๐ by developers, for developers*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "tachyon-api"
|
|
3
|
+
version = "0.5.5"
|
|
4
|
+
description = "A lightweight, FastAPI-inspired web framework"
|
|
5
|
+
authors = ["Juan Manuel Panozzo Zรฉnere <jm.panozzozenere@gmail.com>"]
|
|
6
|
+
license = "GPL-3.0-or-later"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "^3.10"
|
|
11
|
+
starlette = "^0.47.2"
|
|
12
|
+
uvicorn = "^0.35.0"
|
|
13
|
+
msgspec = "^0.19.0"
|
|
14
|
+
typer = "^0.16.0"
|
|
15
|
+
ruff = "^0.12.7"
|
|
16
|
+
orjson = "^3.11.1"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
[tool.poetry.group.dev.dependencies]
|
|
20
|
+
pytest = "^8.4.1"
|
|
21
|
+
pytest-asyncio = "^1.1.0"
|
|
22
|
+
httpx = "^0.28.1"
|
|
23
|
+
|
|
24
|
+
[build-system]
|
|
25
|
+
requires = ["poetry-core"]
|
|
26
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tachyon Web Framework
|
|
3
|
+
|
|
4
|
+
A lightweight, FastAPI-inspired web framework with built-in dependency injection,
|
|
5
|
+
automatic parameter validation, and high-performance JSON serialization.
|
|
6
|
+
|
|
7
|
+
Copyright (C) 2025 Juan Manuel Panozzo Zenere
|
|
8
|
+
|
|
9
|
+
This program is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU General Public License as published by
|
|
11
|
+
the Free Software Foundation, either version 3 of the License.
|
|
12
|
+
|
|
13
|
+
For more information, see the documentation and examples.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from .app import Tachyon
|
|
17
|
+
from .models import Struct
|
|
18
|
+
from .params import Query, Body, Path
|
|
19
|
+
from .di import injectable, Depends
|
|
20
|
+
from .router import Router
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"Tachyon",
|
|
24
|
+
"Struct",
|
|
25
|
+
"Query",
|
|
26
|
+
"Body",
|
|
27
|
+
"Path",
|
|
28
|
+
"injectable",
|
|
29
|
+
"Depends",
|
|
30
|
+
"Router",
|
|
31
|
+
]
|