pythonize
pythonize copied to clipboard
Maybe this is totally off, but would it even be possible to support arbitrary Python objects? For example, if I had a Python function like this: ```python class Input(TypedDict): type:...
Instead of attempting to downcast the input to a PyString, rely on the fact that for str objects, calling \_\_str\_\_ is a no-op, while for other objects it may allow...
Adding these tests shows the following errors: ``` failures: ---- de::test::test_tuple_from_pyfrozenset stdout ---- thread 'de::test::test_tuple_from_pyfrozenset' panicked at 'called `Result::unwrap()` on an `Err` value: UnexpectedType("'frozenset' object cannot be converted to 'Sequence'")',...
I'm opening this PR more as a place to start a discussion for my use-case and the changes I needed to make to support it. I'm hoping it's possible to...
As currently designed, `pythonize` and `depythonize` on structs with both `Serialize` and `IntoPy` implementations will always use the `Serialize` implementation. I'm not sure if that's surprising - it's certainly predictable...
Adds unit tests demonstrating correct behavior when deserializing u64 & i64 ~~This could cause problems if the integer was larger than could be represented by an `i64`.~~ ~~With this change,...
Added testcase for serializing nested struct. ```rust #[test] fn test_nested_struct() { #[derive(Serialize)] struct Foo { name: String, bar: Bar, } #[derive(Serialize)] struct Bar { name: String, } test_ser( Foo {...
This bumps the PyO3 dependency to the new 0.22 release. As `PyNativeType` (used in `src/de.rs`) has now been moved behind the `gil-refs` feature, I added that feature to the list...
This PR includes four changes: - Implement `PythonizeListType` for `PyTuple`, a small convenience that cannot be achieved outside the crate - Add support for prebuilding mappings during serialisation, which delays...
Working with pyo3 I end up needed this, user can implement it themself but I though it would be nice to have it in pythonize. Tell me what you think....