Skip to main content

OArepo FSM library for record state transitions

Project description

OArepo FSM library for record state transitions built on top of the library.


Run the following commands to bootstrap your environment

git clone
cd oarepo-fsm
pip install -e .[devel]


Check that correct record_class is being used on the RECORDS_REST_ENDPOINT’s item_route


To automatically add a link to the FSM endpoint to your record links, use the following links_factory_imp in your RECORDS_REST_ENDPOINTS config


If you wish to activate FSM on a certain Record enpoints only, put in your config


Where recid is the prefix key into your RECORDS_REST_ENDPOINTS configuration. This library activates FSM on all endpoints using record_class inherited from FSMMixin otherwise.


In order to use this library, you need to define a Record model in your app, that inherits from a FSMMixin column

from invenio_records import Record
from oarepo_fsm.mixins import FSMMixin

class RecordModelFSM(FSMMixin, Record):

To define FSM transitions on this class, create methods decorated with @transition(..) e.g.

    src=['open', 'archived'],
def publish(self, **kwargs):
    print('record published')

Where Transition is defined as:

  • src: record must be in one of the source states before transition could happen

  • dest: target state of the transition

  • required: a list of required **kwargs that must be passed to the @transition decorated function

  • permissions: currently logged user must have at least one of the permissions to execute the transition


To get current record state and possible transitions (only transitions that you have permission to invoke will be returned)

GET <record_rest_item_endpoint>
    metadata: {
        state: <current state of the record>
        ... other record metadata
    links: {
        self: ...,
        "transitions": {
            <fsm_transition1_name>: <transition_url>,
            <fsm_transition2_name>: <transition_url>,

To invoke a specific transition transition, do

POST <record_rest_endpoint>/<fsm_transition_name>

Further documentation is available on


Version 0.1.0 (released TBD)

  • Initial public release.

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

oarepo-fsm-1.0.3.tar.gz (16.2 kB view hashes)

Uploaded source

Built Distribution

oarepo_fsm-1.0.3-py2.py3-none-any.whl (22.2 kB view hashes)

Uploaded py2 py3

Supported by

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