Skip to content

hsdp/python-dropsonde

Repository files navigation

Cloud Foundry Dropsonde Protocol for Python

Compiled python generated from the Cloud Foundry Dropsonde Protobuf definition files.

The Dropsonde Protocol is defined here, and this repo provides "protoc" compiled Python and Python3 modules.

Example

The Standard protobuf files are referenced as follows.

from dropsonde.pb import envelope_pb2
from dropsonde.pb import error_pb2
from dropsonde.pb import http_pb2
from dropsonde.pb import log_pb2
from dropsonde.pb import metric_pb2
from dropsonde.pb import uuid_pb2

The UUID protobuf type is rather cryptic, so a utility function is included for parsing the type into a UUID formatted string.

>>> from dropsonde.util import get_uuid_string
>>> application_guid = {
...   'low': '12413561682238894606',
...   'high': '3611542221973970511'
... }
>>> application_guid = get_uuid_string(**application_guid)
>>> print(application_guid)
0ef23f83-94d4-45ac-e455-014268ec2103
>>>

Development

The Makefile provides all core development tasks.

Install environment

make install

This will

  1. clone the Dropsonde protobuf repo
  2. install dependencies for python2
  3. install dependencies for python3

Refactor and compile the protobuf files

make compile

This will

  1. create a copy of the protobuf source files
  2. refactor the "import" directives in the source files to match the required python package structure
  3. run "protoc" on the refactored source files and output the generated Python code into the "dropsonde.pb" python package tree.

Test

make test

This will

  1. run the tests to ensure that imports work
  2. ensure that the UUID conversion tool works

Clean

make clean

This will

  1. remove all the refactored protobuf files
  2. remove the virtualenv environments for python2 and python3

Package

make package

This will only package the compiled python files using setup.py

Build

make build

This will

  1. run the "clone" task
  2. run the "compile" task
  3. run the "test" task
  4. run the "package" task

Deploy

make deploy

This will

  1. run the "clean" task
  2. run the "clone" task
  3. run the "compile" task
  4. run the "test" task
  5. run the python setup.py sdist upload to deploy to PyPI.

About

Compiled python generated from the Cloud Foundry Dropsonde Protobuf definition files

Resources

License

Stars

Watchers

Forks

Packages

No packages published