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

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

Built distribution (wheel)

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

Total release size: 51.4 kB

Release files / forge_mvc_workflow-1.0.0rc9.tar.gz

Download URL forge_mvc_workflow-1.0.0rc9.tar.gz
Size 29.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2f0f1cffc93ffeed8c23d6f95027be6bf4128ac41f7d207bdbf13a3c20d05908
BLAKE2b-256 checksum
How to use checksums
a23f29ff83925f4a1de8a6b6ff2e54b880c2d664d4950d5a74c72cd64ec52c02
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.0rc9-py3-none-any.whl

Download URL forge_mvc_workflow-1.0.0rc9-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f364ebcc253159e3718b7d874022a9931556ab0404520996502593f72782fa6
BLAKE2b-256 checksum
How to use checksums
a7d6fa7241a338af03eef3f0f0d35012d7ab2a10ba87e4a7a828862606559727
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