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.

📦 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.9",,
  "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. Third-party component attributions are listed in THIRD-PARTY-NOTICES.md.


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.9.tar.gz (38.5 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.9-cp310-abi3-win_amd64.whl (844.9 kB view details)

Uploaded CPython 3.10+Windows x86-64

b4n1_boost-0.1.9-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.9-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.9-cp310-abi3-macosx_11_0_arm64.whl (947.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

b4n1_boost-0.1.9-cp310-abi3-macosx_10_12_x86_64.whl (947.5 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: b4n1_boost-0.1.9.tar.gz
  • Upload date:
  • Size: 38.5 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.9.tar.gz
Algorithm Hash digest
SHA256 355fb8cc62c54e19e89e111d08c444bfe691088d0e17ebb686c2987ad34b73ef
MD5 a25083ee9926873c501cd032597532ab
BLAKE2b-256 425c816ec13f48c50162976dfe93980949fe69fc711525017af27491fcc2dc8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: b4n1_boost-0.1.9-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 844.9 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.9-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 16ffb1b4762d94841f6aae335e8babd1e35acd9ccff6ed8b99e07d33f7a277d0
MD5 dcfa9c0a739a5eb39f2c20c08a69566c
BLAKE2b-256 6948545640548450d1d92b874f9cfbeca5c3dc1e435360d86d654e3500cc3442

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for b4n1_boost-0.1.9-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 53bf7b6960221b57af7c2addc698321c1e395f1ae4623fd8de227676a2feabd0
MD5 99c40a9607a0e0f8468f9765981d1c94
BLAKE2b-256 a5ccb0ddf0e213314a8773586c090c9cf383c0ec420fa984af5d42e5a0bce439

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for b4n1_boost-0.1.9-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 179715f2f6d45297d56a9ecaae5e004a8ff0e62425a5f6e507df9c22271c9ad2
MD5 733f9295e0796a1862dede8f4b3f0fe3
BLAKE2b-256 2b323d96e4e599b09740e2351c2dae598c0931264c907f73d1fc02d33315db86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for b4n1_boost-0.1.9-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d79df74da6063139c925399e952f9beed755707830bd3fecf984b0f6c7096c0
MD5 e7605a32657509166237a390ad16c2a6
BLAKE2b-256 a7ef0bbbd42598a9fdd2053a2f89a31c54b119341039a2cf5a451bba06403463

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for b4n1_boost-0.1.9-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 429ce6ebfeb32478bf961c54b35c9a28d859df462842dcbadafaff5a9c0e0991
MD5 6d71e484a53d303ec59ab851ecfdafde
BLAKE2b-256 02f5a5157ea85dca4192afd1b3964b027d600c234ee88cf5d37d1d3e571dd821

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

This release

0.1.9 This release

6 files

0.1.8

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