bfast-py 0.1.0__cp38-abi3-win_amd64.whl → 1.0.4__cp38-abi3-win_amd64.whl
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.
- b_fast/b_fast.pyd +0 -0
- bfast_py-1.0.4.dist-info/METADATA +131 -0
- bfast_py-1.0.4.dist-info/RECORD +6 -0
- bfast_py-0.1.0.dist-info/METADATA +0 -17
- bfast_py-0.1.0.dist-info/RECORD +0 -6
- {bfast_py-0.1.0.dist-info → bfast_py-1.0.4.dist-info}/WHEEL +0 -0
- {bfast_py-0.1.0.dist-info → bfast_py-1.0.4.dist-info}/licenses/LICENSE +0 -0
b_fast/b_fast.pyd
CHANGED
|
Binary file
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bfast-py
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Requires-Dist: pydantic>=2.0
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Requires-Dist: matplotlib>=3.7.5 ; extra == 'dev'
|
|
17
|
+
Requires-Dist: orjson>=3.10.15 ; extra == 'dev'
|
|
18
|
+
Requires-Dist: mkdocs-material>=9.7.1 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: mkdocstrings[python]>=0.26.1 ; extra == 'dev'
|
|
20
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
21
|
+
Requires-Dist: black>=23.0 ; extra == 'dev'
|
|
22
|
+
Requires-Dist: ruff>=0.1.0 ; extra == 'dev'
|
|
23
|
+
Requires-Dist: fastapi ; extra == 'fastapi'
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Provides-Extra: fastapi
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Summary: ⚡ B-FAST (Binary Fast Adaptive Serialization Transfer) - Protocolo de serialização binária de ultra-alta performance, desenvolvido em Rust para o ecossistema Python e TypeScript
|
|
28
|
+
Keywords: serialization,binary,fast,rust,pydantic,numpy
|
|
29
|
+
Author: marcelomarkus
|
|
30
|
+
License: MIT
|
|
31
|
+
Requires-Python: >=3.8
|
|
32
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
33
|
+
Project-URL: Homepage, https://github.com/marcelomarkus/b-fast
|
|
34
|
+
Project-URL: Issues, https://github.com/marcelomarkus/b-fast/issues
|
|
35
|
+
Project-URL: Repository, https://github.com/marcelomarkus/b-fast
|
|
36
|
+
|
|
37
|
+
## ⚡ B-FAST (Binary Fast Adaptive Serialization Transfer)
|
|
38
|
+
|
|
39
|
+
O B-FAST é um protocolo de serialização binária de ultra-alta performance, desenvolvido em Rust para o ecossistema Python e TypeScript. Ele foi projetado para substituir o JSON em rotas críticas onde latência, uso de CPU e largura de banda são gargalos.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 🚀 Por que B-FAST?
|
|
43
|
+
- **Motor Rust:** Serialização nativa sem o overhead do interpretador Python.
|
|
44
|
+
- **Pydantic Native:** Lê atributos de modelos Pydantic diretamente da memória, pulando o lento processo de .model_dump().
|
|
45
|
+
- **Zero-Copy NumPy:** Serializa tensores e arrays numéricos diretamente, atingindo a velocidade máxima de I/O de memória.
|
|
46
|
+
- **String Interning:** Chaves repetidas (como nomes de campos em listas de objetos) são enviadas apenas uma vez.
|
|
47
|
+
- **Bit-Packing:** Inteiros pequenos e booleanos ocupam apenas 4 bits dentro da tag de tipo.
|
|
48
|
+
- **LZ4 Integrado:** Compressão de blocos ultra-veloz para payloads grandes.
|
|
49
|
+
|
|
50
|
+
## 📊 Benchmark (Latência Média)
|
|
51
|
+
Comparação de serialização de uma lista de 10.000 modelos Pydantic complexos:
|
|
52
|
+
|
|
53
|
+
| Formato | Tempo (ms) | Tamanho do Payload |
|
|
54
|
+
|---------|------------|-------------------|
|
|
55
|
+
| JSON (Standard) | 45.2ms | 1.2 MB |
|
|
56
|
+
| Orjson | 12.8ms | 1.1 MB |
|
|
57
|
+
| B-FAST | 1.4ms | 240 KB |
|
|
58
|
+
|
|
59
|
+
## 📦 Instalação
|
|
60
|
+
|
|
61
|
+
### Backend (Python)
|
|
62
|
+
```bash
|
|
63
|
+
uv add bfast-py
|
|
64
|
+
```
|
|
65
|
+
ou
|
|
66
|
+
```bash
|
|
67
|
+
pip install bfast-py
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Frontend (TypeScript)
|
|
71
|
+
```bash
|
|
72
|
+
npm install bfast-client
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 🛠️ Como usar
|
|
76
|
+
|
|
77
|
+
### 1. No FastAPI (Integração Direta)
|
|
78
|
+
O B-FAST se integra perfeitamente como uma classe de resposta.
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from fastapi import FastAPI, Response
|
|
82
|
+
from pydantic import BaseModel
|
|
83
|
+
import b_fast
|
|
84
|
+
|
|
85
|
+
class BFastResponse(Response):
|
|
86
|
+
media_type = "application/x-bfast"
|
|
87
|
+
|
|
88
|
+
def __init__(self, content=None, *args, **kwargs):
|
|
89
|
+
super().__init__(content, *args, **kwargs)
|
|
90
|
+
self.encoder = b_fast.BFast()
|
|
91
|
+
|
|
92
|
+
def render(self, content) -> bytes:
|
|
93
|
+
return self.encoder.encode_packed(content, compress=True)
|
|
94
|
+
|
|
95
|
+
app = FastAPI()
|
|
96
|
+
|
|
97
|
+
class User(BaseModel):
|
|
98
|
+
id: int
|
|
99
|
+
name: str
|
|
100
|
+
|
|
101
|
+
@app.get("/users", response_class=BFastResponse)
|
|
102
|
+
async def get_users():
|
|
103
|
+
return [User(id=i, name=f"User {i}") for i in range(1000)]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 2. No Frontend (React / Vue / Angular)
|
|
107
|
+
```typescript
|
|
108
|
+
import { BFastDecoder } from 'bfast-client';
|
|
109
|
+
|
|
110
|
+
async function loadData() {
|
|
111
|
+
const response = await fetch('/users');
|
|
112
|
+
const buffer = await response.arrayBuffer();
|
|
113
|
+
|
|
114
|
+
// Decodifica e descomprime LZ4 automaticamente
|
|
115
|
+
const users = BFastDecoder.decode(buffer);
|
|
116
|
+
console.log(users);
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## About B-FAST
|
|
121
|
+
|
|
122
|
+
> "Knowledge is the only wealth that grows when we share it"
|
|
123
|
+
|
|
124
|
+
B-FAST was born from the belief that high-performance tools should be accessible to everyone. This project represents our commitment to open-source innovation and the sharing of knowledge that drives the developer community forward.
|
|
125
|
+
|
|
126
|
+
**Developed by:** [marcelomarkus](https://github.com/marcelomarkus)
|
|
127
|
+
|
|
128
|
+
**Philosophy:** We believe that by sharing efficient solutions, we collectively raise the bar for what's possible in software development. B-FAST is our contribution to a faster, more efficient web.
|
|
129
|
+
|
|
130
|
+
## 📄 Licença
|
|
131
|
+
Distribuído sob a licença MIT. Veja LICENSE para mais informações.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
b_fast\__init__.py,sha256=3JTYzuf6_39pzLR3L8me9rsz_bnKsP4nVICPaL_tnko,107
|
|
2
|
+
b_fast\b_fast.pyd,sha256=4SThnmxLVOqjauIfldkcMrZzS9kSFULqcteJoQdfqEo,322048
|
|
3
|
+
bfast_py-1.0.4.dist-info\METADATA,sha256=DFW_A7geDZplrUqwKnhdYjPRmBr9RUTpxQPJMs93SsY,4963
|
|
4
|
+
bfast_py-1.0.4.dist-info\WHEEL,sha256=gPqN4EsdiAyGvmfrYy_ONrF276O8o0hPitI2CKZrEFA,95
|
|
5
|
+
bfast_py-1.0.4.dist-info\licenses\LICENSE,sha256=VNAIoZqWaw--dL2LFGJlzWqh5iHfmGtsJAOJvRLjJR4,1111
|
|
6
|
+
bfast_py-1.0.4.dist-info\RECORD,,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: bfast-py
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Requires-Dist: pydantic>=2.0
|
|
5
|
-
Requires-Dist: numpy
|
|
6
|
-
Requires-Dist: matplotlib>=3.7.5 ; extra == 'dev'
|
|
7
|
-
Requires-Dist: orjson>=3.10.15 ; extra == 'dev'
|
|
8
|
-
Requires-Dist: mkdocs-material>=9.7.1 ; extra == 'dev'
|
|
9
|
-
Requires-Dist: mkdocstrings[python]>=0.26.1 ; extra == 'dev'
|
|
10
|
-
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
11
|
-
Requires-Dist: black>=23.0 ; extra == 'dev'
|
|
12
|
-
Requires-Dist: ruff>=0.1.0 ; extra == 'dev'
|
|
13
|
-
Requires-Dist: fastapi ; extra == 'fastapi'
|
|
14
|
-
Provides-Extra: dev
|
|
15
|
-
Provides-Extra: fastapi
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
Requires-Python: >=3.8
|
bfast_py-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
b_fast\__init__.py,sha256=3JTYzuf6_39pzLR3L8me9rsz_bnKsP4nVICPaL_tnko,107
|
|
2
|
-
b_fast\b_fast.pyd,sha256=b-Ykj1bKKubqBAvkv1T1aVT8U-hTuZMF0qm0MOwswmE,322048
|
|
3
|
-
bfast_py-0.1.0.dist-info\METADATA,sha256=rWriqjqX-BGJaiVZMIm_94gSGagDoJ703MLnG7Ec4Lk,581
|
|
4
|
-
bfast_py-0.1.0.dist-info\WHEEL,sha256=gPqN4EsdiAyGvmfrYy_ONrF276O8o0hPitI2CKZrEFA,95
|
|
5
|
-
bfast_py-0.1.0.dist-info\licenses\LICENSE,sha256=VNAIoZqWaw--dL2LFGJlzWqh5iHfmGtsJAOJvRLjJR4,1111
|
|
6
|
-
bfast_py-0.1.0.dist-info\RECORD,,
|
|
File without changes
|
|
File without changes
|