It is an extension of the bisslog library to support processes with flask
Project description
bisslog-flask
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
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
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)
🔧 How It Works
- Loads metadata and discovers use case functions (or callables), then uses resolvers to register routes dynamically into a Flask app.
🔐 CORS Handling
CORS is applied only when allow_cors: true is specified in the trigger
Fully dynamic: works even with dynamic Flask routes like /users/
Powered by @cross_origin from flask-cors
✅ Requirements
Python ≥ 3.7
Flask ≥ 2.0
bisslog-schema ≥ 0.0.3
flask-cors
(Optional) flask-socketio if using WebSocket triggers
🧪 Testing Tip
You can test the generated Flask app directly with app.test_client() if you take the programmatic way:
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
Not generating code or using the programmatic way you just need to test your use cases.
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bisslog_flask-0.0.1.tar.gz.
File metadata
- Download URL: bisslog_flask-0.0.1.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ca43bf6cf1b855b0c73d57011a9a83e074cf954a85a8fec11fb6f498531d47f
|
|
| MD5 |
f19a056cd896a7f9398b829c3e46d90c
|
|
| BLAKE2b-256 |
847f9fc9c639bf397ce24c3a990243760118192f745a2f47b00e5d42c6243bde
|
File details
Details for the file bisslog_flask-0.0.1-py3-none-any.whl.
File metadata
- Download URL: bisslog_flask-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d0ba349f2226dda3036ce6394418042512ed386e842f8539bf1a9f7c60f1f0e
|
|
| MD5 |
c465861287636a5f7b30abc47283ab97
|
|
| BLAKE2b-256 |
85d66e636619bb991a7ce1a78f9f3f1b1a42c1d7060d3896855c22f48578c80a
|