Django utilities from Octopus Energy
Python Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tests Add function to test for unapplied migrations Oct 19, 2016
xocto
.gitignore Improve makefile to publishing package Oct 19, 2016
CHANGELOG.md Bump version to v1.0.2 Jan 24, 2017
README.md Bump version to v1.0.2 Jan 24, 2017
circle.yml Add events functionality Oct 13, 2016
makefile Improve makefile to publishing package Oct 19, 2016
pytest.ini
setup.cfg Add events functionality Oct 13, 2016
setup.py Bump version to v1.0.2 Jan 24, 2017

README.md

xocto - utilities for Python services

This repo houses various shared utilities for Python services.

CI status:

CircleCI

Functionality

Event publishing

Use events.publish to publish application events. These will be logged as JSON to a logger named "events".

Sample usage:

from xocto import events

events.publish(
    event="ACCOUNT.CREATED", 
    params={
        'name': 'Barry Chuckle', 
        'quote_id': 'xyz123',
    },
    meta={
        'account_id': 'A-12312345'
    },
    account=account,  # optional
    request=request,  # optional
)

Event timing

Time events using:

from xocto import events

with events.Timer() as t:
    # do some things

events.publish(
    event="SOMETHING.HAPPENED",
    meta={
        "duration_in_ms": t.duration_in_ms 
    }
)

Contributing

Create and activate a virtualenv then:

$ make

Test package with:

$ make test

and:

$ make lint  

Release to PyPI by:

  1. Bumping the version in setup.py

  2. Updating CHANGELOG.md

  3. Committing

  4. Running:

    $ make publish