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.2.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

packed-0.2.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file packed-0.2.2.tar.gz.

File metadata

  • Download URL: packed-0.2.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for packed-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a23bec8c17beafbbac796965c54ad6ab532b4b96c7a00242dbaaa2d153a9df7b
MD5 9bdb908c1b48a3cfe233de48cb00c135
BLAKE2b-256 7e99ae79b10ace5914ff2fd5c3c28592a11cad2fa77ac92b030e6a749dcdb365

See more details on using hashes here.

File details

Details for the file packed-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: packed-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for packed-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bbeb4be842672bef7751f92159b6a08210b173a82c1ccbe7ffab22455f386c42
MD5 3abb60f5b79b091e5941bd64f99eca45
BLAKE2b-256 3e8f6cb2bc4009c862bdda1d3708e9cb45027014e3f4596726c113198fc58cfb

See more details on using hashes here.

Supported by

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