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

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: packed-0.2.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for packed-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e808b0ccb3a5a65749df8598d4a784d8ee883e69383d1e5dcf315fd0203c4493
MD5 4e4d08e89f15bbcec45515f3f77c28bd
BLAKE2b-256 c8bbd0b19563e4619cf12117c95472fed4beacc07062f5b0f33ee20aec613742

See more details on using hashes here.

File details

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

File metadata

  • Download URL: packed-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for packed-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7e9edd501aed359d24636f8f7492af369b42d39ab073a606f3c8c6f3eb1397e
MD5 636b0f96b2cc34d8533a121921a309b4
BLAKE2b-256 efd4141bca603e3bcbde506c511b7f344fc59da4ab07cdadc095cbb0f3559d1a

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