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

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

Built distribution (wheel)

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

Total release size: 18.7 kB

Release files / forge_mvc_workflow-1.0.0rc5.tar.gz

Download URL forge_mvc_workflow-1.0.0rc5.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
eb1290bbb81e6276a2a98f6a71bc2efedeae73bc90ae7369aa1fc74b505b4018
BLAKE2b-256 checksum
How to use checksums
8362e011a09a0090a15290f8f907b977e220fcfdaf8e957d1d1430255d6613b0
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.0rc5-py3-none-any.whl

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