Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

forge-mvc-workflow

Module workflow pour Forge — statuts et transitions applicatives.

Extrait du core Forge depuis la version 2.6.0 (ADR-004).

Installation

pip install forge-mvc-workflow
# ou en mode developpement
pip install -e packages/forge-mvc-workflow/

Usage

from forge_mvc_workflow import (
    WorkflowStatus,
    WorkflowTransition,
    make_status,
    make_transition,
    validate_statuses,
    validate_transitions,
    can_transition,
    get_available_transitions,
    make_workflow_jinja_helpers,
)

# Definir des statuts
statuses = validate_statuses([
    make_status("brouillon", label="Brouillon", color="gray"),
    make_status("confirme", label="Confirme", color="green"),
    make_status("annule", label="Annule", color="red"),
])

# Definir des transitions autorisees
transitions = validate_transitions([
    make_transition("brouillon", "confirme"),
    make_transition("brouillon", "annule"),
    make_transition("confirme", "annule"),
], statuses=statuses)

# Verifier une transition
if can_transition(transitions, "brouillon", "confirme"):
    ...

# Obtenir les transitions disponibles depuis un statut
available = get_available_transitions(transitions, "brouillon")

Helpers Jinja2

env.globals.update(make_workflow_jinja_helpers())

Dans un template :

{{ workflow_status_badge(reservation.status) }}
{{ workflow_status_label(reservation.status) }}

Cas d'usage

  • Statut d'une reservation (brouillon → confirmee → terminee → annulee)
  • Statut d'un document (redaction → validation → publie)
  • Statut d'une commande (panier → payee → expediee → livree)

API publique

  • WorkflowStatus — dataclass statut (name, label, color)
  • WorkflowTransition — dataclass transition (from_status, to_status)
  • make_status(name, label, color) — constructeur valide
  • make_transition(from_status, to_status) — constructeur valide
  • validate_statuses(list) — valide une liste de statuts
  • validate_transitions(list, statuses) — valide les transitions par rapport aux statuts
  • can_transition(transitions, from_name, to_name) — teste une transition
  • get_available_transitions(transitions, from_name) — liste les transitions disponibles
  • make_workflow_jinja_helpers() — dict de helpers Jinja2

Release files for forge-mvc-workflow 1.0.0rc8

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

Source distribution (sdist)

Source distribution for forge-mvc-workflow 1.0.0rc8
File Size Uploaded
forge_mvc_workflow-1.0.0rc8.tar.gz 28.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for forge-mvc-workflow 1.0.0rc8
File Interpreter ABI Platform
forge_mvc_workflow-1.0.0rc8-py3-none-any.whl Python 3 none any Details

Total release size: 49.3 kB

Release files / forge_mvc_workflow-1.0.0rc8.tar.gz

Download URL forge_mvc_workflow-1.0.0rc8.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
574cb89f8589a0b22e6f723853b5d8c59ccb55deb574ce20bcf667a72c382332
BLAKE2b-256 checksum
How to use checksums
41b64661e86824eb40663d541de24e8f5c1ad85798ce8bd418a12c2cc317591e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / forge_mvc_workflow-1.0.0rc8-py3-none-any.whl

Download URL forge_mvc_workflow-1.0.0rc8-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c24561ac3a8ca56356dde2c73deabc5c5e65f96303c8f27771503d7d4e9ab899
BLAKE2b-256 checksum
How to use checksums
80b61c6cd998f308a379e6a330ec8448e7963cb702ad7c9488f4914e91daf07a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13
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