Skip to main content

Octopus Energy Python service utilities

Project description

# 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


Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xocto-1.1-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file xocto-1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for xocto-1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7e9d6189458c8bf4f1d5aea75142191e6232f444d1184c526f1d8d422492db94
MD5 42400f0a9925feb49276a9d7cf0fb073
BLAKE2b-256 e7008a3508e833eea87204d62d7591a26333f8fa3788a5a3680c893aea9db4bd

See more details on using hashes here.

Supported by

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