Skip to main content

bisslog-flask

PyPI License: MIT

bisslog-flask is an extension of the Bisslog library to support processes with Flask.
It enables dynamic HTTP and WebSocket route registration from use case metadata, allowing developers to build clean, modular, and metadata-driven APIs with minimal boilerplate.

Part of the Bisslog ecosystem, it is designed to work seamlessly with domain-centric architectures like Hexagonal or Clean Architecture.


✨ Features

  • 🔁 Dynamic route registration for HTTP and WebSocket triggers
  • 🧠 Metadata-driven setup – use YAML or JSON to declare your use cases
  • 🔒 Automatic CORS per endpoint using flask-cors
  • 🔌 Extensible resolver pattern – plug in your own processor
  • ⚙️ Mapper integration – maps HTTP request parts to domain function arguments

📦 Installation

pip install bisslog-flask

🚀 Quickstart

Programmatically

Use this approach if you want to configure the app before Bisslog touches it:

from flask import Flask
from bisslog_flask import BisslogFlask

app = Flask(__name__)
BisslogFlask(
    metadata_file="metadata.yml",
    use_cases_folder_path="src/domain/use_cases",
    app=app
)

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

Or use the factory version:

from bisslog_flask import BisslogFlask

app = BisslogFlask(
    metadata_file="metadata.yml",
    use_cases_folder_path="src/domain/use_cases"
)

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

🖥️ CLI Usage

You can also use the bisslog_flask CLI to run or generate a Flask app.

bisslog_flask run [--metadata-file FILE] [--use-cases-folder-path DIR]
                  [--infra-folder-path DIR] [--encoding ENC]
                  [--secret-key KEY] [--jwt-secret-key KEY]

bisslog_flask build [--metadata-file FILE] [--use-cases-folder-path DIR]
                    [--infra-folder-path DIR] [--encoding ENC]
                    [--target-filename FILE]
  • run: Launches the Flask application from metadata.
  • build: Generates a boilerplate Flask file (flask_app.py by default).

All options are optional. You can override defaults via CLI flags.


🔐 CORS Handling

CORS is applied only when allow_cors: true is specified in the trigger.

Fully dynamic: works even with Flask dynamic routes like /users/<id>.

Powered by @cross_origin from flask-cors.


✅ Requirements

  • Python ≥ 3.7
  • Flask ≥ 2.0
  • bisslog-schema ≥ 0.0.3
  • flask-cors
  • (Optional) flask-sock if using WebSocket triggers

🧪 Testing Tip

You can test the generated Flask app directly with app.test_client() if using the programmatic interface:

from bisslog_flask import BisslogFlask

def test_user_create():
    app = BisslogFlask(
        metadata_file="metadata.yml",
        use_cases_folder_path="src/use_cases"
    )
    client = app.test_client()
    response = client.post("/user", json={"name": "Ana", "email": "ana@example.com"})
    assert response.status_code == 200

If you're generating the code (boilerplate), you just need to test your use cases.


📜 License

This project is licensed under the MIT License.
See the LICENSE file for details.

Metadata

Release files for bisslog-flask 0.0.3

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

Source distribution (sdist)

Source distribution for bisslog-flask 0.0.3
File Size Uploaded Provenance
bisslog_flask-0.0.3.tar.gz 33.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bisslog-flask 0.0.3
File Interpreter ABI Platform
bisslog_flask-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 55.6 kB

Release files / bisslog_flask-0.0.3.tar.gz

Download URL bisslog_flask-0.0.3.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2277e1f263eadbe749998d30c953fd90725bb21da6b0cd098cc1c19c347a99a4
BLAKE2b-256 checksum
How to use checksums
24e85f461559ccabd1ce5e1d4b286ea67b332c857c7668870820618e9134b961
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / bisslog_flask-0.0.3-py3-none-any.whl

Download URL bisslog_flask-0.0.3-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b07032287ddb177d2cf888175ca894faaf1faa67977d2ce6201701c778a0d10
BLAKE2b-256 checksum
How to use checksums
879418566d4285fa6024a4f6c898f434d9f1933af73e77957dac65e11d525f61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for bisslog-flask 0.0.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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