Skip to main content

urban-workflow

Moteur de workflow piloté par un langage dédié (DSL) — portage Python de Black-Beard-Sdk/Workflow (.NET), dont le système de normalisation des sorties JSON est remplacé par urban-json (moteur JSLT) : les messages produits par le moteur sont décrits par des templates .jslt déclaratifs, modifiables sans redéploiement.

Un workflow en quelques lignes

NAME ValidationAchat VERSION 1
MATCHING (Type = 'achat')

DEFINE EVENT  DemandeSoumise 'une demande est déposée';
DEFINE RULE   MontantInferieur (DECIMAL seuil) 'montant sous le seuil';
DEFINE ACTION NotifierValideur (TEXT dossier)  'demande d''approbation';
DEFINE CONST  seuil_auto 500 'approbation automatique sous ce montant';

INITIALIZE WORKFLOW
    ON EVENT DemandeSoumise RECURSIVE SWITCH Tri

DEFINE STATE Tri 'aiguillage'
    ON EVENT DemandeSoumise
        WHEN MontantInferieur(seuil = seuil_auto)
            SWITCH Approuvee
        EXECUTE NotifierValideur(dossier = @Workflow.ExternalId)
            SWITCH EnValidation
;
DEFINE STATE Approuvee    'approbation automatique' ;
DEFINE STATE EnValidation 'en attente d''un valideur'
    EXPIRE AFTER 3 DAY SWITCH Expiree
;
DEFINE STATE Expiree      'sans réponse' ;
from urban_workflow import (
    FunctionRegistry, MemoryStorage, Workflow,
    WorkflowEngine, WorkflowFactory, WorkflowProcessor, WorkflowsConfig,
)
from urban_workflow.dsl import parse_config
from urban_workflow.outputs import default_memory_output

rules = FunctionRegistry("rule")
rules.add("MontantInferieur", lambda ctx, seuil: float(
    ctx.incoming_event.extended_datas.get("Montant", 0)) < seuil)

storage = MemoryStorage()
configs = WorkflowsConfig().add_document(parse_config(SCRIPT, rules=rules))
processor = WorkflowProcessor(configs, WorkflowFactory())
processor.load_existing_workflows_by_external_id = (
    lambda key: storage.get_by(Workflow, key, "external_id"))
processor.output_actions = default_memory_output(storage)
engine = WorkflowEngine(processor)

engine.evaluate_event({"Name": "DemandeSoumise", "ExternalId": "DA-42",
                       "Type": "achat", "Montant": 120})

Documentation

Guide Contenu
docs/guide-dsl.md Créer un workflow : référence complète du langage — création d'instances, transitions SWITCH, conditions WHEN, actions, expiration, fragments
docs/guide-integration.md L'utiliser dans du code : règles métier, assemblage du moteur, templates JSLT, chaîne de sorties, événements techniques
docs/guide-tests.md Le tester : règles pures, configuration, templates, scénarios de bout en bout
docs/analyse-portage.md Analyse du projet source et choix structurants du portage

English versions: docs/en/dsl-guide.md · docs/en/integration-guide.md · docs/en/testing-guide.md

Playground

Un site web local pour écrire les scripts avec intellisense, diagnostics positionnés, paramétrage des règles métier et simulation d'événements sur le vrai moteur — distribution séparée urban-workflow-playground :

pip install urban-workflow-playground
urban-workflow-playground     # http://127.0.0.1:8777

Installation et développement

pip install -e .[dev]
python3 -m pytest -q

Dépendance unique du cœur : urban-json (qui apporte le runtime ANTLR du parseur DSL). Python ≥ 3.10.

État du portage

Socle, DSL (grammaires ANTLR reprises du source), moteur, templating urban-json et persistance SQL (extra [sql], SQLAlchemy Core) sont fonctionnels et testés (scénarios de bout en bout script DSL → événements → états → messages, cycle de vie persisté en SQL), avec CI GitHub Actions (tests Python 3.10 → 3.13, lint ruff). Les bugs connus du moteur source ne sont pas reproduits — chacun est couvert par un test dédié.

Licence

Voir LICENSE.

Metadata

Release files for urban-workflow 0.1.0

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

Source distribution (sdist)

Source distribution for urban-workflow 0.1.0
File Size Uploaded Provenance Actions
urban_workflow-0.1.0.tar.gz 82.4 kB With provenance Details for urban_workflow-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for urban-workflow 0.1.0
File Interpreter ABI Platform Actions
urban_workflow-0.1.0-py3-none-any.whl Python 3 none any Details for urban_workflow-0.1.0-py3-none-any.whl

Total release size: 157.3 kB

Release files / urban_workflow-0.1.0.tar.gz

Download URL urban_workflow-0.1.0.tar.gz
Size 82.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8e7e77958d14684b15e08a57e5a46bb1471a8c961af58a99f55291f66964e12a
BLAKE2b-256 checksum
How to use checksums
7456f85ea64d26d2ee653c0276c7804898b4f0b8a10a731f97b915b9f51e124e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / urban_workflow-0.1.0-py3-none-any.whl

Download URL urban_workflow-0.1.0-py3-none-any.whl
Size 74.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f24b91c9ca3557ad18cc181576a88d9fa8f61d612dccb0d21c02ef1d7d3dd6e
BLAKE2b-256 checksum
How to use checksums
c27600421a749e0e7d59eb114efc051976373cfd792617e4886e35a23a298c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for urban-workflow 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for urban_workflow-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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