Python SDK for Blazor Microfrontends
Project description
Blazor Microfrontends Python SDK
A Python SDK for integrating Python microfrontends with Blazor applications.
Installation
- Create a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the SDK:
pip install -e .
Usage
App Shell Configuration
- Initialize an app shell:
blazor-mf appshell init --name "MyAppShell" --version "1.0.0"
- Add a microfrontend to the app shell:
blazor-mf appshell add "my-microfrontend" "http://localhost:5000" "/my-path"
- List all microfrontends:
blazor-mf appshell list
Microfrontend Development
- Initialize a new microfrontend:
blazor-mf microfrontend init --name "MyMicrofrontend" --version "1.0.0"
- Add routes to your microfrontend:
blazor-mf microfrontend add-route "/dashboard" "DashboardComponent"
- List all routes:
blazor-mf microfrontend list-routes
Flask Integration
from flask import Flask, render_template
from blazor_microfrontends import MicrofrontendApi, microfrontend_route
app = Flask(__name__)
api = MicrofrontendApi(__name__)
@microfrontend_route(api, "/dashboard", "DashboardComponent")
@app.route('/dashboard')
def dashboard():
return render_template('dashboard.html')
if __name__ == '__main__':
app.run(debug=True)
Django Integration
from django.shortcuts import render
from blazor_microfrontends import MicrofrontendApi, microfrontend_route
api = MicrofrontendApi(__name__)
@microfrontend_route(api, "/dashboard", "DashboardComponent")
def dashboard(request):
return render(request, 'dashboard.html')
Configuration
App Shell Configuration (appshell.yaml)
name: MyAppShell
version: 1.0.0
microfrontends:
- name: dashboard
url: http://localhost:5000
path: /dashboard
- name: profile
url: http://localhost:5001
path: /profile
Microfrontend Configuration (microfrontend.json)
{
"name": "MyMicrofrontend",
"version": "1.0.0",
"routes": [
{
"path": "/dashboard",
"component": "DashboardComponent"
}
]
}
Development
- Install development dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
- Format code:
black .
- Run type checking:
mypy .
License
MIT License
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 blazor_microfrontends_python-1.0.0.tar.gz.
File metadata
- Download URL: blazor_microfrontends_python-1.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2beeb1fd261d751f1aabc62158e4129667a09d1b51928d01575c71853613c62
|
|
| MD5 |
5d997707731d52e86439cdd201648678
|
|
| BLAKE2b-256 |
5e99c0ddda4825f5567e9dff147b979b2cc7ff75242e6bf2effa1c8e30ac206b
|
File details
Details for the file blazor_microfrontends_python-1.0.0-py3-none-any.whl.
File metadata
- Download URL: blazor_microfrontends_python-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.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 |
0e95a3282844e44c19ff20455acc2ae71f3ff99a43faa8258c8fa116fffdde15
|
|
| MD5 |
3cdbfa8558a58308b2c7e6a7f11b377b
|
|
| BLAKE2b-256 |
6b697382128e20d1393b9e61cb096793f4a40946a3caaf0392be5dc679752171
|