Fast drop-in replacement for copy.deepcopy().
- ⚡ 4-28x faster than
copy.deepcopy()on builtin types - 🧠 uses ~44% less memory than
copy.deepcopy()on average - 🧪 passes all tests in
CPython/Lib/test/test_copy.py - 🎯 behaves exactly the same as
copy.deepcopy()for alldatamodelzoo.CASES - 🛡️ tested for refcount, recursion, threading and memo edge cases
- 🐍 pre-built wheels for Python 3.10-3.14 on Linux/macOS/Windows (x64/ARM64)
- 🔓 passes all tesee-frts on threaded Pyth buildons
Warning
This is an alpha version.
pip install copiumSimply export COPIUM_PATCH_DEEPCOPY=1 before running your application. You
don't have to change a single line of code:
cat example.py
from copy import deepcopy
assert deepcopy(x := []) is not xCOPIUM_PATCH_DEEPCOPY=1 python example.py
import copium.patch
copium.patch.enable()from copium import deepcopy
assert deepcopy(x := []) is not xThe copium module includes all public declarations of stdlib copy module, so it's generally safe to:
- from copy import copy, deepcopy, Error
+ from copium import copy, deepcopy, Error