I've been working on integrating rust code into python using PyO3 and Maturin. I've successfully written my Rust class and gotten most of the functionality to work, however I haven't been able to successfully deepcopy the object. I've tried workarounds using wrapper classes and custom defined deepcopy and getattr/setattr to not much avail, since it seems that the rust functions aren't pickleable. The Rust class is included in a standard #[pymodule], and tagged as a standard #[pyclass]. Has anyone encountered this issue before, and is there any way around it? Or should I just avoid deepcopying in my python code.
How to Pickle / deepcopy Python class created with maturin?
193 Views Asked by wfjohns1 At
1
There are 1 best solutions below
Related Questions in PYTHON
- new thread blocks main thread
- Extracting viewCount & SubscriberCount from YouTube API V3 for a given channel, where channelID does not equal userID
- Display images on Django Template Site
- Difference between list() and dict() with generators
- How can I serialize a numpy array while preserving matrix dimensions?
- Protractor did not run properly when using browser.wait, msg: "Wait timed out after XXXms"
- Why is my program adding int as string (4+7 = 47)?
- store numpy array in mysql
- how to omit the less frequent words from a dictionary in python?
- Update a text file with ( new words+ \n ) after the words is appended into a list
- python how to write list of lists to file
- Removing URL features from tokens in NLTK
- Optimizing for Social Leaderboards
- Python : Get size of string in bytes
- What is the code of the sorted function?
Related Questions in RUST
- Borrow mutable and immutable reference in the same block
- Linking to a static lib compiled with MSVC
- Using a no-method trait implementation in a different module
- No error for two traits implementing the same method
- How are the generic functions and types stored in an rlib?
- Is it possible to find an element in a Vec<T> and remove it?
- What does & actually do?
- unresolved name rand::thread_rng
- Use of undeclared type that is defined in another file
- Creating byte buffers in rust
- What's the difference between filter(|x|) and filter(|&x|)?
- How to convert iterator of chars to String?
- Correct idiom for freeing repr(C) structs using Drop trait
- Rust String concatenation
- Can I mark a function as deprecated?
Related Questions in DEEP-COPY
- How can I easily copy models and related models in Loopback JS
- I want to copy all things in a class to another
- data.table in place modification in R
- Is shallow copy really needed?
- Java copy constructor not working
- Deep copy - An element of a void** - Member of struct
- Deepcopy of a Matrix SageMath
- How to make a deep copy?
- Deep copy interconnected objects with references to each other
- Python: Local copy of array / list in functions
- Deep clone with copy constructor and object.clone()
- Deep Copy vs creating new class object each time
- Angular.Copy does not allow me to create unique objects in a separate array
- Deep copy of TCHAR array is truncated
- Weird behaviour copying objects
Related Questions in PYO3
- PyO3 built rust binding executable gives import error?
- Exposing Rust Vec<> to Python via pio3
- Is it possible to pass a DataFrame created in Rust to Python?
- Maturin project with Python bindings behind feature
- Re-use pymethods for multiple structs
- Clear up PyO3 removed Rust module?
- PyO3 Trait Clone is not implemented for 'PyList'
- Best practice to use pyo3-polars with `group_by`
- Rust PyO3 - How to execute a script with unknown module imports?
- Implementing a Python interface for a Rust function with generic Rust type
- Call to python class constructor from rust with pyo3 spawns new processes
- PyO3 "`From<&PyCell<mod::struct>>` is not implemented for `f64`"
- Store an object in a static Box and then retrieve as mutable?
- How to create a Python extension that returns back a Polars Dataframe from Rust to Python with Pyo3?
- Do I need to buy a Mac, to compile my Python extensions written in Rust for Mac OS?
Related Questions in MATURIN
- Maturin project with Python bindings behind feature
- Implementing a Python interface for a Rust function with generic Rust type
- Do I need to buy a Mac, to compile my Python extensions written in Rust for Mac OS?
- ERROR: No matching distribution found for maturin<2,>=1
- Updating project name in maturin build
- How to Pickle / deepcopy Python class created with maturin?
- How to iterate over vector of pyclass objects in rust?
- Error with compiling Python code that includes Rust written modules
- Rust package compiled with Maturin for use in Python causes significant runtime overhead compared to pure Rust
- using maturin to publish to private PyPi (code artifact)
- Using pyo3 and maturin for Python bindings. How to structure it?
- Cargo run using PyO3
- How to build a rust and python project into one exe executable?
- Building package for noarch with Maturin for Python >= 3.9
- Convert Polars dataframe to vector of structs
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You need to define a
__deepcopy__()method, like:As explained in the
copymodule documentation.Pickling is more involved, but see PyO3 issue #100.