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

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

Built distribution (wheel)

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

Total release size: 18.6 kB

Release files / forge_mvc_workflow-1.0.0rc4.tar.gz

Download URL forge_mvc_workflow-1.0.0rc4.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7b555014a399abfa2e611c36af6c3706ca5cbdad06f45c2a89b59977bc71889d
BLAKE2b-256 checksum
How to use checksums
097b8966c8036288904995253cd7b186cb543f2232abdc5a1735641c7ac553c7
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.0rc4-py3-none-any.whl

Download URL forge_mvc_workflow-1.0.0rc4-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bceecf5b73c930047d1d81b280e9326b0c999900ff9c02fc9cf25db7e3fb08bb
BLAKE2b-256 checksum
How to use checksums
ae2b36776374b598aef1f6d5debee60c14525c7083f2969d31d3576464ca2f56
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