Document subclass/staticmethod customization and the requirement to reuse compatible serialization when reopening a cache.
Test custom Decimal keys and values with a JSON encoder and loader, inline and file storage, instance overrides, reopen/pickle behavior, default byte compatibility, and binary stream bypass.
The hooks intentionally retain the standard-library string contract: dump returns str, load receives str. Byte-returning serializers can be adapted by decoding in the dump hook; this does not introduce native byte-returning hooks or a new dependency.
Validation
Tested on Windows with Python 3.12.10 and Django 4.2.30, using DJANGO_SETTINGS_MODULE=tests.settings and PYTHONPATH pointing at this checkout:
Regression before implementation: 3 failed, 7 passed (custom serialization ignored).
Blue, isort, Flake8, mypy, Pylint 2.17.7, Sphinx HTML build, doc8, and rstcheck passed.
doc8/rstcheck used LF-normalized disposable documentation copies for this Windows checkout.
A separate rollback probe restored the exact pristine source hash; applying the source patch reconstructed the modified hash.
Known tooling output: Django emits its existing USE_L10N deprecation warning, and Blue's Click integration emits duplicate-option warnings. No failures were ignored. Other Python versions were not run locally.
Documentation and scope
The tutorial and API docstring describe the new user-facing hooks. This repository has no current release-note file or README latest-update convention, so no new release-history format was introduced. No dependency or unrelated changes.
AI assistance
AI assisted with implementation, regression tests, local validation, and this PR description. The contributor remains responsible for the submission. No third-party code was copied and no additional runtime dependency was introduced.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refs #285 and follows the maintainer's proposed subclass hooks rather than adding constructor arguments.
The hooks intentionally retain the standard-library string contract: dump returns str, load receives str. Byte-returning serializers can be adapted by decoding in the dump hook; this does not introduce native byte-returning hooks or a new dependency.
Validation
Tested on Windows with Python 3.12.10 and Django 4.2.30, using DJANGO_SETTINGS_MODULE=tests.settings and PYTHONPATH pointing at this checkout:
Known tooling output: Django emits its existing USE_L10N deprecation warning, and Blue's Click integration emits duplicate-option warnings. No failures were ignored. Other Python versions were not run locally.
Documentation and scope
The tutorial and API docstring describe the new user-facing hooks. This repository has no current release-note file or README latest-update convention, so no new release-history format was introduced. No dependency or unrelated changes.
AI assistance
AI assisted with implementation, regression tests, local validation, and this PR description. The contributor remains responsible for the submission. No third-party code was copied and no additional runtime dependency was introduced.