skip to navigation
skip to content

xocto 1.0.2

Octopus Energy Python service utilities

# xocto - utilities for Python services

This repo houses various shared utilities for Python services.

CI status:

[![CircleCI](https://circleci.com/gh/octoenergy/xocto/tree/master.svg?style=svg)](https://circleci.com/gh/octoenergy/xocto/tree/master)

## Functionality

### Event publishing

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

Sample usage:

```python
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:

```python
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

3. Running:

$ make publish


 
File Type Py Version Uploaded on Size
xocto-1.0.2-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2017-01-24 5KB