Skip to main content

higuma

0.5.0: Flask風context・session・flash・URL生成と実Flask接続を拡充しました。 対応範囲は日本語ガイド / English guideを参照してください。

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.5.0

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.5.0
File Size Uploaded
higuma-0.5.0.tar.gz 173.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for higuma 0.5.0
File
higuma-0.5.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
higuma-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
higuma-0.5.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
higuma-0.5.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
higuma-0.5.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
higuma-0.5.0-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.5.0.tar.gz

Download URL higuma-0.5.0.tar.gz
Size 173.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4753c9fbaec240217e312462c92eb8b7f6a7521b7f78be58ce779cc831c3ee58
BLAKE2b-256 checksum
How to use checksums
eacd42b945886d98599439ba77904d77f7683233d675204ccb39d0af030acc2d
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.5.0-cp310-abi3-win_amd64.whl

Download URL higuma-0.5.0-cp310-abi3-win_amd64.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
bcc5c03468db8cd5202943cf267566438f50aa050c7f3ac1c1f2fd279ce3f3c0
BLAKE2b-256 checksum
How to use checksums
9aa06761ecd36874e44f98544304091cfa5e5a7f8f0ef039ff06500a03497173
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.5.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL higuma-0.5.0-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
5154217845dcbd1e9269b1a653f0c91bfbefcac315d88296b85f10be8e208226
BLAKE2b-256 checksum
How to use checksums
d4bc598904e5bc9b281f4ff8a3cf431fa03ef7c3b50a699e7905f192fe3fc68d
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.5.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL higuma-0.5.0-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
41c3d2afc27fa20f403050ea9c978e4a7138d00bba9ba9ac5eeae3a223c4d54b
BLAKE2b-256 checksum
How to use checksums
b00a18fea70514a7742642769729cd8ecbf26711f1d79090e821c43936d741d2
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.5.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL higuma-0.5.0-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
ed57d1c44287cb19454c476bf98544e3946e45cc3616ccc078c93339ebaac807
BLAKE2b-256 checksum
How to use checksums
62692e67cb516406b21baf00df7573f780585f5a310078474317110c543e51c2
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.5.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL higuma-0.5.0-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
2347c7a60f7a6075e6c9422a9d0f8d0de762da1344d296c2a1b2eecdc8ad29e0
BLAKE2b-256 checksum
How to use checksums
b176365836fe8aa52680c328850a84dd3b4b52aa2872fea08253a2e961278f40
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.5.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL higuma-0.5.0-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
98bc0232bbeb9c1faf8bc6a722d4a67797476ba8a34b184fce653b2539ed9c92
BLAKE2b-256 checksum
How to use checksums
1584c0c063400224030b754795cdd4c237f7277605113d090e56cc3ed5d19ce5
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

This release

0.5.0 This release

7 release files

0.4.1

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