Skip to main content

Protobuf extension for COMPAS Data

Project description

compas_pb

PyPI version Python versions License MIT Build Status Documentation

A COMPAS extension which lets you serialize and deserialize COMPAS Data types using protobuf.

Installation

Stable releases can be installed from PyPI.

pip install compas_pb

Basic Usage

Serialize to file

from compas.geometry import Vector
from compas_pb import pb_dump
from compas_pb import pb_load

PATH = "vector.data"

vector = Vector(1.0, 2.0, 3.0)

pb_dump(vector, PATH)

loaded_vector = pb_load(PATH)

(De)serialize to bytes

from compas.geometry import Vector
from compas_pb import pb_dump_bts
from compas_pb import pb_load_bts

vector = Vector(1.0, 2.0, 3.0)

bytes_vector = pb_dump_bts(vector)

loaded_vector = pb_load_bts(bytes_vector)

Serialization of arbitrarily nested data structures

from compas.geometry import Vector
from compas.geometry import Polyline
from compas_pb import pb_dump_bts
from compas_pb import pb_load_bts

data = {
    "direction": Vector(1.0, 2.0, 3.0),
    "outlines": 
        [
            Polyline([0, 0, 0], [1, 1, 1], [2, 2, 2]), 
            Polyline([3, 3, 3], [4, 4, 4], [5, 5, 5])
        ],
}

pb_data = pb_dump_bts(data)

loaded_data = pb_load_bts(pb_data)

Documentation

For further "getting started" instructions, a tutorial, examples, and an API reference, please check out the online documentation here: compas_pb docs

Issue Tracker

If you find a bug or if you have a problem with running the code, please file an issue on the Issue Tracker.

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

compas_pb-0.4.1.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

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

compas_pb-0.4.1-py3-none-any.whl (43.5 kB view details)

Uploaded Python 3

File details

Details for the file compas_pb-0.4.1.tar.gz.

File metadata

  • Download URL: compas_pb-0.4.1.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for compas_pb-0.4.1.tar.gz
Algorithm Hash digest
SHA256 6a31c459036c01950e9a0c2634df60de0b193064321e5dda7442f55c5e2b7456
MD5 a4d4b9025216d869592223cb5f8dc450
BLAKE2b-256 cbab05c5d4190dc3c7b8ed575795f47dae05b1afb36cc1ff4ef118a30aa0aeb3

See more details on using hashes here.

File details

Details for the file compas_pb-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: compas_pb-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 43.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for compas_pb-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4dbe8780cf5049eea1b256eb7b8f2f04f4d85e9eadbf1341157e15e3801b0e39
MD5 2a2c1ae0b7f2dc17e9d7d0e566a71582
BLAKE2b-256 332bfd1d6dbeee9ac8994680696294c7f1ff577c48b1cf34311773aeb6ca65ca

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