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.0rc7

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.0rc7
File Size Uploaded
forge_mvc_workflow-1.0.0rc7.tar.gz 11.3 kB Details

Built distribution (wheel)

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

Total release size: 19.0 kB

Release files / forge_mvc_workflow-1.0.0rc7.tar.gz

Download URL forge_mvc_workflow-1.0.0rc7.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3679dda8b0d2e54b392ad4d5855dd770927cb0456cae5b8276aaa8b889829f44
BLAKE2b-256 checksum
How to use checksums
84fdda8f43a7a043eeed97fbce0514dc8b76f0b6fc7ef9d0011a83e10eff6d1d
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.0rc7-py3-none-any.whl

Download URL forge_mvc_workflow-1.0.0rc7-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14cc72ebc4758545b0471b38fb8d03f9d142c4be14fa050d7ce4d04c6faa6c88
BLAKE2b-256 checksum
How to use checksums
a9b1de7fa444d09c485d1e88221f13b4b4d390eef3b76ce018a1fef680148493
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