stefankoegl/python-json-patch
关于
在 Python 中应用 JSON Patch
开发工具实测星标增长
- 24小时
- 0
- 7天
- -1
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文python-json-patch
Applying JSON Patches in Python
Library to apply JSON Patches according to RFC 6902
See the tutorial for examples.
- Website: https://github.com/stefankoegl/python-json-patch
- Repository: https://github.com/stefankoegl/python-json-patch.git
- Documentation: https://python-json-patch.readthedocs.io/
- PyPI: https://pypi.org/project/jsonpatch/
- CI: https://github.com/stefankoegl/python-json-patch/actions
- Coveralls: https://coveralls.io/github/stefankoegl/python-json-patch
String append extension
JsonPatchWithAppend is a drop-in replacement for JsonPatch with a
non-RFC string append operation. Its from_diff() method sends only the
new suffix when an object member's string grows. JsonPatch, make_patch()
and apply_patch() retain their standard RFC 6902 behavior.
See the tutorial for examples. Both sender and receiver must support the extension.
Type hints
jsonpatch ships type stubs (in the jsonpatch-stubs directory, as
jsonpatch.py is a single-file module), so type checkers such as mypy and
pyright work with it without further setup. JSON documents are typed as Any.
When changing the public API of jsonpatch.py, update
jsonpatch-stubs/__init__.pyi as well. These check that both agree, and that
typical usage in typetests/usage.py type-checks:
pip install mypy .
python -m mypy.stubtest --mypy-config-file pyproject.toml jsonpatch
cd typetests && mypy --config-file ../pyproject.toml usage.py
Running tests
pip install -r requirements.txt -r requirements-dev.txt
python tests.py
Running external tests
To run external tests (such as those from https://github.com/json-patch/json-patch-tests) use ext_tests.py
./ext_tests.py ../json-patch-tests/tests.json
Running property-based tests
Property-based tests using Hypothesis are in property_tests.py.
pip install hypothesis
python property_tests.py
Set HYPOTHESIS_PROFILE=thorough to run many more examples.
探索相关项目
加载中…