Skip to main content

fusion-framework (Python)

نسخه‌ی پایتونِ کلاس‌محور برای fusion-core (هسته‌ی Rust).

در این طراحی، منطق‌های اصلی مثل routing، parsing، serialization و binding پارامترهای handler در Rust انجام می‌شود. سمت پایتون فقط interface و DX باقی می‌ماند.

نصب

pip install fusion-framework

شروع سریع

from fusion_framework.api import FusionBaseApi
from fusion_framework.route import router
from fusion_framework.app import run

 
@router("/api/[module]/{id}")
class MyModule(FusionBaseApi):
    def get(self, id: int):
        # `id` طبق annotation به int تبدیل می‌شود (در Rust)
        return self.response({"ok": True, "id": id}, status=200)


if __name__ == "__main__":
    run()

تنظیمات Swagger

در fusion.<env>.json (همان فایلی که fusion init می‌سازد) بلاک swagger را ویرایش کن:

{
  "env": "dev",
  "config": {
    "host": "127.0.0.1",
    "port": 8080,
    "swagger": {
      "enabled": true,
      "path": "/swagger",
      "title": "Fusion API Docs",
      "info": {
        "title": "Fusion API",
        "version": "1.0.0",
        "description": "My API docs"
      },
      "ui": {
        "deepLinking": true,
        "docExpansion": "list",
        "filter": true,
        "tryItOutEnabled": true,
        "persistAuthorization": false,
        "displayRequestDuration": true
      }
    }
  }
}
  • enabled / path: روشن/خاموش و آدرس UI (پیش‌فرض /swagger)
  • info: فیلدهای OpenAPI info (title/version/description/...)
  • ui: گزینه‌های Swagger UI

متادیتای هر endpoint همچنان از @route(..., tags=..., desc=..., title=..., deprecated=...) می‌آید.

قرارداد Handlerها

متدهای HTTP مثل get/post/put/delete/patch را به صورت معمول پیاده کن.

  1. ورودی‌ها از طریق امضای متد (def get(self, id: int, ...)) گرفته می‌شوند.
  2. منبع مقدار بر اساس نام پارامتر:
  • اگر نام با path params یکی باشد → از path
  • اگر متد POST/PUT/PATCH باشد و نام در body JSON باشد → از body
  • در غیر این صورت اگر نام در query باشد → از query
  1. اگر پارامتری annotation/optional داشته باشد و وجود نداشته باشد → None ارسال می‌شود.

خطاها

from fusion_framework.http import HTTPException

raise HTTPException(404, {"detail": "not found"})

فایل‌های مهم

  • fusion_framework.api.FusionBaseApi
    • view درخواست: method/path/body/headers/params/query
    • helper envelope: response(...)
  • fusion_framework.route.router
    • ثبت کلاس‌ها با template مثل /api/[module]/{id}
  • fusion_framework.app.run
    • settings را لود می‌کند و برنامه را mount/listen می‌کند
  • پشت صحنه:
    • crates/fusion-py/src/lib.rs: PyO3 bridge
    • crates/fusion-core/src/*: routing/serialize/binding مشترک

Release files for fusion-framework 1.1.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 fusion-framework 1.1.1
File Size Uploaded
fusion_framework-1.1.1.tar.gz 47.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fusion-framework 1.1.1
File
fusion_framework-1.1.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
fusion_framework-1.1.1-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
fusion_framework-1.1.1-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
fusion_framework-1.1.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 3.7 MB

Release files / fusion_framework-1.1.1.tar.gz

Download URL fusion_framework-1.1.1.tar.gz
Size 47.8 kB
Tags Source
SHA-256 checksum
How to use checksums
749ef342299dc6f5f44e10c6f773e49a788e40c3691dff4034c7430b8aace0d2
BLAKE2b-256 checksum
How to use checksums
f38989f23dfaccac2d197e35797a389cd088380bb299c7093bb5eb6ff6812ae9
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 Aug 12, 2026.

Transparency log

Release files / fusion_framework-1.1.1-cp39-abi3-win_amd64.whl

Download URL fusion_framework-1.1.1-cp39-abi3-win_amd64.whl
Size 779.0 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e502d536d26dab49fda5d7e4100194696dbc728982f4e3fdfbe78608ca956dce
BLAKE2b-256 checksum
How to use checksums
978cc560dbf446521ac1630c7834cc97c194f5258f9547a12f626d5ef3e4abf2
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 Aug 12, 2026.

Transparency log

Release files / fusion_framework-1.1.1-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL fusion_framework-1.1.1-cp39-abi3-manylinux_2_28_x86_64.whl
Size 999.3 kB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d2129d2c79efb914ff87e059aaaf66660bc72dbeb58e932c98f2e4355206fe66
BLAKE2b-256 checksum
How to use checksums
284531e0e59707cf635918824c0ed5d56907a8d4ca2bdf62cfd2e2eaa9ac56d0
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 Aug 12, 2026.

Transparency log

Release files / fusion_framework-1.1.1-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL fusion_framework-1.1.1-cp39-abi3-manylinux_2_28_aarch64.whl
Size 990.5 kB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
de48a24f6a166db3b410e9cccfcc431b20bf7149fcf9d2b9d94706ac4a3ed652
BLAKE2b-256 checksum
How to use checksums
5b98691b2f8e2124d2b8efe2c5a043cfea6a6e54d73b3b6106d367039182c565
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 Aug 12, 2026.

Transparency log

Release files / fusion_framework-1.1.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL fusion_framework-1.1.1-cp39-abi3-macosx_11_0_arm64.whl
Size 877.0 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1013fb8473221c328ac5ce7b26f7a0f58a371a623be4923bbeb46be74a1bce8d
BLAKE2b-256 checksum
How to use checksums
df4d8598781b549ff535531025e5f653d2a6c3ea21bda242f55924f2cd0bb0e4
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 Aug 12, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.1

5 release files

2.0.0

5 release files

1.3.0

5 release files

1.2.6

5 release files

1.2.5

5 release files

1.2.4

5 release files

1.2.3

5 release files

1.2.2

5 release files

1.2.1

5 release files

1.2.0

5 release files

1.1.3

5 release files

1.1.2

5 release files

This release

1.1.1 This release

5 release files

1.1.0

5 release files

0.1.2

5 release files

0.1.1

5 release files

0.1.0

5 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