tachyon-api 0.5.5__tar.gz → 0.5.7__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.7/PKG-INFO +145 -0
- tachyon_api-0.5.7/README.md +122 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/pyproject.toml +1 -1
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/__init__.py +20 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/app.py +291 -45
- tachyon_api-0.5.7/tachyon_api/cache.py +261 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/openapi.py +106 -22
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/responses.py +27 -3
- tachyon_api-0.5.5/PKG-INFO +0 -239
- tachyon_api-0.5.5/README.md +0 -216
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/LICENSE +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/di.py +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/middlewares/__init__.py +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/middlewares/core.py +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/middlewares/cors.py +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/middlewares/logger.py +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/models.py +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/params.py +0 -0
- {tachyon_api-0.5.5 → tachyon_api-0.5.7}/tachyon_api/router.py +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: tachyon-api
|
|
3
|
+
Version: 0.5.7
|
|
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 (decorators) and minimal core
|
|
56
|
+
- 🧩 Implicit & explicit DI
|
|
57
|
+
- 📚 OpenAPI with Scalar, Swagger, ReDoc
|
|
58
|
+
- 🛠️ Router system
|
|
59
|
+
- 🔄 Middlewares (class + decorator)
|
|
60
|
+
- 🧠 Cache decorator with TTL (in-memory, Redis, Memcached)
|
|
61
|
+
- 🚀 High-performance JSON (msgspec + orjson)
|
|
62
|
+
- 🧾 Unified error format (422/500)
|
|
63
|
+
- 🧰 Default JSON response (TachyonJSONResponse)
|
|
64
|
+
- 🔒 End-to-end safety: request Body validation + typed response_model
|
|
65
|
+
- 📘 Deep OpenAPI schemas: nested Structs, Optional/List (nullable/array), formats (uuid, date-time)
|
|
66
|
+
|
|
67
|
+
## 🧪 Test-Driven Development
|
|
68
|
+
|
|
69
|
+
Tachyon API is built with TDD principles at its core. The test suite covers routing, DI, params, body validation, responses, OpenAPI generation, caching, and example flows.
|
|
70
|
+
|
|
71
|
+
## 🔌 Core Dependencies
|
|
72
|
+
|
|
73
|
+
- Starlette (ASGI)
|
|
74
|
+
- msgspec (validation/serialization)
|
|
75
|
+
- orjson (fast JSON)
|
|
76
|
+
- uvicorn (server)
|
|
77
|
+
|
|
78
|
+
## 💉 Dependency Injection System
|
|
79
|
+
|
|
80
|
+
- Implicit injection: annotate with registered types
|
|
81
|
+
- Explicit injection: Depends() for clarity and control
|
|
82
|
+
|
|
83
|
+
## 🔄 Middleware Support
|
|
84
|
+
|
|
85
|
+
- Built-in: CORSMiddleware, LoggerMiddleware
|
|
86
|
+
- Use app.add_middleware(...) or @app.middleware()
|
|
87
|
+
|
|
88
|
+
## ⚡ Cache with TTL
|
|
89
|
+
|
|
90
|
+
- @cache(TTL=...) on routes and functions
|
|
91
|
+
- Per-app config and pluggable backends (InMemory, Redis, Memcached)
|
|
92
|
+
|
|
93
|
+
## 📚 Example Application
|
|
94
|
+
|
|
95
|
+
The example demonstrates clean architecture, routers, middlewares, caching, and now end-to-end safety with OpenAPI:
|
|
96
|
+
|
|
97
|
+
- /orjson-demo: default JSON powered by orjson
|
|
98
|
+
- /api/v1/users/e2e: Body + response_model, unified errors and deep OpenAPI schemas
|
|
99
|
+
|
|
100
|
+
Run the example:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
cd example
|
|
104
|
+
python app.py
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Docs at /docs (Scalar), /swagger, /redoc.
|
|
108
|
+
|
|
109
|
+
## ✅ Response models, OpenAPI params, and deep schemas
|
|
110
|
+
|
|
111
|
+
- Response models: set response_model=YourStruct to validate/convert outputs via msgspec before serializing.
|
|
112
|
+
- Parameter schemas: Optional[T] → nullable: true; List[T] → type: array with items.
|
|
113
|
+
- Deep schemas: nested Struct components, Optional/List items, and formats (uuid, date-time) are generated and referenced in components.
|
|
114
|
+
|
|
115
|
+
## 🧾 Default JSON response and unified error format
|
|
116
|
+
|
|
117
|
+
- Default response: TachyonJSONResponse serializes complex types (UUID/date/datetime, Struct) via orjson and centralized encoders.
|
|
118
|
+
- 422 Validation: { success: false, error, code: VALIDATION_ERROR, [errors] }.
|
|
119
|
+
- 500 Response model: { success: false, error: "Response validation error: ...", detail, code: RESPONSE_VALIDATION_ERROR }.
|
|
120
|
+
|
|
121
|
+
## 📝 Contributing
|
|
122
|
+
|
|
123
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
124
|
+
|
|
125
|
+
1. Fork the repository
|
|
126
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
127
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
128
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
129
|
+
5. Open a Pull Request
|
|
130
|
+
|
|
131
|
+
## 📜 License
|
|
132
|
+
|
|
133
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
134
|
+
|
|
135
|
+
## 🔮 Roadmap
|
|
136
|
+
|
|
137
|
+
- Exception system and global handlers
|
|
138
|
+
- CLI, scaffolding, and code quality tooling
|
|
139
|
+
- Authentication middleware and benchmarks
|
|
140
|
+
- More examples and deployment guides
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
*Built with 💜 by developers, for developers*
|
|
145
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
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 (decorators) and minimal core
|
|
34
|
+
- 🧩 Implicit & explicit DI
|
|
35
|
+
- 📚 OpenAPI with Scalar, Swagger, ReDoc
|
|
36
|
+
- 🛠️ Router system
|
|
37
|
+
- 🔄 Middlewares (class + decorator)
|
|
38
|
+
- 🧠 Cache decorator with TTL (in-memory, Redis, Memcached)
|
|
39
|
+
- 🚀 High-performance JSON (msgspec + orjson)
|
|
40
|
+
- 🧾 Unified error format (422/500)
|
|
41
|
+
- 🧰 Default JSON response (TachyonJSONResponse)
|
|
42
|
+
- 🔒 End-to-end safety: request Body validation + typed response_model
|
|
43
|
+
- 📘 Deep OpenAPI schemas: nested Structs, Optional/List (nullable/array), formats (uuid, date-time)
|
|
44
|
+
|
|
45
|
+
## 🧪 Test-Driven Development
|
|
46
|
+
|
|
47
|
+
Tachyon API is built with TDD principles at its core. The test suite covers routing, DI, params, body validation, responses, OpenAPI generation, caching, and example flows.
|
|
48
|
+
|
|
49
|
+
## 🔌 Core Dependencies
|
|
50
|
+
|
|
51
|
+
- Starlette (ASGI)
|
|
52
|
+
- msgspec (validation/serialization)
|
|
53
|
+
- orjson (fast JSON)
|
|
54
|
+
- uvicorn (server)
|
|
55
|
+
|
|
56
|
+
## 💉 Dependency Injection System
|
|
57
|
+
|
|
58
|
+
- Implicit injection: annotate with registered types
|
|
59
|
+
- Explicit injection: Depends() for clarity and control
|
|
60
|
+
|
|
61
|
+
## 🔄 Middleware Support
|
|
62
|
+
|
|
63
|
+
- Built-in: CORSMiddleware, LoggerMiddleware
|
|
64
|
+
- Use app.add_middleware(...) or @app.middleware()
|
|
65
|
+
|
|
66
|
+
## ⚡ Cache with TTL
|
|
67
|
+
|
|
68
|
+
- @cache(TTL=...) on routes and functions
|
|
69
|
+
- Per-app config and pluggable backends (InMemory, Redis, Memcached)
|
|
70
|
+
|
|
71
|
+
## 📚 Example Application
|
|
72
|
+
|
|
73
|
+
The example demonstrates clean architecture, routers, middlewares, caching, and now end-to-end safety with OpenAPI:
|
|
74
|
+
|
|
75
|
+
- /orjson-demo: default JSON powered by orjson
|
|
76
|
+
- /api/v1/users/e2e: Body + response_model, unified errors and deep OpenAPI schemas
|
|
77
|
+
|
|
78
|
+
Run the example:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
cd example
|
|
82
|
+
python app.py
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Docs at /docs (Scalar), /swagger, /redoc.
|
|
86
|
+
|
|
87
|
+
## ✅ Response models, OpenAPI params, and deep schemas
|
|
88
|
+
|
|
89
|
+
- Response models: set response_model=YourStruct to validate/convert outputs via msgspec before serializing.
|
|
90
|
+
- Parameter schemas: Optional[T] → nullable: true; List[T] → type: array with items.
|
|
91
|
+
- Deep schemas: nested Struct components, Optional/List items, and formats (uuid, date-time) are generated and referenced in components.
|
|
92
|
+
|
|
93
|
+
## 🧾 Default JSON response and unified error format
|
|
94
|
+
|
|
95
|
+
- Default response: TachyonJSONResponse serializes complex types (UUID/date/datetime, Struct) via orjson and centralized encoders.
|
|
96
|
+
- 422 Validation: { success: false, error, code: VALIDATION_ERROR, [errors] }.
|
|
97
|
+
- 500 Response model: { success: false, error: "Response validation error: ...", detail, code: RESPONSE_VALIDATION_ERROR }.
|
|
98
|
+
|
|
99
|
+
## 📝 Contributing
|
|
100
|
+
|
|
101
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
102
|
+
|
|
103
|
+
1. Fork the repository
|
|
104
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
105
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
106
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
107
|
+
5. Open a Pull Request
|
|
108
|
+
|
|
109
|
+
## 📜 License
|
|
110
|
+
|
|
111
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
112
|
+
|
|
113
|
+
## 🔮 Roadmap
|
|
114
|
+
|
|
115
|
+
- Exception system and global handlers
|
|
116
|
+
- CLI, scaffolding, and code quality tooling
|
|
117
|
+
- Authentication middleware and benchmarks
|
|
118
|
+
- More examples and deployment guides
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
*Built with 💜 by developers, for developers*
|
|
@@ -18,6 +18,17 @@ from .models import Struct
|
|
|
18
18
|
from .params import Query, Body, Path
|
|
19
19
|
from .di import injectable, Depends
|
|
20
20
|
from .router import Router
|
|
21
|
+
from .cache import (
|
|
22
|
+
cache,
|
|
23
|
+
CacheConfig,
|
|
24
|
+
create_cache_config,
|
|
25
|
+
set_cache_config,
|
|
26
|
+
get_cache_config,
|
|
27
|
+
InMemoryCacheBackend,
|
|
28
|
+
BaseCacheBackend,
|
|
29
|
+
RedisCacheBackend,
|
|
30
|
+
MemcachedCacheBackend,
|
|
31
|
+
)
|
|
21
32
|
|
|
22
33
|
__all__ = [
|
|
23
34
|
"Tachyon",
|
|
@@ -28,4 +39,13 @@ __all__ = [
|
|
|
28
39
|
"injectable",
|
|
29
40
|
"Depends",
|
|
30
41
|
"Router",
|
|
42
|
+
"cache",
|
|
43
|
+
"CacheConfig",
|
|
44
|
+
"create_cache_config",
|
|
45
|
+
"set_cache_config",
|
|
46
|
+
"get_cache_config",
|
|
47
|
+
"InMemoryCacheBackend",
|
|
48
|
+
"BaseCacheBackend",
|
|
49
|
+
"RedisCacheBackend",
|
|
50
|
+
"MemcachedCacheBackend",
|
|
31
51
|
]
|