Skip to main content

📦 b4n1-boost

Transparent native middleware acceleration layer for Python frameworks (Django, FastAPI, Flask, WSGI/ASGI).

License PyPI

🌍 Languages / Idiomas / 语言

🇬🇧 English 🇪🇸 Español 🇫🇷 Français 🇩🇪 Deutsch
🇵🇹 Português 🇨🇳 简体中文 🇯🇵 日本語

🚀 Features

  • Transparent middleware for Django, FastAPI, Flask, WSGI and ASGI.
  • Native gzip and Brotli response compression.
  • Automatic Accept-Encoding negotiation.
  • Correct Content-Encoding, Content-Length and Vary headers.
  • Safe Python fallback when the native extension is unavailable.
  • JSON utilities and runtime diagnostics.

Components and licenses

Component License
b4n1-boost Business Source License 1.1 (BSL 1.1)
Rust standard library MIT / Apache-2.0
PyO3 Apache-2.0
serde / serde_json MIT / Apache-2.0
serde_yaml MIT / Apache-2.0
clap MIT / Apache-2.0
thiserror MIT / Apache-2.0
chrono MIT / Apache-2.0
flate2 / miniz_oxide MIT / Apache-2.0
brotli MIT

See LICENSE for the b4n1-boost license terms and the project notices for third-party license details.


📦 Installation

pip install b4n1-boost

Precompiled native wheels are provided for supported platforms; no local compiler is required when a compatible wheel is available.


🚀 Quick Start

No code rewrites. Initialize the SDK when your app starts:

Django

In your settings.py or wsgi.py:

import b4n1_boost

b4n1_boost.install_django()

FastAPI

In your main module:

from fastapi import FastAPI
import b4n1_boost

app = FastAPI()
b4n1_boost.install_fastapi(app)

Flask

In your app initialization:

from flask import Flask
import b4n1_boost

app = Flask(__name__)
b4n1_boost.install_flask(app)

Auto-detection

Let b4n1-boost detect the active framework automatically:

import b4n1_boost

b4n1_boost.autoboost()

Native compression (brotli/gzip, GIL-free)

Wrap any WSGI app (Flask, Django via WSGI, or plain WSGI) to compress large responses in Rust when the client accepts an encoding:

from b4n1_boost.middleware import B4N1BoostCompressionMiddleware

app.wsgi_app = B4N1BoostCompressionMiddleware(app.wsgi_app)

For FastAPI/Starlette use the ASGI variant:

from b4n1_boost.middleware import FastAPIBoostCompressionMiddleware

app.add_middleware(FastAPIBoostCompressionMiddleware)

Both negotiate Accept-Encoding (brotli preferred, then gzip), only compress bodies above 1 KB, set Content-Encoding, Content-Length and Vary correctly, and fall back to the untouched body when the native engine is unavailable or compression fails.


🔍 Status & Diagnostics

Check the engine state and active accelerations:

import b4n1_boost

print(b4n1_boost.status())

Expected output:

{
  "native_extension": true,
  "version": "0.1.8",
  "features": ["json_acceleration", "orm_interception", "websocket_acceleration"]
}

Run the native benchmark suite:

report = b4n1_boost.run_benchmarks(iterations=100_000)
print(f"JSON ops/sec: {report['json_bench']['ops_per_sec']:,.0f}")
print(f"ORM ops/sec:  {report['orm_bench']['ops_per_sec']:,.0f}")

🔗 Links


📄 License

This project is distributed under the Business Source License 1.1 (BSL 1.1).

  • Free for development, evaluation, testing, personal projects, and startups generating under $100,000 USD in annual gross revenue.
  • Commercial license required for organizations with annual gross revenue >= $100,000 USD, government agencies, and public bidding projects.
  • After the Change Date (4 years), the work converts to Apache License 2.0.

See LICENSE for the full legal text.


b4n1-boost is a core component of the B4N1 sovereign computing stack, providing transparent native middleware acceleration for Python frameworks.

Built with ❤️ by the B4N1 team.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

b4n1_boost-0.1.8.tar.gz (37.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

b4n1_boost-0.1.8-cp310-abi3-win_amd64.whl (841.8 kB view details)

Uploaded CPython 3.10+Windows x86-64

b4n1_boost-0.1.8-cp310-abi3-manylinux_2_34_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

b4n1_boost-0.1.8-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

b4n1_boost-0.1.8-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

b4n1_boost-0.1.8-cp310-abi3-macosx_11_0_arm64.whl (946.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

b4n1_boost-0.1.8-cp310-abi3-macosx_10_12_x86_64.whl (946.5 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file b4n1_boost-0.1.8.tar.gz.

File metadata

  • Download URL: b4n1_boost-0.1.8.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for b4n1_boost-0.1.8.tar.gz
Algorithm Hash digest
SHA256 aa7c02cbe0c13bd95e7da3868aaab3fe0b0030a552444d9c74f32038aceda9f3
MD5 e80eecb05a9191e114568f8606ee386d
BLAKE2b-256 814cf11194db7f0163509caecf2ea0a1eb64adce1a0696d2d8bf52f39f56c1bb

See more details on using hashes here.

File details

Details for the file b4n1_boost-0.1.8-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: b4n1_boost-0.1.8-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 841.8 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for b4n1_boost-0.1.8-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2bcfcb2a5df6533626ffe531cc7d6f8fe3bc5cbee29b295a73319737fc373800
MD5 7d4053031fc8dc214532a4b05039577d
BLAKE2b-256 dd5e79ccbf871c2bf24769a0d7fb3a5ec4c4ce10e622e81447b24d809fe7dc5c

See more details on using hashes here.

File details

Details for the file b4n1_boost-0.1.8-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for b4n1_boost-0.1.8-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e9f682ab65c064780e7b4797fe8326d3083324910ff93d22e74e4d07fcfa8721
MD5 1546c43c1b40f7b3ab90478b8486b93b
BLAKE2b-256 9b4a45c6d040b3b31b2f01e769b57641969da96af8b854d4058adad57eaea74a

See more details on using hashes here.

File details

Details for the file b4n1_boost-0.1.8-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for b4n1_boost-0.1.8-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 311b41f68d8be0f345998ab0957a5bd774bdd2a7474c984cb9a68c9aec66c9e4
MD5 c3f23ea28405ff250f375bbf843fc369
BLAKE2b-256 555609c3e39ef10fbcb40fb0acbaebdebe5b8face4fae1ed2b8b59c141088e5c

See more details on using hashes here.

File details

Details for the file b4n1_boost-0.1.8-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for b4n1_boost-0.1.8-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 91cddcc4fc1de662543fe18e6cda0d1139e4ef8176fb607aa34423dd5aae65c1
MD5 e3b30a1b038c1471cab06019c8fa28d1
BLAKE2b-256 d1a4c0a560d2484ad76f87f0ccb9ec31446e4d4613a90574b52d0f2711de0c9a

See more details on using hashes here.

File details

Details for the file b4n1_boost-0.1.8-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for b4n1_boost-0.1.8-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e10bb3a0afffc1d986e6c14c0686eb8878045c20148c0664791f629e0b8a9b30
MD5 daaaa1073f903a47e93e173c1c0e77f7
BLAKE2b-256 53fc835a35edb61a8d8ff0d3c76b467195b1f4056e72c6e90e6a6781c742ae50

See more details on using hashes here.

File details

Details for the file b4n1_boost-0.1.8-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for b4n1_boost-0.1.8-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d00456d6cc72f5a9b9cf36deb9c0588e5c58f97c18e421c966c0f1d0171400f6
MD5 68fad69191515ab35d5ba2380b9607e3
BLAKE2b-256 2cfce0758c751eb0ec743f8558b167b0751b0b4be5fad7563511682855769f56

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.4

6 files

0.3.3

6 files

0.3.2

2 files

0.3.1

2 files

0.3.0

6 files

0.1.9

6 files

This release

0.1.8 This release

7 files

0.1.6

6 files

0.1.5

2 files

0.1.4

4 files

0.1.3

3 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page