jsonpatch 1.46__tar.gz → 1.48__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jsonpatch-1.46 → jsonpatch-1.48}/MANIFEST.in +5 -1
- {jsonpatch-1.46/jsonpatch.egg-info → jsonpatch-1.48}/PKG-INFO +17 -12
- {jsonpatch-1.46 → jsonpatch-1.48}/README.md +13 -7
- jsonpatch-1.48/doc/Makefile +153 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/doc/commandline.rst +5 -0
- jsonpatch-1.48/doc/conf.py +250 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/doc/index.rst +1 -1
- {jsonpatch-1.46 → jsonpatch-1.48}/doc/mod-jsonpatch.rst +1 -1
- jsonpatch-1.48/doc/requirements.txt +2 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/doc/tutorial.rst +4 -4
- jsonpatch-1.48/ext_tests.py +103 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch-stubs/__init__.pyi +0 -3
- {jsonpatch-1.46 → jsonpatch-1.48/jsonpatch.egg-info}/PKG-INFO +17 -12
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch.egg-info/SOURCES.txt +5 -1
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch.py +162 -55
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch_cli.py +74 -26
- jsonpatch-1.48/makefile +20 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/property_tests.py +11 -37
- jsonpatch-1.48/requirements-dev.txt +3 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/setup.py +13 -11
- {jsonpatch-1.46 → jsonpatch-1.48}/tests.py +502 -183
- jsonpatch-1.46/AUTHORS +0 -4
- jsonpatch-1.46/ext_tests.py +0 -140
- {jsonpatch-1.46 → jsonpatch-1.48}/LICENSE +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch.egg-info/dependency_links.txt +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch.egg-info/entry_points.txt +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch.egg-info/requires.txt +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/jsonpatch.egg-info/top_level.txt +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/pyproject.toml +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/pytest.ini +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/requirements.txt +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/setup.cfg +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/tests.js +0 -0
- {jsonpatch-1.46 → jsonpatch-1.48}/typetests/usage.py +0 -0
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
include requirements.txt
|
|
2
|
+
include requirements-dev.txt
|
|
2
3
|
include LICENSE
|
|
3
4
|
include README.md
|
|
4
5
|
include tests.py
|
|
5
6
|
include doc/*.rst
|
|
7
|
+
include doc/conf.py
|
|
8
|
+
include doc/Makefile
|
|
9
|
+
include doc/requirements.txt
|
|
10
|
+
include makefile
|
|
6
11
|
include property_tests.py
|
|
7
12
|
include pytest.ini
|
|
8
13
|
include ext_tests.py
|
|
9
14
|
include typetests/usage.py
|
|
10
|
-
include AUTHORS
|
|
11
15
|
include tests.js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jsonpatch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.48
|
|
4
4
|
Summary: Apply JSON-Patches (RFC 6902)
|
|
5
5
|
Home-page: https://github.com/stefankoegl/python-json-patch
|
|
6
6
|
Author: Stefan Kögl
|
|
@@ -8,7 +8,7 @@ Author-email: stefan@skoegl.net
|
|
|
8
8
|
License-Expression: BSD-3-Clause
|
|
9
9
|
Project-URL: Website, https://github.com/stefankoegl/python-json-patch
|
|
10
10
|
Project-URL: Repository, https://github.com/stefankoegl/python-json-patch.git
|
|
11
|
-
Project-URL: Documentation, https://python-json-patch.readthedocs.
|
|
11
|
+
Project-URL: Documentation, https://python-json-patch.readthedocs.io/
|
|
12
12
|
Project-URL: PyPI, https://pypi.org/pypi/jsonpatch
|
|
13
13
|
Project-URL: Tests, https://github.com/stefankoegl/python-json-patch/actions
|
|
14
14
|
Project-URL: Test Coverage, https://coveralls.io/github/stefankoegl/python-json-patch
|
|
@@ -19,20 +19,19 @@ Classifier: Operating System :: OS Independent
|
|
|
19
19
|
Classifier: Programming Language :: Python
|
|
20
20
|
Classifier: Programming Language :: Python :: 3
|
|
21
21
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.13
|
|
26
25
|
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
27
27
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
28
28
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
29
29
|
Classifier: Topic :: Software Development :: Libraries
|
|
30
30
|
Classifier: Topic :: Utilities
|
|
31
31
|
Classifier: Typing :: Typed
|
|
32
|
-
Requires-Python: >=3.
|
|
32
|
+
Requires-Python: >=3.11
|
|
33
33
|
Description-Content-Type: text/markdown
|
|
34
34
|
License-File: LICENSE
|
|
35
|
-
License-File: AUTHORS
|
|
36
35
|
Requires-Dist: jsonpointer>=3.8
|
|
37
36
|
Dynamic: author
|
|
38
37
|
Dynamic: author-email
|
|
@@ -50,8 +49,8 @@ Dynamic: summary
|
|
|
50
49
|
python-json-patch
|
|
51
50
|
=================
|
|
52
51
|
|
|
53
|
-
[](https://pypi.org/project/jsonpatch
|
|
54
|
-
[](https://pypi.org/project/jsonpatch
|
|
52
|
+
[](https://pypi.org/project/jsonpatch/)
|
|
53
|
+
[](https://pypi.org/project/jsonpatch/)
|
|
55
54
|
[](https://github.com/stefankoegl/python-json-patch/actions/workflows/test.yaml)
|
|
56
55
|
[](https://coveralls.io/github/stefankoegl/python-json-patch?branch=master)
|
|
57
56
|
|
|
@@ -61,11 +60,12 @@ Applying JSON Patches in Python
|
|
|
61
60
|
Library to apply JSON Patches according to
|
|
62
61
|
[RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902)
|
|
63
62
|
|
|
64
|
-
See
|
|
63
|
+
See the [tutorial](https://python-json-patch.readthedocs.io/en/latest/tutorial.html)
|
|
64
|
+
for examples.
|
|
65
65
|
|
|
66
66
|
* Website: https://github.com/stefankoegl/python-json-patch
|
|
67
67
|
* Repository: https://github.com/stefankoegl/python-json-patch.git
|
|
68
|
-
* Documentation: https://python-json-patch.readthedocs.
|
|
68
|
+
* Documentation: https://python-json-patch.readthedocs.io/
|
|
69
69
|
* PyPI: https://pypi.org/project/jsonpatch/
|
|
70
70
|
* CI: https://github.com/stefankoegl/python-json-patch/actions
|
|
71
71
|
* Coveralls: https://coveralls.io/github/stefankoegl/python-json-patch
|
|
@@ -77,7 +77,8 @@ non-RFC string `append` operation. Its `from_diff()` method sends only the
|
|
|
77
77
|
new suffix when an object member's string grows. `JsonPatch`, `make_patch()`
|
|
78
78
|
and `apply_patch()` retain their standard RFC 6902 behavior.
|
|
79
79
|
|
|
80
|
-
See the [tutorial](
|
|
80
|
+
See the [tutorial](https://python-json-patch.readthedocs.io/en/latest/tutorial.html#string-append-extension)
|
|
81
|
+
for examples.
|
|
81
82
|
Both sender and receiver must support the extension.
|
|
82
83
|
|
|
83
84
|
Type hints
|
|
@@ -94,6 +95,11 @@ typical usage in `typetests/usage.py` type-checks:
|
|
|
94
95
|
python -m mypy.stubtest --mypy-config-file pyproject.toml jsonpatch
|
|
95
96
|
cd typetests && mypy --config-file ../pyproject.toml usage.py
|
|
96
97
|
|
|
98
|
+
Running tests
|
|
99
|
+
-------------
|
|
100
|
+
pip install -r requirements.txt -r requirements-dev.txt
|
|
101
|
+
python tests.py
|
|
102
|
+
|
|
97
103
|
Running external tests
|
|
98
104
|
----------------------
|
|
99
105
|
To run external tests (such as those from https://github.com/json-patch/json-patch-tests) use ext_tests.py
|
|
@@ -103,8 +109,7 @@ To run external tests (such as those from https://github.com/json-patch/json-pat
|
|
|
103
109
|
Running property-based tests
|
|
104
110
|
----------------------------
|
|
105
111
|
Property-based tests using [Hypothesis](https://hypothesis.readthedocs.io/)
|
|
106
|
-
are in property_tests.py.
|
|
107
|
-
yet are marked as expected failures.
|
|
112
|
+
are in property_tests.py.
|
|
108
113
|
|
|
109
114
|
pip install hypothesis
|
|
110
115
|
python property_tests.py
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
python-json-patch
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
-
[](https://pypi.org/project/jsonpatch
|
|
5
|
-
[](https://pypi.org/project/jsonpatch
|
|
4
|
+
[](https://pypi.org/project/jsonpatch/)
|
|
5
|
+
[](https://pypi.org/project/jsonpatch/)
|
|
6
6
|
[](https://github.com/stefankoegl/python-json-patch/actions/workflows/test.yaml)
|
|
7
7
|
[](https://coveralls.io/github/stefankoegl/python-json-patch?branch=master)
|
|
8
8
|
|
|
@@ -12,11 +12,12 @@ Applying JSON Patches in Python
|
|
|
12
12
|
Library to apply JSON Patches according to
|
|
13
13
|
[RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902)
|
|
14
14
|
|
|
15
|
-
See
|
|
15
|
+
See the [tutorial](https://python-json-patch.readthedocs.io/en/latest/tutorial.html)
|
|
16
|
+
for examples.
|
|
16
17
|
|
|
17
18
|
* Website: https://github.com/stefankoegl/python-json-patch
|
|
18
19
|
* Repository: https://github.com/stefankoegl/python-json-patch.git
|
|
19
|
-
* Documentation: https://python-json-patch.readthedocs.
|
|
20
|
+
* Documentation: https://python-json-patch.readthedocs.io/
|
|
20
21
|
* PyPI: https://pypi.org/project/jsonpatch/
|
|
21
22
|
* CI: https://github.com/stefankoegl/python-json-patch/actions
|
|
22
23
|
* Coveralls: https://coveralls.io/github/stefankoegl/python-json-patch
|
|
@@ -28,7 +29,8 @@ non-RFC string `append` operation. Its `from_diff()` method sends only the
|
|
|
28
29
|
new suffix when an object member's string grows. `JsonPatch`, `make_patch()`
|
|
29
30
|
and `apply_patch()` retain their standard RFC 6902 behavior.
|
|
30
31
|
|
|
31
|
-
See the [tutorial](
|
|
32
|
+
See the [tutorial](https://python-json-patch.readthedocs.io/en/latest/tutorial.html#string-append-extension)
|
|
33
|
+
for examples.
|
|
32
34
|
Both sender and receiver must support the extension.
|
|
33
35
|
|
|
34
36
|
Type hints
|
|
@@ -45,6 +47,11 @@ typical usage in `typetests/usage.py` type-checks:
|
|
|
45
47
|
python -m mypy.stubtest --mypy-config-file pyproject.toml jsonpatch
|
|
46
48
|
cd typetests && mypy --config-file ../pyproject.toml usage.py
|
|
47
49
|
|
|
50
|
+
Running tests
|
|
51
|
+
-------------
|
|
52
|
+
pip install -r requirements.txt -r requirements-dev.txt
|
|
53
|
+
python tests.py
|
|
54
|
+
|
|
48
55
|
Running external tests
|
|
49
56
|
----------------------
|
|
50
57
|
To run external tests (such as those from https://github.com/json-patch/json-patch-tests) use ext_tests.py
|
|
@@ -54,8 +61,7 @@ To run external tests (such as those from https://github.com/json-patch/json-pat
|
|
|
54
61
|
Running property-based tests
|
|
55
62
|
----------------------------
|
|
56
63
|
Property-based tests using [Hypothesis](https://hypothesis.readthedocs.io/)
|
|
57
|
-
are in property_tests.py.
|
|
58
|
-
yet are marked as expected failures.
|
|
64
|
+
are in property_tests.py.
|
|
59
65
|
|
|
60
66
|
pip install hypothesis
|
|
61
67
|
python property_tests.py
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line.
|
|
5
|
+
SPHINXOPTS =
|
|
6
|
+
SPHINXBUILD = sphinx-build
|
|
7
|
+
PAPER =
|
|
8
|
+
BUILDDIR = _build
|
|
9
|
+
|
|
10
|
+
# Internal variables.
|
|
11
|
+
PAPEROPT_a4 = -D latex_paper_size=a4
|
|
12
|
+
PAPEROPT_letter = -D latex_paper_size=letter
|
|
13
|
+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
14
|
+
# the i18n builder cannot share the environment and doctrees with the others
|
|
15
|
+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
16
|
+
|
|
17
|
+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
|
18
|
+
|
|
19
|
+
help:
|
|
20
|
+
@echo "Please use \`make <target>' where <target> is one of"
|
|
21
|
+
@echo " html to make standalone HTML files"
|
|
22
|
+
@echo " dirhtml to make HTML files named index.html in directories"
|
|
23
|
+
@echo " singlehtml to make a single large HTML file"
|
|
24
|
+
@echo " pickle to make pickle files"
|
|
25
|
+
@echo " json to make JSON files"
|
|
26
|
+
@echo " htmlhelp to make HTML files and a HTML help project"
|
|
27
|
+
@echo " qthelp to make HTML files and a qthelp project"
|
|
28
|
+
@echo " devhelp to make HTML files and a Devhelp project"
|
|
29
|
+
@echo " epub to make an epub"
|
|
30
|
+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
|
31
|
+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
|
32
|
+
@echo " text to make text files"
|
|
33
|
+
@echo " man to make manual pages"
|
|
34
|
+
@echo " texinfo to make Texinfo files"
|
|
35
|
+
@echo " info to make Texinfo files and run them through makeinfo"
|
|
36
|
+
@echo " gettext to make PO message catalogs"
|
|
37
|
+
@echo " changes to make an overview of all changed/added/deprecated items"
|
|
38
|
+
@echo " linkcheck to check all external links for integrity"
|
|
39
|
+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
|
40
|
+
|
|
41
|
+
clean:
|
|
42
|
+
-rm -rf $(BUILDDIR)/*
|
|
43
|
+
|
|
44
|
+
html:
|
|
45
|
+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
|
46
|
+
@echo
|
|
47
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
48
|
+
|
|
49
|
+
dirhtml:
|
|
50
|
+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
|
51
|
+
@echo
|
|
52
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
|
53
|
+
|
|
54
|
+
singlehtml:
|
|
55
|
+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
|
56
|
+
@echo
|
|
57
|
+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
|
58
|
+
|
|
59
|
+
pickle:
|
|
60
|
+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
|
61
|
+
@echo
|
|
62
|
+
@echo "Build finished; now you can process the pickle files."
|
|
63
|
+
|
|
64
|
+
json:
|
|
65
|
+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
|
66
|
+
@echo
|
|
67
|
+
@echo "Build finished; now you can process the JSON files."
|
|
68
|
+
|
|
69
|
+
htmlhelp:
|
|
70
|
+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
|
71
|
+
@echo
|
|
72
|
+
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
|
73
|
+
".hhp project file in $(BUILDDIR)/htmlhelp."
|
|
74
|
+
|
|
75
|
+
qthelp:
|
|
76
|
+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
|
77
|
+
@echo
|
|
78
|
+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
|
79
|
+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
|
80
|
+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/python-json-patch.qhcp"
|
|
81
|
+
@echo "To view the help file:"
|
|
82
|
+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/python-json-patch.qhc"
|
|
83
|
+
|
|
84
|
+
devhelp:
|
|
85
|
+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
|
86
|
+
@echo
|
|
87
|
+
@echo "Build finished."
|
|
88
|
+
@echo "To view the help file:"
|
|
89
|
+
@echo "# mkdir -p $$HOME/.local/share/devhelp/python-json-patch"
|
|
90
|
+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/python-json-patch"
|
|
91
|
+
@echo "# devhelp"
|
|
92
|
+
|
|
93
|
+
epub:
|
|
94
|
+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
|
95
|
+
@echo
|
|
96
|
+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
|
97
|
+
|
|
98
|
+
latex:
|
|
99
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
100
|
+
@echo
|
|
101
|
+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
|
102
|
+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
|
103
|
+
"(use \`make latexpdf' here to do that automatically)."
|
|
104
|
+
|
|
105
|
+
latexpdf:
|
|
106
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
107
|
+
@echo "Running LaTeX files through pdflatex..."
|
|
108
|
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
|
109
|
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
|
110
|
+
|
|
111
|
+
text:
|
|
112
|
+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
|
113
|
+
@echo
|
|
114
|
+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
|
115
|
+
|
|
116
|
+
man:
|
|
117
|
+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
|
118
|
+
@echo
|
|
119
|
+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
|
120
|
+
|
|
121
|
+
texinfo:
|
|
122
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
123
|
+
@echo
|
|
124
|
+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
|
125
|
+
@echo "Run \`make' in that directory to run these through makeinfo" \
|
|
126
|
+
"(use \`make info' here to do that automatically)."
|
|
127
|
+
|
|
128
|
+
info:
|
|
129
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
130
|
+
@echo "Running Texinfo files through makeinfo..."
|
|
131
|
+
make -C $(BUILDDIR)/texinfo info
|
|
132
|
+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
|
133
|
+
|
|
134
|
+
gettext:
|
|
135
|
+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
|
136
|
+
@echo
|
|
137
|
+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
|
138
|
+
|
|
139
|
+
changes:
|
|
140
|
+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
|
141
|
+
@echo
|
|
142
|
+
@echo "The overview file is in $(BUILDDIR)/changes."
|
|
143
|
+
|
|
144
|
+
linkcheck:
|
|
145
|
+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
|
146
|
+
@echo
|
|
147
|
+
@echo "Link check complete; look for any errors in the above output " \
|
|
148
|
+
"or in $(BUILDDIR)/linkcheck/output.txt."
|
|
149
|
+
|
|
150
|
+
doctest:
|
|
151
|
+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
|
152
|
+
@echo "Testing of doctests in the sources finished, look at the " \
|
|
153
|
+
"results in $(BUILDDIR)/doctest/output.txt."
|
|
@@ -7,6 +7,11 @@ The JSON patch package contains the commandline utilities ``jsondiff`` and
|
|
|
7
7
|
Both utilities read JSON files as UTF-8. When ``jsonpatch`` modifies a file
|
|
8
8
|
in-place, it also writes UTF-8.
|
|
9
9
|
|
|
10
|
+
If a file cannot be read or written, is not valid JSON, or if the patch
|
|
11
|
+
cannot be applied, both print a one-line error message to standard error and
|
|
12
|
+
exit with status 2. ``jsondiff`` exits with status 1 if the files differ,
|
|
13
|
+
like ``diff``, and with 0 if they are equal.
|
|
14
|
+
|
|
10
15
|
``jsondiff``
|
|
11
16
|
------------
|
|
12
17
|
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# python-json-patch documentation build configuration file, created by
|
|
4
|
+
# sphinx-quickstart on Sat Apr 13 23:07:23 2013.
|
|
5
|
+
#
|
|
6
|
+
# This file is execfile()d with the current directory set to its containing dir.
|
|
7
|
+
#
|
|
8
|
+
# Note that not all possible configuration values are present in this
|
|
9
|
+
# autogenerated file.
|
|
10
|
+
#
|
|
11
|
+
# All configuration values have a default; values that are commented out
|
|
12
|
+
# serve to show the default.
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
import os
|
|
16
|
+
|
|
17
|
+
# If extensions (or modules to document with autodoc) are in another directory,
|
|
18
|
+
# add these directories to sys.path here. If the directory is relative to the
|
|
19
|
+
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
20
|
+
sys.path.insert(0, os.path.join(os.path.abspath('.'), '..'))
|
|
21
|
+
|
|
22
|
+
import jsonpatch # noqa: E402, needs the path set above
|
|
23
|
+
|
|
24
|
+
# -- General configuration -----------------------------------------------------
|
|
25
|
+
|
|
26
|
+
# If your documentation needs a minimal Sphinx version, state it here.
|
|
27
|
+
# needs_sphinx = '1.0'
|
|
28
|
+
|
|
29
|
+
# Add any Sphinx extension module names here, as strings. They can be extensions
|
|
30
|
+
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
31
|
+
extensions = ['sphinx.ext.autodoc']
|
|
32
|
+
|
|
33
|
+
# JsonPointer comes from the jsonpointer package and is not documented here,
|
|
34
|
+
# so references to it can not be resolved (relevant for sphinx-build -n).
|
|
35
|
+
nitpick_ignore = [('py:class', 'JsonPointer')]
|
|
36
|
+
|
|
37
|
+
# Add any paths that contain templates here, relative to this directory.
|
|
38
|
+
templates_path = []
|
|
39
|
+
|
|
40
|
+
# The suffix of source filenames.
|
|
41
|
+
source_suffix = '.rst'
|
|
42
|
+
|
|
43
|
+
# The encoding of source files.
|
|
44
|
+
# source_encoding = 'utf-8-sig'
|
|
45
|
+
|
|
46
|
+
# The master toctree document.
|
|
47
|
+
master_doc = 'index'
|
|
48
|
+
|
|
49
|
+
# General information about the project.
|
|
50
|
+
project = 'python-json-patch'
|
|
51
|
+
copyright = '2011, Stefan Kögl'
|
|
52
|
+
|
|
53
|
+
# The version info for the project you're documenting, acts as replacement for
|
|
54
|
+
# |version| and |release|, also used in various other places throughout the
|
|
55
|
+
# built documents.
|
|
56
|
+
#
|
|
57
|
+
|
|
58
|
+
# The short X.Y version.
|
|
59
|
+
version = jsonpatch.__version__
|
|
60
|
+
# The full version, including alpha/beta/rc tags.
|
|
61
|
+
release = jsonpatch.__version__
|
|
62
|
+
|
|
63
|
+
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
64
|
+
# for a list of supported languages.
|
|
65
|
+
# language = None
|
|
66
|
+
|
|
67
|
+
# There are two options for replacing |today|: either, you set today to some
|
|
68
|
+
# non-false value, then it is used:
|
|
69
|
+
# today = ''
|
|
70
|
+
# Else, today_fmt is used as the format for a strftime call.
|
|
71
|
+
# today_fmt = '%B %d, %Y'
|
|
72
|
+
|
|
73
|
+
# List of patterns, relative to source directory, that match files and
|
|
74
|
+
# directories to ignore when looking for source files.
|
|
75
|
+
exclude_patterns = ['_build']
|
|
76
|
+
|
|
77
|
+
# The reST default role (used for this markup: `text`) to use for all documents.
|
|
78
|
+
# default_role = None
|
|
79
|
+
|
|
80
|
+
# If true, '()' will be appended to :func: etc. cross-reference text.
|
|
81
|
+
# add_function_parentheses = True
|
|
82
|
+
|
|
83
|
+
# If true, the current module name will be prepended to all description
|
|
84
|
+
# unit titles (such as .. function::).
|
|
85
|
+
# add_module_names = True
|
|
86
|
+
|
|
87
|
+
# If true, sectionauthor and moduleauthor directives will be shown in the
|
|
88
|
+
# output. They are ignored by default.
|
|
89
|
+
# show_authors = False
|
|
90
|
+
|
|
91
|
+
# The name of the Pygments (syntax highlighting) style to use.
|
|
92
|
+
pygments_style = 'sphinx'
|
|
93
|
+
|
|
94
|
+
# A list of ignored prefixes for module index sorting.
|
|
95
|
+
# modindex_common_prefix = []
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# -- Options for HTML output ---------------------------------------------------
|
|
99
|
+
|
|
100
|
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
101
|
+
# a list of builtin themes.
|
|
102
|
+
html_theme = 'alabaster'
|
|
103
|
+
|
|
104
|
+
# Theme options are theme-specific and customize the look and feel of a theme
|
|
105
|
+
# further. For a list of options available for each theme, see the
|
|
106
|
+
# documentation.
|
|
107
|
+
# html_theme_options = {}
|
|
108
|
+
|
|
109
|
+
# Add any paths that contain custom themes here, relative to this directory.
|
|
110
|
+
# html_theme_path = []
|
|
111
|
+
|
|
112
|
+
# The name for this set of Sphinx documents. If None, it defaults to
|
|
113
|
+
# "<project> v<release> documentation".
|
|
114
|
+
# html_title = None
|
|
115
|
+
|
|
116
|
+
# A shorter title for the navigation bar. Default is the same as html_title.
|
|
117
|
+
# html_short_title = None
|
|
118
|
+
|
|
119
|
+
# The name of an image file (relative to this directory) to place at the top
|
|
120
|
+
# of the sidebar.
|
|
121
|
+
# html_logo = None
|
|
122
|
+
|
|
123
|
+
# The name of an image file (within the static path) to use as favicon of the
|
|
124
|
+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
|
125
|
+
# pixels large.
|
|
126
|
+
# html_favicon = None
|
|
127
|
+
|
|
128
|
+
# Add any paths that contain custom static files (such as style sheets) here,
|
|
129
|
+
# relative to this directory. They are copied after the builtin static files,
|
|
130
|
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
131
|
+
html_static_path = []
|
|
132
|
+
|
|
133
|
+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
|
134
|
+
# using the given strftime format.
|
|
135
|
+
# html_last_updated_fmt = '%b %d, %Y'
|
|
136
|
+
|
|
137
|
+
# If true, SmartyPants will be used to convert quotes and dashes to
|
|
138
|
+
# typographically correct entities.
|
|
139
|
+
# html_use_smartypants = True
|
|
140
|
+
|
|
141
|
+
# Custom sidebar templates, maps document names to template names.
|
|
142
|
+
# html_sidebars = {}
|
|
143
|
+
|
|
144
|
+
# Additional templates that should be rendered to pages, maps page names to
|
|
145
|
+
# template names.
|
|
146
|
+
# html_additional_pages = {}
|
|
147
|
+
|
|
148
|
+
# If false, no module index is generated.
|
|
149
|
+
# html_domain_indices = True
|
|
150
|
+
|
|
151
|
+
# If false, no index is generated.
|
|
152
|
+
# html_use_index = True
|
|
153
|
+
|
|
154
|
+
# If true, the index is split into individual pages for each letter.
|
|
155
|
+
# html_split_index = False
|
|
156
|
+
|
|
157
|
+
# If true, links to the reST sources are added to the pages.
|
|
158
|
+
# html_show_sourcelink = True
|
|
159
|
+
|
|
160
|
+
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
|
161
|
+
# html_show_sphinx = True
|
|
162
|
+
|
|
163
|
+
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
|
164
|
+
# html_show_copyright = True
|
|
165
|
+
|
|
166
|
+
# If true, an OpenSearch description file will be output, and all pages will
|
|
167
|
+
# contain a <link> tag referring to it. The value of this option must be the
|
|
168
|
+
# base URL from which the finished HTML is served.
|
|
169
|
+
# html_use_opensearch = ''
|
|
170
|
+
|
|
171
|
+
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
|
172
|
+
# html_file_suffix = None
|
|
173
|
+
|
|
174
|
+
# Output file base name for HTML help builder.
|
|
175
|
+
htmlhelp_basename = 'python-json-patchdoc'
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
# -- Options for LaTeX output --------------------------------------------------
|
|
179
|
+
|
|
180
|
+
latex_elements = {
|
|
181
|
+
# The paper size ('letterpaper' or 'a4paper').
|
|
182
|
+
# 'papersize': 'letterpaper',
|
|
183
|
+
|
|
184
|
+
# The font size ('10pt', '11pt' or '12pt').
|
|
185
|
+
# 'pointsize': '10pt',
|
|
186
|
+
|
|
187
|
+
# Additional stuff for the LaTeX preamble.
|
|
188
|
+
# 'preamble': '',
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
# Grouping the document tree into LaTeX files. List of tuples
|
|
192
|
+
# (source start file, target name, title, author, documentclass [howto/manual]).
|
|
193
|
+
latex_documents = [
|
|
194
|
+
('index', 'python-json-patch.tex', 'python-json-patch Documentation',
|
|
195
|
+
'Stefan Kögl', 'manual'),
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
# The name of an image file (relative to this directory) to place at the top of
|
|
199
|
+
# the title page.
|
|
200
|
+
# latex_logo = None
|
|
201
|
+
|
|
202
|
+
# For "manual" documents, if this is true, then toplevel headings are parts,
|
|
203
|
+
# not chapters.
|
|
204
|
+
# latex_use_parts = False
|
|
205
|
+
|
|
206
|
+
# If true, show page references after internal links.
|
|
207
|
+
# latex_show_pagerefs = False
|
|
208
|
+
|
|
209
|
+
# If true, show URL addresses after external links.
|
|
210
|
+
# latex_show_urls = False
|
|
211
|
+
|
|
212
|
+
# Documents to append as an appendix to all manuals.
|
|
213
|
+
# latex_appendices = []
|
|
214
|
+
|
|
215
|
+
# If false, no module index is generated.
|
|
216
|
+
# latex_domain_indices = True
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
# -- Options for manual page output --------------------------------------------
|
|
220
|
+
|
|
221
|
+
# One entry per manual page. List of tuples
|
|
222
|
+
# (source start file, name, description, authors, manual section).
|
|
223
|
+
man_pages = [
|
|
224
|
+
('index', 'python-json-patch', 'python-json-patch Documentation',
|
|
225
|
+
['Stefan Kögl'], 1)
|
|
226
|
+
]
|
|
227
|
+
|
|
228
|
+
# If true, show URL addresses after external links.
|
|
229
|
+
# man_show_urls = False
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
# -- Options for Texinfo output ------------------------------------------------
|
|
233
|
+
|
|
234
|
+
# Grouping the document tree into Texinfo files. List of tuples
|
|
235
|
+
# (source start file, target name, title, author,
|
|
236
|
+
# dir menu entry, description, category)
|
|
237
|
+
texinfo_documents = [
|
|
238
|
+
('index', 'python-json-patch', 'python-json-patch Documentation',
|
|
239
|
+
'Stefan Kögl', 'python-json-patch', 'Apply JSON Patches (RFC 6902)',
|
|
240
|
+
'Miscellaneous'),
|
|
241
|
+
]
|
|
242
|
+
|
|
243
|
+
# Documents to append as an appendix to all manuals.
|
|
244
|
+
# texinfo_appendices = []
|
|
245
|
+
|
|
246
|
+
# If false, no module index is generated.
|
|
247
|
+
# texinfo_domain_indices = True
|
|
248
|
+
|
|
249
|
+
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
|
250
|
+
# texinfo_show_urls = 'footnote'
|
|
@@ -8,7 +8,7 @@ python-json-patch
|
|
|
8
8
|
|
|
9
9
|
`python-json-patch <https://github.com/stefankoegl/python-json-patch>`_
|
|
10
10
|
is a Python library for applying JSON patches (`RFC 6902
|
|
11
|
-
<https://datatracker.ietf.org/doc/html/rfc6902>`_). Python 3.
|
|
11
|
+
<https://datatracker.ietf.org/doc/html/rfc6902>`_). Python 3.11+ is
|
|
12
12
|
supported. Tests are run on both CPython and PyPy.
|
|
13
13
|
|
|
14
14
|
**Installation**
|
|
@@ -7,7 +7,7 @@ patch syntax.
|
|
|
7
7
|
Creating a Patch
|
|
8
8
|
----------------
|
|
9
9
|
|
|
10
|
-
Patches can be created in two ways. One way is to
|
|
10
|
+
Patches can be created in two ways. One way is to explicitly create a
|
|
11
11
|
``JsonPatch`` object from an iterable of operation dictionaries, such as a
|
|
12
12
|
list, tuple, iterator, or generator. Non-sequence iterables are materialized
|
|
13
13
|
before validation so that the patch can be applied repeatedly.
|
|
@@ -198,7 +198,7 @@ given:
|
|
|
198
198
|
Ignoring Missing Locations
|
|
199
199
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
200
200
|
|
|
201
|
-
`RFC 6902 <https://
|
|
201
|
+
`RFC 6902 <https://datatracker.ietf.org/doc/html/rfc6902#section-4.2>`_ requires a
|
|
202
202
|
``remove`` to fail if the location it removes doesn't exist, and this library
|
|
203
203
|
follows it: such an operation raises ``JsonPatchPathNotFound``. A ``replace``
|
|
204
204
|
of a missing location, and a ``move`` or ``copy`` from one, raise it as well.
|
|
@@ -469,7 +469,7 @@ Dealing with Custom Types
|
|
|
469
469
|
-------------------------
|
|
470
470
|
|
|
471
471
|
Custom JSON dump and load functions can be used to support custom types such as
|
|
472
|
-
|
|
472
|
+
``decimal.Decimal``. The following example shows how the
|
|
473
473
|
`simplejson <https://simplejson.readthedocs.io/>`_ package, which has native
|
|
474
474
|
support for Python's ``Decimal`` type, can be used to create a custom
|
|
475
475
|
``JsonPatch`` subclass with ``Decimal`` support:
|
|
@@ -512,7 +512,7 @@ a dumps function to ``to_string``:
|
|
|
512
512
|
>>> serialized_patch
|
|
513
513
|
'[{"op": "add", "path": "/bar", "value": 1.10}]'
|
|
514
514
|
|
|
515
|
-
and load
|
|
515
|
+
and a load function to ``from_string``:
|
|
516
516
|
|
|
517
517
|
.. code-block:: python
|
|
518
518
|
|