Skip to main content

Mew: python dataclass serializer/deserializer

Build Status Python Version Support PyPI Version Coverage Code style: black image

from dataclasses import dataclass
from enum import Enum
from typing import List

import mew


class Type(Enum):
    normal = 'normal'
    electric = 'electric'
    fire = 'fire'
    fighting = 'fighting'
    water = 'water'
    psychic = 'psychic'


@mew.serializable
@dataclass
class Pokemon:
    name: str
    pokedex: int
    type: Type
    abilities: List[str]


>>> pikachu = Pokemon('Pikachu', 25, Type.electric, ['static', 'lightning rod'])

>>> pikachu
Pokemon(name='Pikachu', pokedex=25, type=<Type.electric: 'electric'>, abilities=['static', 'lightning rod'])

>>> pikachu.dumps()
'{"name": "Pikachu", "pokedex": 25, "type": "electric", "abilities": ["static", "lightning rod"]}'

>>> assert pikachu == Pokemon.loads(pikachu.dumps())

Metadata

Release files for mew 0.1.4

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

Source distribution (sdist)

Source distribution for mew 0.1.4
File Size Uploaded
mew-0.1.4.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mew 0.1.4
File Interpreter ABI Platform
mew-0.1.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.8 kB

Release files / mew-0.1.4.tar.gz

Download URL mew-0.1.4.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8d38595e049aed4f580dea9b0537a94be275adc3c1e67bfa51689a9465a04de0
BLAKE2b-256 checksum
How to use checksums
ab65ba5ccbcc6079982eee4bd353c840e961dddc5d57bde902a674f561c39edb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release files / mew-0.1.4-py2.py3-none-any.whl

Download URL mew-0.1.4-py2.py3-none-any.whl
Size 5.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f4a7d2652bcb4eec10a105930200574c201733ec25c88cb0fb8e8c03eec61e97
BLAKE2b-256 checksum
How to use checksums
1254217c0df8bce456f93b019d7dac9310b498615f68de804205e8dbcd9f02f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.2

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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