Skip to main content

Jembe Workflow Management

Project description

Jembe Workflow Management

Library with simple Workflow implementation for use in Flask with Sqlalchemy. JembeWF can be used without Jembe Framework it only depends on Flask and Flask-SqlAlchemy.

Workflow is defined in Python by extending and combining Flow, State and Transition classes. Workflow is executed by Process and Step SqlAlchemy persistet instaces that saves information of process instances (defined by Flow), Step instances (defined by State).

Project state

In development

Usage

    from flask_sqlalchemy import SQLAlchemy
    import flask
    import jembewf
    app = flask.Flask(__name__)
    app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql+psycopg2://@/demo"
    db = SQLAlchemy(app=app)

    class Process(jembewf.ProcessMixin, db.Model):
        """Process"""

    class Step(jembewf.StepMixin, db.Model):
        """Step"""

    jwf = JembeWF()

    # Flow definition
    class StateCallback(jembewf.StateCallback):
        def callback(self):
            print(self.step)

    jwf.add(
        Flow("flow1")
        .add(
            State("state1", StateCallback).add(
                Transition("state2"),
            ),
            State("state2", StateCallback).add(
                Transition("state3"),
            ),
            State("state3", StateCallback),
        )
        .start_with("state1")
    )
    jwf.init_app(app, db, Process, Step)

    # starting process
    process = jwf.start("flow1")
    # steping thought process
    while process.is_running:
        process.proceed()

Output:

<Step #1: 'state1' from process #1: 'flow1'>
<Step #2: 'state2' from process #1: 'flow1'>
<Step #3: 'state3' from process #1: 'flow1'>

License

Jembe Workflow Management Copyright (C) 2021 BlokKod info@blokkod.me

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jembewf-0.0.3.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

jembewf-0.0.3-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file jembewf-0.0.3.tar.gz.

File metadata

  • Download URL: jembewf-0.0.3.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for jembewf-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bf36a9dc0245ee85ad381d33e0f1ccb9a861131c7b7b14cdb0ebb0e3d153b637
MD5 f43f58cacdccc814ca3324d5fb9ddab3
BLAKE2b-256 fa73bec5682707c584ee4ba026735cd8e94e2799ce2ebc7a231212617c957996

See more details on using hashes here.

File details

Details for the file jembewf-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: jembewf-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for jembewf-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 53ea85628467cc022aef4a82550a80d9380f2bf8e21a4db4f152d7ed2ea48501
MD5 5a6441b6dce473cffea79ac98d5bfc13
BLAKE2b-256 3c036df8c7439f897489cda2aae4883d343287784bc501381d997d5cd58b7169

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page