Skip to main content

compas_pb

PyPI version Python versions License MIT Build Status Documentation Made with COMPAS

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.

Release files for compas-pb 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compas-pb 1.1.0
File Size Uploaded
compas_pb-1.1.0.tar.gz 44.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for compas-pb 1.1.0
File Interpreter ABI Platform
compas_pb-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 81.8 kB

Release files / compas_pb-1.1.0.tar.gz

Download URL compas_pb-1.1.0.tar.gz
Size 44.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d63b791fc709499e19f0c8d2754d7d35ad0e893fa373ca6aa220969eb55470f1
BLAKE2b-256 checksum
How to use checksums
702e717e34c6ae830f1f5adec3d6859fb6d91a42df64b0f1db9158341678e29c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / compas_pb-1.1.0-py3-none-any.whl

Download URL compas_pb-1.1.0-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f5739ff246f8a2b3d70a690670a2fae603c0183120ada9e51023991c08f0d17
BLAKE2b-256 checksum
How to use checksums
8d1dc87e42f7b8907ec2971fbd8d80272eae315dfb26afc9f6e816faf9be856b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release history Release notifications | RSS feed

1.2.0

2 release files

1.1.4

2 release files

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page