Slotomania
A code generator that transforms schemas to Python slot classes and typescript interfaces
Examples
from slotomania.contrib.marshmallow_converter import (
schemas_to_slots,
)
class Eye(Schema):
color = fields.String(required=True)
class Head(Schema):
hair = fields.String(requried=True)
class Body(Schema):
eyes = fields.List(fields.Nested(Eye()), required=True)
mouth = fields.Decimal(required=True)
poo = fields.Float(required=True)
foot = fields.DateTime(required=True)
head = fields.Nested(Head(), required=True)
assert format_python_code(schemas_to_slots([
Eye(),
Head(),
Body(),
])) == format_python_code("""
from slotomania.core import Sloto
import datetime
import decimal
import typing
class Eye(Sloto):
__slots__ = ['color']
def __init__(
self,
color: str,
) -> None:
self.color = color
class Head(Sloto):
__slots__ = ['hair']
def __init__(
self,
hair: str = None,
) -> None:
self.hair = hair
class Body(Sloto):
__slots__ = ['eyes', 'foot', 'head', 'mouth', 'poo']
def __init__(
self,
eyes: typing.List[Eye],
foot: datetime.datetime,
head: Head,
mouth: decimal.Decimal,
poo: float,
) -> None:
self.eyes = eyes
self.foot = foot
self.head = head
self.mouth = mouth
self.poo = poo
"""
)
Metadata
Release files for slotomania 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slotomania-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for slotomania-0.0.5-py3-none-any.whl |
Release files / slotomania-0.0.5-py3-none-any.whl
| Download URL | slotomania-0.0.5-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
107214f62a6185b770a77b790bf6c9e7233932af0b1f2dd3a1f32127a0bcddbb
|
|
BLAKE2b-256 checksum How to use checksums |
69f86f6633fc1cccf309ed177513f48a07bc208e7fd5b17e3eb5a8de821b2499
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for slotomania 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.