Skip to main content

higuma

Rust HTTPコアと、書き慣れたPython APIを組み合わせたWebフレームワークです。

日本語ドキュメント / English documentation

python -m pip install -U higuma

どんなフレームワークか

higumaは「アプリケーションはPythonで素直に書き、HTTPの実行基盤はRustに任せる」 ことを目的にしています。

  • routing、middleware、hooks、BlueprintはFlaskに着想を得たPython API
  • socket、route matching、file streaming、gzip、WebSocketはaxum / TokioベースのRustコア
  • MiniJinjaによるSSRと、辞書やlistをそのまま返せるJSON API
  • Python側の必須runtime dependencyはゼロ
  • CPython 3.10以降で利用できるABI3 wheel

higumaはFlaskのdrop-in replacementではありません。また、higuma自体をWSGI/ASGI serverへ渡すのではなく、組み込みのRust serverで実行します。既存のWSGI/ASGIアプリは higumaのroute配下へmountできます。

Quick start

app.pyを作成します。

from higuma import Higuma, request

app = Higuma(__name__)


@app.get("/")
def index():
    return {"message": "Hello from higuma"}


@app.post("/echo")
def echo():
    return {"received": request.json}


if __name__ == "__main__":
    app.run()

起動後、http://127.0.0.1:8000 を開きます。

python app.py

CLIからも起動できます。

higuma run app:app --host 127.0.0.1 --port 8000
higuma routes app:app
higuma run app:app --processes 4 --max-connections 1024

型付きAPIでは、標準のAnnotatedとdataclassだけで入力元、制約、dependency、出力を宣言できます。

from dataclasses import dataclass
from typing import Annotated

from higuma import Body, Depends, Higuma, QueryParam

app = Higuma(__name__)


@dataclass
class Item:
    name: str
    price: float


def page_size(limit: Annotated[int, QueryParam(ge=1, le=100)] = 20):
    return limit


@app.post("/items", response_model=Item, status_code=201)
def create_item(
    item: Annotated[Item, Body()],
    limit: Annotated[int, Depends(page_size)],
):
    return item

入力はruntimeで検証・変換され、不正時は構造化された422になります。schemaは同じ宣言から OpenAPI 3.1へ反映されます。

主な機能

分野 機能
HTTP typed input、dependency injection、path converter、自動HEAD/OPTIONS、async handler
Response response model、HTML、JSON、cookie、Range file、sync/async streaming、background task
Realtime SSE、text/binary/JSON WebSocket、Origin検証、認証preflight、bounded queue
SSR MiniJinja、compiled template cache、context processor
構成 Blueprint、class-based view、lifespan、WSGI/ASGI mount、startup/shutdown hook
API設計 OpenAPI 3.1、Swagger UI、dataclass/TypedDict/enum/UUID/date schema
Data dependency-free SQLite ORM、transaction、pagination、typed field
Auth signed cookie session、login/role/permission、OAuth 2.0 + PKCE
Security scrypt password、signed token、CSRF、CORS、rate limit、trusted host/proxy
Operations test client、CLI、multi-process supervisor、worker restart limit

完全な一覧と注意点は機能ガイドおよび APIリファレンスを参照してください。

Validationについて: Annotated[..., Body()]等のmarkerとresponse_modelはruntime検証を 有効にします。従来のrequest_body=やreturn annotation単独はschema metadataです。

対応範囲

  • Python: CPython 3.10以降(CIでは3.10〜3.14を検証)
  • OS: Windows x86-64、Linux x86-64 / ARM64、macOS x86-64 / Apple Silicon
  • Linux: manylinux wheelとmusllinux x86-64 wheelを配布
  • Database: 組み込みORMはSQLiteのみ
  • Protocol: 組み込みHTTP serverとWebSocket。TLSはreverse proxyで終端

wheelがないplatformではsource distributionからRust buildが必要です。公開済みの配布物は PyPIで確認できます。

Examples

examples/には、最小アプリだけでなく次の実行例があります。

  • routing、async handler、型付き入力、dependency injection、class-based view
  • response、cookie、file、multipart upload、streaming、SSE、background task
  • Blueprint、lifespan、WebSocket、WSGI/ASGI mount、OpenAPI
  • SQLite ORM、session authentication、role/permission、OAuth
  • security middleware、signed token、in-process testing
  • multi-process supervisor

必要な環境変数と実行コマンドはExamplesガイドに まとめています。

本番運用

higumaは活発に開発中です。本番採用前に、対象アプリケーションで負荷試験、障害試験、 security reviewを実施してください。

  • debug=Falseのまま運用する
  • Caddy、nginx、Cloudflare等でTLSを終端しHTTPSを強制する
  • 32バイト以上の推測不能なsecretをsecret managerから読み込む
  • TrustedHostMiddlewareと、正確なCORS / WebSocket Originを設定する
  • ProxyHeadersMiddlewareでは直接接続するproxyだけを信頼する
  • upload size、保存先、拡張子をアプリケーション側でも制限する
  • SQLite fileを定期backupし、multi-process時のwrite負荷を測定する
  • network timeout、request buffering、connection limitはreverse proxyでも設定する

詳しくはデプロイガイドと Security Policyを参照してください。

開発

python -m pip install -e ".[dev,docs]"
python -m pytest
python -m ruff check python tests examples
cargo test --locked --all-features
mkdocs build --strict

変更前にCONTRIBUTING.mdと、coding agent向けの SKILL.mdを確認してください。

ライセンス

MIT License

Metadata

Release files for higuma 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for higuma 0.4.1
File Size Uploaded
higuma-0.4.1.tar.gz 155.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for higuma 0.4.1
File
higuma-0.4.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
higuma-0.4.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
higuma-0.4.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
higuma-0.4.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
higuma-0.4.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
higuma-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 9.9 MB

Release files / higuma-0.4.1.tar.gz

Download URL higuma-0.4.1.tar.gz
Size 155.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c21e026bd4bd6ed4e3f094b08e766511afc38e0bac0a0bf87cd00fae6045a7aa
BLAKE2b-256 checksum
How to use checksums
9b42a64fd437f0199131c286240b38bde95e69d67920bdad4769cf4b7efcfc6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / higuma-0.4.1-cp310-abi3-win_amd64.whl

Download URL higuma-0.4.1-cp310-abi3-win_amd64.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
afbefd82f83200bae60d6b7370fb7385d08838728a9fbc56c49315f56280f868
BLAKE2b-256 checksum
How to use checksums
12bbaddc7d0e3443889264a928096240050cbb5a3317d81467db1a35f171bec1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / higuma-0.4.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL higuma-0.4.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 1.9 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
c3ec4d29b8e00305924412916e91467a68060b2a1320579cc9a186e7ae9e9978
BLAKE2b-256 checksum
How to use checksums
1834af55d691be2b1231cfbe789add186aeacc2d632c5053249293c5e713a866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / higuma-0.4.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL higuma-0.4.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
aa45586b83db95430bd22144b77fa9a686e2669372e52db5327346889fbce8bc
BLAKE2b-256 checksum
How to use checksums
1a8c152011715e451aa46fbb5104cb9b7e2ede2316102dd37d961a10bbbeb98c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / higuma-0.4.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL higuma-0.4.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
3e07058e032a07901183e25a41ceacd4a5510194fcff2ba0f99d3c12bcaf4fd8
BLAKE2b-256 checksum
How to use checksums
92598e3803777cba0eef880760ed820be96690c404892a1d2da32dfbcdb12969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / higuma-0.4.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL higuma-0.4.1-cp310-abi3-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
31563d14ac790d5bed331c1e14c308ebe8085501be465e2a737eb3b3efbe902e
BLAKE2b-256 checksum
How to use checksums
2d6dc966c7177c629d5abd171888a8d76b1747fd560eb8d54a3faea173306973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / higuma-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL higuma-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6ccab661464501699c0a075ce6639864d82d3632a8fe086e097a9307c4aebe4b
BLAKE2b-256 checksum
How to use checksums
cbffbd9018a0db7b934ec232938f9bad7c1487a1ef426dc387e4c0a8aa342684
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

7 release files

This release

0.4.1 This release

7 release files

0.4.0

7 release files

0.3.0

7 release files

0.2.0

7 release files

0.1.0

7 release 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