tachyon-api 0.5.5__tar.gz → 0.5.9__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.

@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.3
2
+ Name: tachyon-api
3
+ Version: 0.5.9
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: starlette (>=0.47.2,<0.48.0)
18
+ Requires-Dist: typer (>=0.16.0,<0.17.0)
19
+ Requires-Dist: uvicorn (>=0.35.0,<0.36.0)
20
+ Description-Content-Type: text/markdown
21
+
22
+ # 🚀 Tachyon API
23
+
24
+ ![Version](https://img.shields.io/badge/version-0.5.7-blue.svg)
25
+ ![Python](https://img.shields.io/badge/python-3.10+-brightgreen.svg)
26
+ ![License](https://img.shields.io/badge/license-GPL--3.0-orange.svg)
27
+ ![Status](https://img.shields.io/badge/status-stable-brightgreen.svg)
28
+
29
+ **A lightweight, high-performance API framework for Python with the elegance of FastAPI and the speed of light.**
30
+
31
+ 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.
32
+
33
+ ```python
34
+ from tachyon_api import Tachyon
35
+ from tachyon_api.models import Struct
36
+
37
+ app = Tachyon()
38
+
39
+ class User(Struct):
40
+ name: str
41
+ age: int
42
+
43
+ @app.get("/")
44
+ def hello_world():
45
+ return {"message": "Tachyon is running at lightspeed!"}
46
+
47
+ @app.post("/users")
48
+ def create_user(user: User):
49
+ return {"created": user.name}
50
+ ```
51
+
52
+ ## ✨ Features
53
+
54
+ - 🔍 Intuitive API (decorators) and minimal core
55
+ - 🧩 Implicit & explicit DI
56
+ - 📚 OpenAPI with Scalar, Swagger, ReDoc
57
+ - 🛠️ Router system
58
+ - 🔄 Middlewares (class + decorator)
59
+ - 🧠 Cache decorator with TTL (in-memory, Redis, Memcached)
60
+ - 🚀 High-performance JSON (msgspec + orjson)
61
+ - 🧾 Unified error format (422/500) + global exception handler (500)
62
+ - 🧰 Default JSON response (TachyonJSONResponse)
63
+ - 🔒 End-to-end safety: request Body validation + typed response_model
64
+ - 📘 Deep OpenAPI schemas: nested Structs, Optional/List (nullable/array), formats (uuid, date-time)
65
+
66
+ ## 🧪 Test-Driven Development
67
+
68
+ 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.
69
+
70
+ ## 🔌 Core Dependencies
71
+
72
+ - Starlette (ASGI)
73
+ - msgspec (validation/serialization)
74
+ - orjson (fast JSON)
75
+ - uvicorn (server)
76
+
77
+ ## 💉 Dependency Injection System
78
+
79
+ - Implicit injection: annotate with registered types
80
+ - Explicit injection: Depends() for clarity and control
81
+
82
+ ## 🔄 Middleware Support
83
+
84
+ - Built-in: CORSMiddleware and LoggerMiddleware
85
+ - Use app.add_middleware(...) or @app.middleware()
86
+
87
+ ## ⚡ Cache with TTL
88
+
89
+ - @cache(TTL=...) on routes and functions
90
+ - Per-app config and pluggable backends (InMemory, Redis, Memcached)
91
+
92
+ ## 📚 Example Application
93
+
94
+ The example demonstrates clean architecture, routers, middlewares, caching, end-to-end safety, and global exception handling:
95
+
96
+ - /orjson-demo: default JSON powered by orjson
97
+ - /api/v1/users/e2e: Body + response_model, unified errors and deep OpenAPI schemas
98
+ - /error-demo: triggers an unhandled exception to showcase the global handler (structured 500)
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
+ - 500 Unhandled exceptions (global): { success: false, error: "Internal Server Error", code: INTERNAL_SERVER_ERROR }.
121
+
122
+ ## 📝 Contributing
123
+
124
+ Contributions are welcome! Please feel free to submit a Pull Request.
125
+
126
+ 1. Fork the repository
127
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
128
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
129
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
130
+ 5. Open a Pull Request
131
+
132
+ ## 📜 License
133
+
134
+ This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
135
+
136
+ ## 🔮 Roadmap
137
+
138
+ - Exception system and global handlers
139
+ - CLI, scaffolding, and code quality tooling
140
+ - Authentication middleware and benchmarks
141
+ - More examples and deployment guides
142
+
143
+ ---
144
+
145
+ *Built with 💜 by developers, for developers*
146
+
@@ -0,0 +1,124 @@
1
+ # 🚀 Tachyon API
2
+
3
+ ![Version](https://img.shields.io/badge/version-0.5.7-blue.svg)
4
+ ![Python](https://img.shields.io/badge/python-3.10+-brightgreen.svg)
5
+ ![License](https://img.shields.io/badge/license-GPL--3.0-orange.svg)
6
+ ![Status](https://img.shields.io/badge/status-stable-brightgreen.svg)
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) + global exception handler (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 and 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, end-to-end safety, and global exception handling:
74
+
75
+ - /orjson-demo: default JSON powered by orjson
76
+ - /api/v1/users/e2e: Body + response_model, unified errors and deep OpenAPI schemas
77
+ - /error-demo: triggers an unhandled exception to showcase the global handler (structured 500)
78
+
79
+ Run the example:
80
+
81
+ ```
82
+ cd example
83
+ python app.py
84
+ ```
85
+
86
+ Docs at /docs (Scalar), /swagger, /redoc.
87
+
88
+ ## ✅ Response models, OpenAPI params, and deep schemas
89
+
90
+ - Response models: set response_model=YourStruct to validate/convert outputs via msgspec before serializing.
91
+ - Parameter schemas: Optional[T] → nullable: true; List[T] → type: array with items.
92
+ - Deep schemas: nested Struct components, Optional/List items, and formats (uuid, date-time) are generated and referenced in components.
93
+
94
+ ## 🧾 Default JSON response and unified error format
95
+
96
+ - Default response: TachyonJSONResponse serializes complex types (UUID/date/datetime, Struct) via orjson and centralized encoders.
97
+ - 422 Validation: { success: false, error, code: VALIDATION_ERROR, [errors] }.
98
+ - 500 Response model: { success: false, error: "Response validation error: ...", detail, code: RESPONSE_VALIDATION_ERROR }.
99
+ - 500 Unhandled exceptions (global): { success: false, error: "Internal Server Error", code: INTERNAL_SERVER_ERROR }.
100
+
101
+ ## 📝 Contributing
102
+
103
+ Contributions are welcome! Please feel free to submit a Pull Request.
104
+
105
+ 1. Fork the repository
106
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
107
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
108
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
109
+ 5. Open a Pull Request
110
+
111
+ ## 📜 License
112
+
113
+ This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
114
+
115
+ ## 🔮 Roadmap
116
+
117
+ - Exception system and global handlers
118
+ - CLI, scaffolding, and code quality tooling
119
+ - Authentication middleware and benchmarks
120
+ - More examples and deployment guides
121
+
122
+ ---
123
+
124
+ *Built with 💜 by developers, for developers*
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "tachyon-api"
3
- version = "0.5.5"
3
+ version = "0.5.9"
4
4
  description = "A lightweight, FastAPI-inspired web framework"
5
5
  authors = ["Juan Manuel Panozzo Zénere <jm.panozzozenere@gmail.com>"]
6
6
  license = "GPL-3.0-or-later"
@@ -12,7 +12,6 @@ starlette = "^0.47.2"
12
12
  uvicorn = "^0.35.0"
13
13
  msgspec = "^0.19.0"
14
14
  typer = "^0.16.0"
15
- ruff = "^0.12.7"
16
15
  orjson = "^3.11.1"
17
16
 
18
17
 
@@ -20,6 +19,7 @@ orjson = "^3.11.1"
20
19
  pytest = "^8.4.1"
21
20
  pytest-asyncio = "^1.1.0"
22
21
  httpx = "^0.28.1"
22
+ ruff = "^0.12.7"
23
23
 
24
24
  [build-system]
25
25
  requires = ["poetry-core"]
@@ -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
  ]