packed
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
Release files for packed 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| packed-0.2.2.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| packed-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / packed-0.2.2.tar.gz
| Download URL | packed-0.2.2.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a23bec8c17beafbbac796965c54ad6ab532b4b96c7a00242dbaaa2d153a9df7b
|
|
BLAKE2b-256 checksum How to use checksums |
7e99ae79b10ace5914ff2fd5c3c28592a11cad2fa77ac92b030e6a749dcdb365
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Release files / packed-0.2.2-py3-none-any.whl
| Download URL | packed-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbeb4be842672bef7751f92159b6a08210b173a82c1ccbe7ffab22455f386c42
|
|
BLAKE2b-256 checksum How to use checksums |
3e8f6cb2bc4009c862bdda1d3708e9cb45027014e3f4596726c113198fc58cfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|