json2xml 5.0.5__tar.gz → 5.2.0__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.
Files changed (45) hide show
  1. json2xml-5.2.0/LICENSE +201 -0
  2. json2xml-5.2.0/PKG-INFO +281 -0
  3. {json2xml-5.0.5 → json2xml-5.2.0}/README.rst +49 -8
  4. {json2xml-5.0.5 → json2xml-5.2.0}/json2xml/__init__.py +1 -1
  5. {json2xml-5.0.5 → json2xml-5.2.0}/json2xml/dicttoxml.py +26 -14
  6. {json2xml-5.0.5 → json2xml-5.2.0}/json2xml/json2xml.py +1 -1
  7. {json2xml-5.0.5 → json2xml-5.2.0}/json2xml/utils.py +0 -1
  8. json2xml-5.2.0/json2xml.egg-info/PKG-INFO +281 -0
  9. {json2xml-5.0.5 → json2xml-5.2.0}/json2xml.egg-info/SOURCES.txt +3 -2
  10. json2xml-5.2.0/json2xml.egg-info/requires.txt +12 -0
  11. json2xml-5.2.0/pyproject.toml +76 -0
  12. json2xml-5.2.0/setup.py +8 -0
  13. json2xml-5.2.0/tests/conftest.py +80 -0
  14. json2xml-5.2.0/tests/test_dict2xml.py +1145 -0
  15. {json2xml-5.0.5 → json2xml-5.2.0}/tests/test_json2xml.py +29 -30
  16. json2xml-5.2.0/tests/test_utils.py +310 -0
  17. json2xml-5.0.5/LICENSE +0 -16
  18. json2xml-5.0.5/PKG-INFO +0 -677
  19. json2xml-5.0.5/json2xml.egg-info/PKG-INFO +0 -677
  20. json2xml-5.0.5/json2xml.egg-info/not-zip-safe +0 -1
  21. json2xml-5.0.5/json2xml.egg-info/requires.txt +0 -2
  22. json2xml-5.0.5/pyproject.toml +0 -19
  23. json2xml-5.0.5/setup.py +0 -53
  24. json2xml-5.0.5/tests/test_dict2xml.py +0 -395
  25. {json2xml-5.0.5 → json2xml-5.2.0}/AUTHORS.rst +0 -0
  26. {json2xml-5.0.5 → json2xml-5.2.0}/CONTRIBUTING.rst +0 -0
  27. {json2xml-5.0.5 → json2xml-5.2.0}/HISTORY.rst +0 -0
  28. {json2xml-5.0.5 → json2xml-5.2.0}/MANIFEST.in +0 -0
  29. {json2xml-5.0.5 → json2xml-5.2.0}/docs/Makefile +0 -0
  30. {json2xml-5.0.5 → json2xml-5.2.0}/docs/authors.rst +0 -0
  31. {json2xml-5.0.5 → json2xml-5.2.0}/docs/conf.py +2 -2
  32. {json2xml-5.0.5 → json2xml-5.2.0}/docs/contributing.rst +0 -0
  33. {json2xml-5.0.5 → json2xml-5.2.0}/docs/history.rst +0 -0
  34. {json2xml-5.0.5 → json2xml-5.2.0}/docs/index.rst +0 -0
  35. {json2xml-5.0.5 → json2xml-5.2.0}/docs/installation.rst +0 -0
  36. {json2xml-5.0.5 → json2xml-5.2.0}/docs/json2xml.rst +0 -0
  37. {json2xml-5.0.5 → json2xml-5.2.0}/docs/make.bat +0 -0
  38. {json2xml-5.0.5 → json2xml-5.2.0}/docs/modules.rst +0 -0
  39. {json2xml-5.0.5 → json2xml-5.2.0}/docs/readme.rst +0 -0
  40. {json2xml-5.0.5 → json2xml-5.2.0}/docs/usage.rst +0 -0
  41. {json2xml-5.0.5 → json2xml-5.2.0}/json2xml.egg-info/dependency_links.txt +0 -0
  42. {json2xml-5.0.5 → json2xml-5.2.0}/json2xml.egg-info/top_level.txt +0 -0
  43. {json2xml-5.0.5 → json2xml-5.2.0}/requirements.in +0 -0
  44. {json2xml-5.0.5 → json2xml-5.2.0}/setup.cfg +0 -0
  45. {json2xml-5.0.5 → json2xml-5.2.0}/tests/__init__.py +0 -0
json2xml-5.2.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2025] [Vinit Kumar]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: json2xml
3
+ Version: 5.2.0
4
+ Summary: Simple Python Library to convert JSON to XML
5
+ Author-email: Vinit Kumar <mail@vinitkumar.me>
6
+ License: Apache Software License 2.0
7
+ Project-URL: Homepage, https://github.com/vinitkumar/json2xml
8
+ Keywords: json2xml
9
+ Classifier: Development Status :: 6 - Mature
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Natural Language :: English
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: Implementation :: CPython
19
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/x-rst
23
+ License-File: LICENSE
24
+ License-File: AUTHORS.rst
25
+ Requires-Dist: defusedxml
26
+ Requires-Dist: urllib3
27
+ Requires-Dist: xmltodict>=0.12.0
28
+ Requires-Dist: pytest
29
+ Requires-Dist: pytest-cov
30
+ Requires-Dist: coverage
31
+ Requires-Dist: py
32
+ Requires-Dist: setuptools
33
+ Provides-Extra: test
34
+ Requires-Dist: pytest==7.0.1; extra == "test"
35
+ Requires-Dist: py==1.11.0; extra == "test"
36
+ Dynamic: license-file
37
+
38
+ ========
39
+ json2xml
40
+ ========
41
+
42
+ .. image:: https://badge.fury.io/py/json2xml.svg
43
+ .. image:: https://static.pepy.tech/personalized-badge/json2xml?period=total&units=international_system&left_color=blue&right_color=orange&left_text=Downloads
44
+ :target: https://pepy.tech/project/json2xml
45
+
46
+ .. image:: https://github.com/vinitkumar/json2xml/actions/workflows/pythonpackage.yml/badge.svg
47
+ .. image:: https://img.shields.io/pypi/pyversions/json2xml.svg
48
+ .. image:: https://readthedocs.org/projects/json2xml/badge/?version=latest
49
+ :target: https://json2xml.readthedocs.io/en/latest/?badge=latest
50
+ :alt: Documentation Status
51
+ .. image:: https://codecov.io/gh/vinitkumar/json2xml/branch/master/graph/badge.svg?token=Yt2h55eTL2
52
+ :target: https://codecov.io/gh/vinitkumar/json2xml
53
+
54
+ json2xml is a Python library that allows you to convert JSON data into XML format. It's simple, efficient, and easy to use.
55
+
56
+ Documentation: https://json2xml.readthedocs.io.
57
+
58
+ The library was initially dependent on the `dict2xml` project, but it has now been integrated into json2xml itself. This has led to cleaner code, the addition of types and tests, and overall improved performance.
59
+
60
+
61
+
62
+ Architecture Diagram
63
+ ^^^^^^^^^^^^^^^^^^^^
64
+
65
+ .. image:: ./diagram.png
66
+
67
+
68
+ Features
69
+ ^^^^^^^^
70
+
71
+ json2xml supports the following features:
72
+
73
+ * Conversion from a `json` string to XML
74
+ * Conversion from a `json` file to XML
75
+ * Conversion from an API that emits `json` data to XML
76
+
77
+ Usage
78
+ ^^^^^
79
+
80
+ You can use the json2xml library in the following ways:
81
+
82
+
83
+ .. code-block:: python
84
+
85
+ from json2xml import json2xml
86
+ from json2xml.utils import readfromurl, readfromstring, readfromjson
87
+
88
+ # Convert JSON data from a URL to XML
89
+ data = readfromurl("https://api.publicapis.org/entries")
90
+ print(json2xml.Json2xml(data).to_xml())
91
+
92
+ # Convert a JSON string to XML
93
+ data = readfromstring(
94
+ '{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}'
95
+ )
96
+ print(json2xml.Json2xml(data).to_xml())
97
+
98
+ # Convert a JSON file to XML
99
+ data = readfromjson("examples/licht.json")
100
+ print(json2xml.Json2xml(data).to_xml())
101
+
102
+
103
+ Custom Wrappers and Indentation
104
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105
+
106
+ By default, a wrapper `all` and pretty `True` is set. However, you can easily change this in your code like this:
107
+
108
+ .. code-block:: python
109
+
110
+ from json2xml import json2xml
111
+ from json2xml.utils import readfromurl, readfromstring, readfromjson
112
+
113
+ data = readfromstring(
114
+ '{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}'
115
+ )
116
+ print(json2xml.Json2xml(data, wrapper="all", pretty=True).to_xml())
117
+
118
+
119
+ Outputs this:
120
+
121
+ .. code-block:: xml
122
+
123
+ <?xml version="1.0" encoding="UTF-8"?>
124
+ <all>
125
+ <login type="str">mojombo</login>
126
+ <id type="int">1</id>
127
+ <avatar_url type="str">https://avatars0.githubusercontent.com/u/1?v=4</avatar_url>
128
+ </all>
129
+
130
+ Omit List item
131
+ ^^^^^^^^^^^^^^
132
+
133
+ Assume the following json input
134
+
135
+ .. code-block:: json
136
+
137
+ {
138
+ "my_items": [
139
+ { "my_item": { "id": 1 } },
140
+ { "my_item": { "id": 2 } }
141
+ ],
142
+ "my_str_items": ["a", "b"]
143
+ }
144
+
145
+ By default, items in an array are wrapped in <item></item>.
146
+
147
+ Default output:
148
+
149
+ .. code-block:: xml
150
+
151
+ <?xml version="1.0" ?>
152
+ <all>
153
+ <my_items type="list">
154
+ <item type="dict">
155
+ <my_item type="dict">
156
+ <id type="int">1</id>
157
+ </my_item>
158
+ </item>
159
+ <item type="dict">
160
+ <my_item type="dict">
161
+ <id type="int">2</id>
162
+ </my_item>
163
+ </item>
164
+ </my_items>
165
+ <my_str_items type="list">
166
+ <item type="str">a</item>
167
+ <item type="str">b</item>
168
+ </my_str_items>
169
+ <empty type="list"/>
170
+ </all>
171
+
172
+ However, you can change this behavior using the item_wrap property like this:
173
+
174
+ .. code-block:: python
175
+
176
+ from json2xml import json2xml
177
+ from json2xml.utils import readfromurl, readfromstring, readfromjson
178
+
179
+ data = readfromstring('{"my_items":[{"my_item":{"id":1} },{"my_item":{"id":2} }],"my_str_items":["a","b"]}')
180
+ print(json2xml.Json2xml(data, item_wrap=False).to_xml())
181
+
182
+ Outputs this:
183
+
184
+ .. code-block:: xml
185
+
186
+ <?xml version="1.0" ?>
187
+ <all>
188
+ <my_items type="list">
189
+ <my_item type="dict">
190
+ <id type="int">1</id>
191
+ </my_item>
192
+ <my_item type="dict">
193
+ <id type="int">2</id>
194
+ </my_item>
195
+ </my_items>
196
+ <my_str_items type="str">a</my_str_items>
197
+ <my_str_items type="str">b</my_str_items>
198
+ </all>
199
+
200
+ Optional Attribute Type Support
201
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
202
+
203
+ You can also specify if the output XML needs to have type specified or not. Here is the usage:
204
+
205
+ .. code-block:: python
206
+
207
+ from json2xml import json2xml
208
+ from json2xml.utils import readfromurl, readfromstring, readfromjson
209
+
210
+ data = readfromstring(
211
+ '{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}'
212
+ )
213
+ print(json2xml.Json2xml(data, wrapper="all", pretty=True, attr_type=False).to_xml())
214
+
215
+
216
+ Outputs this:
217
+
218
+ .. code-block:: xml
219
+
220
+ <?xml version="1.0" ?>
221
+ <all>
222
+ <login>mojombo</login>
223
+ <id>1</id>
224
+ <avatar_url>https://avatars0.githubusercontent.com/u/1?v=4</avatar_url>
225
+ </all>
226
+
227
+
228
+ The methods are simple and easy to use and there are also checks inside of code to exit cleanly
229
+ in case any of the input(file, string or API URL) returns invalid JSON.
230
+
231
+ Development
232
+ ^^^^^^^^^^^
233
+
234
+ This project uses modern Python development practices. Here's how to set up a development environment:
235
+
236
+ .. code-block:: console
237
+
238
+ # Create and activate virtual environment (using uv - recommended)
239
+ uv venv
240
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
241
+
242
+ # Install dependencies
243
+ uv pip install -r requirements-dev.txt
244
+ uv pip install -e .
245
+
246
+ **Running Tests and Checks**
247
+
248
+ We provide several ways to run tests and quality checks:
249
+
250
+ Using Make (recommended):
251
+
252
+ .. code-block:: console
253
+
254
+ make test # Run tests with coverage
255
+ make lint # Run linting with ruff
256
+ make typecheck # Run type checking with mypy
257
+ make check-all # Run all checks (lint, typecheck, test)
258
+
259
+ Using the development script:
260
+
261
+ .. code-block:: console
262
+
263
+ python dev.py # Run all checks
264
+ python dev.py test # Run tests only
265
+ python dev.py lint # Run linting only
266
+ python dev.py typecheck # Run type checking only
267
+
268
+ Using tools directly:
269
+
270
+ .. code-block:: console
271
+
272
+ pytest --cov=json2xml --cov-report=term -xvs tests -n auto
273
+ ruff check json2xml tests
274
+ mypy json2xml tests
275
+
276
+
277
+ Help and Support to maintain this project
278
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
279
+
280
+ - You can sponsor my work for this plugin here: https://github.com/sponsors/vinitkumar/
281
+
@@ -20,6 +20,14 @@ Documentation: https://json2xml.readthedocs.io.
20
20
 
21
21
  The library was initially dependent on the `dict2xml` project, but it has now been integrated into json2xml itself. This has led to cleaner code, the addition of types and tests, and overall improved performance.
22
22
 
23
+
24
+
25
+ Architecture Diagram
26
+ ^^^^^^^^^^^^^^^^^^^^
27
+
28
+ .. image:: ./diagram.png
29
+
30
+
23
31
  Features
24
32
  ^^^^^^^^
25
33
 
@@ -75,7 +83,7 @@ Outputs this:
75
83
 
76
84
  .. code-block:: xml
77
85
 
78
- <?xml version="1.0" ?>
86
+ <?xml version="1.0" encoding="UTF-8"?>
79
87
  <all>
80
88
  <login type="str">mojombo</login>
81
89
  <id type="int">1</id>
@@ -183,17 +191,50 @@ Outputs this:
183
191
  The methods are simple and easy to use and there are also checks inside of code to exit cleanly
184
192
  in case any of the input(file, string or API URL) returns invalid JSON.
185
193
 
186
- How to run tests
187
- ^^^^^^^^^^^^^^^^
194
+ Development
195
+ ^^^^^^^^^^^
196
+
197
+ This project uses modern Python development practices. Here's how to set up a development environment:
198
+
199
+ .. code-block:: console
200
+
201
+ # Create and activate virtual environment (using uv - recommended)
202
+ uv venv
203
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
204
+
205
+ # Install dependencies
206
+ uv pip install -r requirements-dev.txt
207
+ uv pip install -e .
208
+
209
+ **Running Tests and Checks**
210
+
211
+ We provide several ways to run tests and quality checks:
212
+
213
+ Using Make (recommended):
214
+
215
+ .. code-block:: console
216
+
217
+ make test # Run tests with coverage
218
+ make lint # Run linting with ruff
219
+ make typecheck # Run type checking with mypy
220
+ make check-all # Run all checks (lint, typecheck, test)
221
+
222
+ Using the development script:
223
+
224
+ .. code-block:: console
225
+
226
+ python dev.py # Run all checks
227
+ python dev.py test # Run tests only
228
+ python dev.py lint # Run linting only
229
+ python dev.py typecheck # Run type checking only
188
230
 
189
- This is provided by pytest, which is straight forward.
231
+ Using tools directly:
190
232
 
191
233
  .. code-block:: console
192
234
 
193
- virtualenv venv -p $(which python3.9)
194
- pip install -r requirements-dev.txt
195
- python setup.py install
196
- pytest -vv
235
+ pytest --cov=json2xml --cov-report=term -xvs tests -n auto
236
+ ruff check json2xml tests
237
+ mypy json2xml tests
197
238
 
198
239
 
199
240
  Help and Support to maintain this project
@@ -2,5 +2,5 @@
2
2
 
3
3
  __author__ = """Vinit Kumar"""
4
4
  __email__ = "mail@vinitkumar.me"
5
- __version__ = "5.0.5"
5
+ __version__ = "5.2.0"
6
6