Skip to main content

No project description provided

Project description

packed

Codecov PyPI PyPI - Downloads Python Version

Installation

pip3 install packed

Usage

from packed import packable

@packable  # 1) register class
class EqualMatcher:
    def __init__(self, expected):
        self._expected = expected

    def match(self, actual):
        return actual == self._expected

    def __packed__(self):  # 2) pick fields
        return {"expected": self._expected}

client

from packed import pack

matcher = EqualMatcher("banana")
packed = pack(matcher)
# -> send «packed» over network

server

from packed import unpack

# <- recieve «packed» as binary
matcher = unpack(packed)
assert matcher.match("banana") is True

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

packed-0.1.3.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

packed-0.1.3-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

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