Metadata-Version: 2.1
Name: sqlalchemy-state-machine
Version: 0.4.0
Summary: Helper for add transitions functionality in sqlalchemy
Home-page: https://github.com/bigbag/sqlalchemy-state-machine
Author: Pavel Liashkov
Author-email: pavel.liashkov@protonmail.com
Maintainer: Pavel Liashkov
Maintainer-email: pavel.liashkov@protonmail.com
License: Apache License, Version 2.0
Download-URL: https://pypi.python.org/pypi/sqlalchemy-state-machine
Description: sqlalchemy-state-machine
        =======================================================================
        
        .. image:: https://github.com/bigbag/sqlalchemy-state-machine/workflows/CI/badge.svg
           :target: https://github.com/bigbag/sqlalchemy-state-machine/actions?query=workflow%3ACI
        .. image:: https://img.shields.io/pypi/v/sqlalchemy-state-machine.svg
           :target: https://pypi.python.org/pypi/sqlalchemy-state-machine
        
        
        **sqlalchemy-state-machine** is a helper for add transitions functionality in sqlalchemy.
        
        
        Installation
        ------------
        sqlalchemy-state-machine is available on PyPI.
        Use pip to install:
        
            $ pip install sqlalchemy-state-machine
        
        Basic Usage
        -----------
        
        .. code:: python
        
            import sqlalchemy as sa
            from sqlalchemy.ext.declarative import declarative_base
            from sqlalchemy_state_machine import StateConfig, StateMixin
        
            Base = declarative_base()
        
            NEW = "new"
            SENT = "sent"
            FAILED = "failed"
        
            class Event(Base, StateMixin):
                __tablename__ = "users"
        
                state_config = StateConfig(
                    initial=NEW,
                    states=[NEW, SENT, FAILED],
                    transitions=[
                        ["set_sent", NEW, SENT],
                        ["set_failed", NEW, FAILED],
                    ],
                )
        
                id = sa.Column(sa.Integer, primary_key=True)
                name = sa.Column(sa.String)
                status = sa.Column(sa.String(), nullable=False, index=True)
        
        
            sa.event.listen(Event, "init", Event.init_state_machine)
            sa.event.listen(Event, "load", Event.init_state_machine)
        
            event = Event(name="Event1")
        
            assert event.status == NEW
            assert event.set_sent()
            assert event.status == SENT
        
        License
        -------
        
        sqlalchemy-state-machine is developed and distributed under the Apache 2.0 license.
Platform: POSIX
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Operating System :: POSIX
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Requires-Python: >=3.7
Description-Content-Type: text/x-rst
