Migration from pygraph (v1.0.x)
If your project was using pygraph (v1.0.0 or v1.0.1), this guide explains the transition to pysafe-pickle in v1.1.0.
Why the Rename?
The package name on PyPI has always been pysafe-pickle (pip install pysafe-pickle). In v1.0.x, it was imported as import pygraph.
To eliminate confusion between the PyPI distribution name and Python code, the canonical import is now:
python
import pysafe_pickle as pspThe Zero-Breakage Bridge in v1.1.0
v1.1.0 was designed as a strictly backward-compatible minor release:
- Existing Code Continues to Run:
import pygraphworks with 100% identical behavior.from pygraph.migrations import migrateworks without errors.from pygraph.exceptions import PyGraphErrorworks without errors.
- Gentle Warning:
- Importing
pygraphemits aFutureWarning(stacklevel=2) indicating thatpygraphwill be removed inv2.0.0.
- Importing
- Dual Binary Compatibility:
- Data files created with
v1.0.xstart with thePYGRmagic header. - The
v1.1.0decoder accepts bothPYGRand the newPSPKheader. - You can load old files without doing any data conversion!
- Data files created with
- Dual Attribute Support:
- Dataclasses with
__pygraph_version__continue to resolve migrations seamlessly alongside__pysafe_pickle_version__.
- Dataclasses with
How to Update Your Code
Updating takes less than a minute. Search and replace:
python
# Before (v1.0.x)
import pygraph
data = pygraph.dumps(obj)
restored = pygraph.loads(data)
@pygraph.migrate(from_version=1, to_version=2, type_name="User")
def migrate_user(state):
...python
# After (v1.1.0+)
import pysafe_pickle as psp
data = psp.dumps(obj)
restored = psp.loads(data)
@psp.migrate(from_version=1, to_version=2, type_name="User")
def migrate_user(state):
...