tachyon-api 1.0.0__tar.gz → 1.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. tachyon_api-1.2.0/MANIFEST.in +5 -0
  2. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/PKG-INFO +65 -23
  3. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/README.md +62 -19
  4. tachyon_api-1.2.0/pyproject.toml +46 -0
  5. tachyon_api-1.2.0/setup.py +78 -0
  6. tachyon_api-1.2.0/tachyon_api/_server_fast.c +9232 -0
  7. tachyon_api-1.2.0/tachyon_api/_server_fast.pyx +102 -0
  8. tachyon_api-1.2.0/tachyon_api/app.py +477 -0
  9. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/background.py +5 -2
  10. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cache.py +9 -2
  11. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/commands/generate.py +81 -60
  12. tachyon_api-1.2.0/tachyon_api/cli/commands/new.py +94 -0
  13. tachyon_api-1.2.0/tachyon_api/cli/commands/routes.py +70 -0
  14. tachyon_api-1.2.0/tachyon_api/cli/commands/run.py +75 -0
  15. tachyon_api-1.2.0/tachyon_api/cli/commands/skill.py +91 -0
  16. tachyon_api-1.2.0/tachyon_api/cli/main.py +140 -0
  17. tachyon_api-1.2.0/tachyon_api/cli/templates/__init__.py +17 -0
  18. tachyon_api-1.2.0/tachyon_api/cli/templates/ai_skill.py +354 -0
  19. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/templates/project.py +31 -10
  20. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/templates/service.py +68 -17
  21. tachyon_api-1.2.0/tachyon_api/cli/utils.py +39 -0
  22. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/core/lifecycle.py +19 -8
  23. tachyon_api-1.2.0/tachyon_api/core/websocket.py +105 -0
  24. tachyon_api-1.2.0/tachyon_api/di.py +57 -0
  25. tachyon_api-1.2.0/tachyon_api/files.py +28 -0
  26. tachyon_api-1.2.0/tachyon_api/middlewares/__init__.py +5 -0
  27. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/middlewares/cors.py +3 -3
  28. tachyon_api-1.2.0/tachyon_api/middlewares/security_headers.py +80 -0
  29. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/models.py +2 -2
  30. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/openapi.py +70 -37
  31. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/processing/compiler.py +31 -16
  32. tachyon_api-1.2.0/tachyon_api/processing/compiler.pyx +202 -0
  33. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/processing/dependencies.py +48 -18
  34. tachyon_api-1.2.0/tachyon_api/processing/dispatch.py +87 -0
  35. tachyon_api-1.2.0/tachyon_api/processing/dispatch.pyx +97 -0
  36. tachyon_api-1.2.0/tachyon_api/processing/parameters.py +266 -0
  37. tachyon_api-1.2.0/tachyon_api/processing/parameters.pyx +351 -0
  38. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/processing/response_processor.py +9 -5
  39. tachyon_api-1.2.0/tachyon_api/processing/response_processor.pyx +46 -0
  40. tachyon_api-1.2.0/tachyon_api/processing/scope.py +100 -0
  41. tachyon_api-1.2.0/tachyon_api/processing/scope.pyx +92 -0
  42. tachyon_api-1.2.0/tachyon_api/responses.py +209 -0
  43. tachyon_api-1.2.0/tachyon_api/routing/__init__.py +3 -0
  44. tachyon_api-1.2.0/tachyon_api/routing/trie.py +137 -0
  45. tachyon_api-1.2.0/tachyon_api/routing/trie.pyx +134 -0
  46. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/security.py +10 -4
  47. tachyon_api-1.2.0/tachyon_api/server.py +101 -0
  48. tachyon_api-1.2.0/tachyon_api/testing.py +115 -0
  49. tachyon_api-1.0.0/pyproject.toml +0 -29
  50. tachyon_api-1.0.0/tachyon_api/app.py +0 -279
  51. tachyon_api-1.0.0/tachyon_api/cli/commands/new.py +0 -82
  52. tachyon_api-1.0.0/tachyon_api/cli/main.py +0 -69
  53. tachyon_api-1.0.0/tachyon_api/cli/templates/__init__.py +0 -8
  54. tachyon_api-1.0.0/tachyon_api/core/websocket.py +0 -33
  55. tachyon_api-1.0.0/tachyon_api/di.py +0 -24
  56. tachyon_api-1.0.0/tachyon_api/files.py +0 -14
  57. tachyon_api-1.0.0/tachyon_api/middlewares/__init__.py +0 -4
  58. tachyon_api-1.0.0/tachyon_api/processing/parameters.py +0 -287
  59. tachyon_api-1.0.0/tachyon_api/responses.py +0 -115
  60. tachyon_api-1.0.0/tachyon_api/testing.py +0 -45
  61. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/LICENSE +0 -0
  62. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/__init__.py +0 -0
  63. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/__init__.py +0 -0
  64. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/__main__.py +0 -0
  65. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/commands/__init__.py +0 -0
  66. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/commands/lint.py +0 -0
  67. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/cli/commands/openapi.py +0 -0
  68. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/core/__init__.py +0 -0
  69. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/exceptions.py +0 -0
  70. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/middlewares/core.py +0 -0
  71. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/middlewares/logger.py +0 -0
  72. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/params.py +0 -0
  73. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/processing/__init__.py +0 -0
  74. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/router.py +0 -0
  75. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/utils/__init__.py +0 -0
  76. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/utils/type_converter.py +0 -0
  77. {tachyon_api-1.0.0 → tachyon_api-1.2.0}/tachyon_api/utils/type_utils.py +0 -0
@@ -0,0 +1,5 @@
1
+ # Include Cython source files in sdist so users can recompile
2
+ recursive-include tachyon_api *.pyx
3
+ include setup.py
4
+ include README.md
5
+ include LICENSE
@@ -1,9 +1,8 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: tachyon-api
3
- Version: 1.0.0
3
+ Version: 1.2.0
4
4
  Summary: A lightweight, FastAPI-inspired web framework
5
5
  License: GPL-3.0-or-later
6
- License-File: LICENSE
7
6
  Author: Juan Manuel Panozzo Zénere
8
7
  Author-email: jm.panozzozenere@gmail.com
9
8
  Requires-Python: >=3.10,<4.0
@@ -13,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
15
14
  Classifier: Programming Language :: Python :: 3.13
16
- Classifier: Programming Language :: Python :: 3.14
15
+ Provides-Extra: fast
17
16
  Requires-Dist: msgspec (>=0.19.0,<0.20.0)
18
17
  Requires-Dist: orjson (>=3.11.1,<4.0.0)
19
18
  Requires-Dist: python-multipart (>=0.0.20,<0.0.21)
@@ -24,7 +23,7 @@ Description-Content-Type: text/markdown
24
23
 
25
24
  # 🚀 Tachyon API
26
25
 
27
- ![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)
26
+ ![Version](https://img.shields.io/badge/version-1.1.0-blue.svg)
28
27
  ![Python](https://img.shields.io/badge/python-3.10+-brightgreen.svg)
29
28
  ![License](https://img.shields.io/badge/license-GPL--3.0-orange.svg)
30
29
  ![Tests](https://img.shields.io/badge/tests-233%20passed-brightgreen.svg)
@@ -69,30 +68,47 @@ uvicorn app:app --reload
69
68
 
70
69
  ## ⚡ Performance
71
70
 
72
- Benchmarked against **FastAPI 0.136.1 (Pydantic v2)** · 1 worker · 100 concurrent connections · uvloop + httptools
71
+ Benchmarked against **FastAPI 0.136.1 (Pydantic v2)** · 1 worker · 100 concurrent connections · uvloop + httptools · Cython extensions compiled
73
72
 
74
73
  | Scenario | FastAPI | Tachyon | Speedup |
75
74
  |---|---:|---:|---:|
76
- | Hello World | 10,283 req/s | **40,545 req/s** | **3.94x** |
77
- | Path + query params | 7,133 req/s | **30,637 req/s** | **4.30x** |
78
- | Body validation (Struct) | 8,336 req/s | **31,808 req/s** | **3.82x** |
79
- | Nested body (complex Struct) | 8,006 req/s | **30,807 req/s** | **3.85x** |
80
- | Response model serialization | 6,673 req/s | **34,991 req/s** | **5.24x** |
81
- | Header param + auth | 8,662 req/s | **34,126 req/s** | **3.94x** |
82
- | Dependency injection | 6,225 req/s | **32,941 req/s** | **5.29x** |
83
- | Multiple query params | 6,242 req/s | **25,915 req/s** | **4.15x** |
84
- | **Total throughput** | **61,560 req/s** | **261,770 req/s** | **4.25x** |
85
-
86
- **Latency:** ~3ms (Tachyon) vs ~14ms (FastAPI) on average.
75
+ | Hello World | 10,378 req/s | **49,521 req/s** | **4.77x** |
76
+ | Path + query params | 7,294 req/s | **37,991 req/s** | **5.21x** |
77
+ | Body validation (Struct) | 8,533 req/s | **41,507 req/s** | **4.86x** |
78
+ | Nested body (complex Struct) | 8,205 req/s | **40,816 req/s** | **4.97x** |
79
+ | Response model serialization | 6,766 req/s | **47,777 req/s** | **7.06x** |
80
+ | Header param + auth | 8,705 req/s | **46,013 req/s** | **5.29x** |
81
+ | Dependency injection | 6,491 req/s | **46,940 req/s** | **7.23x** |
82
+ | Multiple query params | 6,325 req/s | **34,481 req/s** | **5.45x** |
83
+ | **Total throughput** | **62,697 req/s** | **345,046 req/s** | **5.50x** |
84
+
85
+ **Latency:** ~2.3ms (Tachyon) vs ~13ms (FastAPI) on average.
87
86
 
88
87
  > Benchmark code in [`benchmark/`](./benchmark/). Run with `bash benchmark/run_benchmark.sh`.
89
88
 
89
+ ### Optional: Cython compilation
90
+
91
+ Install with Cython extensions for additional speedup on the request hot path:
92
+
93
+ ```bash
94
+ pip install tachyon-api[fast] # installs cython dependency
95
+ python setup.py build_ext --inplace # compile extensions (required step)
96
+ ```
97
+
98
+ > **Note:** `pip install tachyon-api[fast]` installs the `cython` package but does **not**
99
+ > auto-compile the extensions. Run `python setup.py build_ext --inplace` manually after install.
100
+ > Falls back to pure Python automatically when `.so` is not present — no code changes needed.
101
+ > Numbers above reflect the compiled version (~11% faster Python hot path).
102
+
90
103
  ### Why is Tachyon faster?
91
104
 
105
+ - **Radix trie routing** — O(k) path matching vs Starlette's O(N×regex) scan; trie compiled to C
106
+ - **Middleware bypass** — HTTP requests skip Starlette's `ServerErrorMiddleware` and `ExceptionMiddleware` entirely; exceptions handled directly in each closure
92
107
  - **Endpoint pre-compilation** — `inspect.signature()`, `isinstance` chains, type resolution, and `msgspec.Decoder` creation run once at startup, not per request
108
+ - **No-Request fast path** — endpoints with no parameters skip `Request()` creation and call the ASGI handler directly
93
109
  - **msgspec** — validation and deserialization in C, 5–10x faster than Pydantic
94
110
  - **Direct serialization** — `Struct` responses use `msgspec.json.encode()` directly (no Python intermediate step)
95
- - **Minimal response overhead** — custom response class bypasses Starlette's `MutableHeaders` construction
111
+ - **Pre-built ASGI dicts** — response send payloads constructed once in `__init__`, not recreated per request
96
112
  - **No middleware bloat** — Tachyon mounts only what you register; FastAPI adds ~15 middlewares by default
97
113
 
98
114
  ---
@@ -238,16 +254,40 @@ async def websocket(ws):
238
254
  ## 🔧 CLI Tools
239
255
 
240
256
  ```bash
241
- # Create new project
257
+ # Create project (generates .env.example, config.py with dotenv, clean arch)
242
258
  tachyon new my-api
243
259
 
244
- # Generate module
245
- tachyon generate service users --crud
260
+ # Start development server (uvloop + httptools auto-detected, reload on)
261
+ tachyon run
262
+
263
+ # List all registered routes
264
+ tachyon routes
265
+
266
+ # Generate a full CRUD module
267
+ tachyon g service users --crud
268
+
269
+ # Generate an ASGI middleware skeleton
270
+ tachyon g middleware auth
246
271
 
247
272
  # Code quality
248
273
  tachyon lint all
249
274
  ```
250
275
 
276
+ **Name validation:** hyphens auto-converted to underscores (`my-api` → `my_api`), Python keywords rejected with a clear error.
277
+
278
+ ### AI Agent Integration
279
+
280
+ Teach your AI coding assistant (Claude Code, Cursor, Copilot, OpenCode, Codex) how to write correct Tachyon code:
281
+
282
+ ```bash
283
+ tachyon install-skill # generates context files for all tools
284
+ tachyon install-skill --cursor # only .cursorrules
285
+ tachyon install-skill --claude # only CLAUDE.md
286
+ tachyon install-skill --copilot # only .github/copilot-instructions.md
287
+ ```
288
+
289
+ Installs knowledge about `Body()` requirement, `Struct` vs BaseModel, DI patterns, CLI commands, and anti-patterns. Safe to run multiple times.
290
+
251
291
  👉 [Full CLI documentation](./docs/12-cli.md)
252
292
 
253
293
  ---
@@ -275,10 +315,12 @@ pytest tests/ -v
275
315
 
276
316
  | Feature | Tachyon | FastAPI |
277
317
  |---------|---------|---------|
278
- | **Throughput** | ~262k req/s total | ~62k req/s total |
279
- | **Latency** | ~3ms avg | ~14ms avg |
318
+ | **Throughput** | ~336k req/s total | ~60k req/s total |
319
+ | **Latency** | ~2.1ms avg | ~14ms avg |
320
+ | **Routing** | Radix trie O(k) | Regex scan O(N) |
280
321
  | **Serialization** | msgspec + orjson | Pydantic v2 |
281
322
  | **Request compilation** | Once at startup | Per request |
323
+ | **Middleware overhead** | User-only stack | +2 auto middleware layers |
282
324
  | **Bundle size** | Minimal (4 deps) | Larger (~15 deps) |
283
325
  | **Learning curve** | Easy (FastAPI-like) | Easy |
284
326
  | **Type safety** | Full (msgspec Struct) | Full (Pydantic) |
@@ -1,6 +1,6 @@
1
1
  # 🚀 Tachyon API
2
2
 
3
- ![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)
3
+ ![Version](https://img.shields.io/badge/version-1.1.0-blue.svg)
4
4
  ![Python](https://img.shields.io/badge/python-3.10+-brightgreen.svg)
5
5
  ![License](https://img.shields.io/badge/license-GPL--3.0-orange.svg)
6
6
  ![Tests](https://img.shields.io/badge/tests-233%20passed-brightgreen.svg)
@@ -45,30 +45,47 @@ uvicorn app:app --reload
45
45
 
46
46
  ## ⚡ Performance
47
47
 
48
- Benchmarked against **FastAPI 0.136.1 (Pydantic v2)** · 1 worker · 100 concurrent connections · uvloop + httptools
48
+ Benchmarked against **FastAPI 0.136.1 (Pydantic v2)** · 1 worker · 100 concurrent connections · uvloop + httptools · Cython extensions compiled
49
49
 
50
50
  | Scenario | FastAPI | Tachyon | Speedup |
51
51
  |---|---:|---:|---:|
52
- | Hello World | 10,283 req/s | **40,545 req/s** | **3.94x** |
53
- | Path + query params | 7,133 req/s | **30,637 req/s** | **4.30x** |
54
- | Body validation (Struct) | 8,336 req/s | **31,808 req/s** | **3.82x** |
55
- | Nested body (complex Struct) | 8,006 req/s | **30,807 req/s** | **3.85x** |
56
- | Response model serialization | 6,673 req/s | **34,991 req/s** | **5.24x** |
57
- | Header param + auth | 8,662 req/s | **34,126 req/s** | **3.94x** |
58
- | Dependency injection | 6,225 req/s | **32,941 req/s** | **5.29x** |
59
- | Multiple query params | 6,242 req/s | **25,915 req/s** | **4.15x** |
60
- | **Total throughput** | **61,560 req/s** | **261,770 req/s** | **4.25x** |
61
-
62
- **Latency:** ~3ms (Tachyon) vs ~14ms (FastAPI) on average.
52
+ | Hello World | 10,378 req/s | **49,521 req/s** | **4.77x** |
53
+ | Path + query params | 7,294 req/s | **37,991 req/s** | **5.21x** |
54
+ | Body validation (Struct) | 8,533 req/s | **41,507 req/s** | **4.86x** |
55
+ | Nested body (complex Struct) | 8,205 req/s | **40,816 req/s** | **4.97x** |
56
+ | Response model serialization | 6,766 req/s | **47,777 req/s** | **7.06x** |
57
+ | Header param + auth | 8,705 req/s | **46,013 req/s** | **5.29x** |
58
+ | Dependency injection | 6,491 req/s | **46,940 req/s** | **7.23x** |
59
+ | Multiple query params | 6,325 req/s | **34,481 req/s** | **5.45x** |
60
+ | **Total throughput** | **62,697 req/s** | **345,046 req/s** | **5.50x** |
61
+
62
+ **Latency:** ~2.3ms (Tachyon) vs ~13ms (FastAPI) on average.
63
63
 
64
64
  > Benchmark code in [`benchmark/`](./benchmark/). Run with `bash benchmark/run_benchmark.sh`.
65
65
 
66
+ ### Optional: Cython compilation
67
+
68
+ Install with Cython extensions for additional speedup on the request hot path:
69
+
70
+ ```bash
71
+ pip install tachyon-api[fast] # installs cython dependency
72
+ python setup.py build_ext --inplace # compile extensions (required step)
73
+ ```
74
+
75
+ > **Note:** `pip install tachyon-api[fast]` installs the `cython` package but does **not**
76
+ > auto-compile the extensions. Run `python setup.py build_ext --inplace` manually after install.
77
+ > Falls back to pure Python automatically when `.so` is not present — no code changes needed.
78
+ > Numbers above reflect the compiled version (~11% faster Python hot path).
79
+
66
80
  ### Why is Tachyon faster?
67
81
 
82
+ - **Radix trie routing** — O(k) path matching vs Starlette's O(N×regex) scan; trie compiled to C
83
+ - **Middleware bypass** — HTTP requests skip Starlette's `ServerErrorMiddleware` and `ExceptionMiddleware` entirely; exceptions handled directly in each closure
68
84
  - **Endpoint pre-compilation** — `inspect.signature()`, `isinstance` chains, type resolution, and `msgspec.Decoder` creation run once at startup, not per request
85
+ - **No-Request fast path** — endpoints with no parameters skip `Request()` creation and call the ASGI handler directly
69
86
  - **msgspec** — validation and deserialization in C, 5–10x faster than Pydantic
70
87
  - **Direct serialization** — `Struct` responses use `msgspec.json.encode()` directly (no Python intermediate step)
71
- - **Minimal response overhead** — custom response class bypasses Starlette's `MutableHeaders` construction
88
+ - **Pre-built ASGI dicts** — response send payloads constructed once in `__init__`, not recreated per request
72
89
  - **No middleware bloat** — Tachyon mounts only what you register; FastAPI adds ~15 middlewares by default
73
90
 
74
91
  ---
@@ -214,16 +231,40 @@ async def websocket(ws):
214
231
  ## 🔧 CLI Tools
215
232
 
216
233
  ```bash
217
- # Create new project
234
+ # Create project (generates .env.example, config.py with dotenv, clean arch)
218
235
  tachyon new my-api
219
236
 
220
- # Generate module
221
- tachyon generate service users --crud
237
+ # Start development server (uvloop + httptools auto-detected, reload on)
238
+ tachyon run
239
+
240
+ # List all registered routes
241
+ tachyon routes
242
+
243
+ # Generate a full CRUD module
244
+ tachyon g service users --crud
245
+
246
+ # Generate an ASGI middleware skeleton
247
+ tachyon g middleware auth
222
248
 
223
249
  # Code quality
224
250
  tachyon lint all
225
251
  ```
226
252
 
253
+ **Name validation:** hyphens auto-converted to underscores (`my-api` → `my_api`), Python keywords rejected with a clear error.
254
+
255
+ ### AI Agent Integration
256
+
257
+ Teach your AI coding assistant (Claude Code, Cursor, Copilot, OpenCode, Codex) how to write correct Tachyon code:
258
+
259
+ ```bash
260
+ tachyon install-skill # generates context files for all tools
261
+ tachyon install-skill --cursor # only .cursorrules
262
+ tachyon install-skill --claude # only CLAUDE.md
263
+ tachyon install-skill --copilot # only .github/copilot-instructions.md
264
+ ```
265
+
266
+ Installs knowledge about `Body()` requirement, `Struct` vs BaseModel, DI patterns, CLI commands, and anti-patterns. Safe to run multiple times.
267
+
227
268
  👉 [Full CLI documentation](./docs/12-cli.md)
228
269
 
229
270
  ---
@@ -251,10 +292,12 @@ pytest tests/ -v
251
292
 
252
293
  | Feature | Tachyon | FastAPI |
253
294
  |---------|---------|---------|
254
- | **Throughput** | ~262k req/s total | ~62k req/s total |
255
- | **Latency** | ~3ms avg | ~14ms avg |
295
+ | **Throughput** | ~336k req/s total | ~60k req/s total |
296
+ | **Latency** | ~2.1ms avg | ~14ms avg |
297
+ | **Routing** | Radix trie O(k) | Regex scan O(N) |
256
298
  | **Serialization** | msgspec + orjson | Pydantic v2 |
257
299
  | **Request compilation** | Once at startup | Per request |
300
+ | **Middleware overhead** | User-only stack | +2 auto middleware layers |
258
301
  | **Bundle size** | Minimal (4 deps) | Larger (~15 deps) |
259
302
  | **Learning curve** | Easy (FastAPI-like) | Easy |
260
303
  | **Type safety** | Full (msgspec Struct) | Full (Pydantic) |
@@ -0,0 +1,46 @@
1
+ [tool.poetry]
2
+ name = "tachyon-api"
3
+ version = "1.2.0"
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
+ include = [
9
+ { path = "setup.py", format = ["sdist"] },
10
+ { path = "MANIFEST.in", format = ["sdist"] },
11
+ { path = "tachyon_api/routing/trie.pyx", format = ["sdist"] },
12
+ { path = "tachyon_api/processing/compiler.pyx", format = ["sdist"] },
13
+ { path = "tachyon_api/processing/parameters.pyx", format = ["sdist"] },
14
+ { path = "tachyon_api/processing/response_processor.pyx", format = ["sdist"] },
15
+ { path = "tachyon_api/_server_fast.pyx", format = ["sdist"] },
16
+ ]
17
+
18
+ [tool.poetry.dependencies]
19
+ python = "^3.10"
20
+ starlette = "^0.47.2"
21
+ uvicorn = "^0.35.0"
22
+ msgspec = "^0.19.0"
23
+ typer = "^0.16.0"
24
+ orjson = "^3.11.1"
25
+ python-multipart = "^0.0.20"
26
+
27
+ [tool.poetry.extras]
28
+ # Note: pip install tachyon-api[fast] installs cython but does NOT auto-compile.
29
+ # Run `python setup.py build_ext --inplace` manually after install.
30
+ fast = ["cython"]
31
+
32
+ [tool.poetry.group.dev.dependencies]
33
+ pytest = "^8.4.1"
34
+ pytest-asyncio = "^1.1.0"
35
+ httpx = "^0.28.1"
36
+ ruff = "0.14.9"
37
+ cython = ">=3.0"
38
+ fastapi = "^0.136.1"
39
+ pydantic = "^2.13.4"
40
+
41
+ [tool.poetry.scripts]
42
+ tachyon = "tachyon_api.cli:app"
43
+
44
+ [build-system]
45
+ requires = ["poetry-core"]
46
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,78 @@
1
+ """
2
+ Build Cython extensions for the tachyon_api hot path.
3
+
4
+ pip install tachyon-api[fast] # install with compilation
5
+ python setup.py build_ext --inplace # compile in-place for development
6
+
7
+ The compiled .so files are preferred over .py by Python's import system
8
+ automatically. Falls back to pure Python when .so is not present.
9
+ """
10
+
11
+ from setuptools import setup
12
+ from setuptools.dist import Distribution
13
+
14
+ try:
15
+ from Cython.Build import cythonize
16
+ from setuptools import Extension
17
+ import sys
18
+
19
+ # Compiler flags for performance
20
+ extra_compile_args = ["-O2"]
21
+ if sys.platform != "win32":
22
+ extra_compile_args += ["-ffast-math"]
23
+
24
+ extensions = [
25
+ Extension(
26
+ "tachyon_api.routing.trie",
27
+ sources=["tachyon_api/routing/trie.pyx"],
28
+ extra_compile_args=extra_compile_args,
29
+ ),
30
+ Extension(
31
+ "tachyon_api.processing.compiler",
32
+ sources=["tachyon_api/processing/compiler.pyx"],
33
+ extra_compile_args=extra_compile_args,
34
+ ),
35
+ Extension(
36
+ "tachyon_api.processing.parameters",
37
+ sources=["tachyon_api/processing/parameters.pyx"],
38
+ extra_compile_args=extra_compile_args,
39
+ ),
40
+ Extension(
41
+ "tachyon_api.processing.response_processor",
42
+ sources=["tachyon_api/processing/response_processor.pyx"],
43
+ extra_compile_args=extra_compile_args,
44
+ ),
45
+ Extension(
46
+ "tachyon_api.processing.scope",
47
+ sources=["tachyon_api/processing/scope.pyx"],
48
+ extra_compile_args=extra_compile_args,
49
+ ),
50
+ Extension(
51
+ "tachyon_api.processing.dispatch",
52
+ sources=["tachyon_api/processing/dispatch.pyx"],
53
+ extra_compile_args=extra_compile_args,
54
+ ),
55
+ Extension(
56
+ "tachyon_api._server_fast",
57
+ sources=["tachyon_api/_server_fast.pyx"],
58
+ extra_compile_args=extra_compile_args,
59
+ ),
60
+ ]
61
+
62
+ setup(
63
+ ext_modules=cythonize(
64
+ extensions,
65
+ compiler_directives={
66
+ "language_level": "3",
67
+ "boundscheck": False,
68
+ "wraparound": False,
69
+ "nonecheck": False,
70
+ "cdivision": True,
71
+ "embedsignature": False,
72
+ },
73
+ annotate=False,
74
+ ),
75
+ )
76
+ except ImportError:
77
+ # Cython not available — install without extensions (pure Python fallback)
78
+ setup()