Skip to content

SundayWindy/pyruicore

Repository files navigation

pyruicore

Build Status   Coverage Status   codebeat badge   python3.8   issues stars   license

  • This package is used to load python dict data to python class.

Usage

from pyruicore import BaseModel, Field


class Department(BaseModel):
    name: str
    address: str


class User(BaseModel):
    age: int = Field(default_factory=lambda: 1)
    departs: List[Department]


user = User(
    departs=[
        {"name": "de1", "address": "address1"},
        Department(name="2", address="address2"),
    ]
)
user_dict = user.dict()
"""
user_dict = {
    "age": 1,
    "departs": [
        {"name": "de1", "address": "address1"},
        {"name": "2", "address": "address2"},
    ]
}
"""

Maintainers

@ruicore

Contributing

PRs are accepted, this is first workout version, may have many bugs, so welcome to point out bugs and fix it.

License

MIT © 2020 ruicore

About

load python dict to python class

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages