yushiomote / perde Goto Github PK
View Code? Open in Web Editor NEWPython serialization framework powered by Rust
Home Page: https://yushiomote.github.io/perde
Python serialization framework powered by Rust
Home Page: https://yushiomote.github.io/perde
Compile error in serde
#[derive(Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
struct A {
#[serde(flatten, skip_deserializing)]
f: bool
}
This kind of error happens when the number of virtual fields (fields without skip
and flatten
) goes 0
.
Remaining tests
None of currently-supported serializer doesn't seem to use class name for serialization therefore rename
class attribute is not tested yet.
flatten + skip etc.
I'm using python 3.9
The class:
@dataclass
class TcUiMsg:
Fairvalue: Optional[dict[str, Fv]] = None
Fv is an object.
use perde.json.dumps to dump
out_txt = perde.json.dumps(msg)
got error:
Exception has occurred: TypeError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
invalid argument: cannot get generic type information: typing.Optional[dict]
: cannot get generic type information: dict[str, None]
: invalid value type in dict
: None
is not a type
the object can dumps with orjson (orjson dumps to bytes ...)
out_bytes = orjson.dumps(msg)
out_txt = out_bytes.decode("utf-8")
I'm using trio_websocket and got message in bytes.
orjson support this.
loads function in orjson:
def loads(__obj: Union[bytes, bytearray, str]) -> Any: ...
When trying to pip3 install perde
it fails with:
maturin failed
Caused by: The following metadata fields in `package.metadata.maturin` section of Cargo.toml are removed since maturin 0.14.0: classifier, requires-python, please set them in pyproject.toml as PEP 621 specifies.
Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-y8ss37ju', '--interpreter', '/usr/bin/python3']' returned non-zero exit status 1.
Checking for Rust toolchain....
Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-y8ss37ju --interpreter /usr/bin/python3`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.