liquid-xml-objects-runtime 21.6.2__py3-none-any.whl
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.
Potentially problematic release.
This version of liquid-xml-objects-runtime might be problematic. Click here for more details.
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: liquid-xml-objects-runtime
|
|
3
|
+
Version: 21.6.2
|
|
4
|
+
Summary: Liquid XML Objects runtime for Python: read and write XML as typed Python objects generated from an XSD.
|
|
5
|
+
Author: Liquid Technologies Ltd
|
|
6
|
+
License: LIQUID TECHNOLOGIES LIMITED END-USER LICENSE AGREEMENT FOR LIQUID STUDIO AND LIQUID XML DATA BINDER
|
|
7
|
+
|
|
8
|
+
IMPORTANT: This Liquid Technologies Limited End User License Agreement ("EULA") is a legal agreement between you and Liquid Technologies Limited for the software product identified above, which includes computer software and may include associated media, printed materials, and "online" or electronic documentation (collectively, the "SOFTWARE"). PLEASE READ THIS EULA CAREFULLY BEFORE COMPLETING THE INSTALLATION PROCESS AND USING THE SOFTWARE. By installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, then do not install or use the SOFTWARE.
|
|
9
|
+
|
|
10
|
+
SOFTWARE LICENSE
|
|
11
|
+
|
|
12
|
+
1. DEFINITIONS
|
|
13
|
+
(a) "LIQUID TECHNOLOGIES" means Liquid Technologies Limited.
|
|
14
|
+
(b) "REDISTRIBUTABLE FILES" means the generated source code files compiled into a binary form and the associate LIQUID TECHNOLOGIES Run-Time files.
|
|
15
|
+
(c) "END USER PRODUCT" means data created by the SOFTWARE and distributed to any third party.
|
|
16
|
+
(d) "END USER" means a person who uses the END USER PRODUCT.
|
|
17
|
+
(e) "DEVELOPER" means a person who uses the REDISTRIBUTABLE FILES to produce an END USER PRODUCT.
|
|
18
|
+
(f) "TRIAL EDITION" means a version of the SOFTWARE, so identified, for use under a limited Trial License only to review, demonstrate and evaluate the SOFTWARE for a limited time period of 15 days.
|
|
19
|
+
(g) "EDUCATION EDITION" means a version of the SOFTWARE, so identified, for use by students and faculty of educational institutions only and not for any commercial application.
|
|
20
|
+
|
|
21
|
+
2. LICENSE GRANTS
|
|
22
|
+
This EULA grants you the following limited, non-exclusive rights subject to the terms and conditions set forth in this EULA:
|
|
23
|
+
(a) Your license rights under this EULA are NON-EXCLUSIVE and NON-TRANSFERABLE.
|
|
24
|
+
(b) You may install and use the SOFTWARE on a single computer; OR install and store the SOFTWARE on a storage device, such as a network server, used only to install the SOFTWARE on your other computers over an internal network, provided you have a license for each separate computer on which the SOFTWARE is installed and run.
|
|
25
|
+
(i) An Installed User license for the SOFTWARE may not be shared, installed or used concurrently on different computers.
|
|
26
|
+
(ii) A Concurrent User license for the SOFTWARE may be shared and installed on up to 10 computers, provided that no more than the maximum number of Concurrent User licenses purchased is in use at any one time.
|
|
27
|
+
(c) You are granted a non-exclusive, royalty-free right to make copies of the REDISTRIBUTABLE FILES, and distribute those copies to your END USERS; provided that (i) you only distribute the REDISTRIBUTABLE FILES in conjunction with, and as part of your END USER PRODUCT which adds significant and primary functionality to the REDISTRIBUTABLE FILES; (ii) you ensure all copyright notices are retained; (iii) you include a valid copyright notice on your END USER PRODUCT or include recognition that portions are the copyright of LIQUID TECHNOLOGIES; (iv) you include a license agreement with your END USER PRODUCT that does not permit further distribution of the REDISTRIBUTABLE FILES by your END USER; (v) you indemnify, hold harmless, and defend LIQUID TECHNOLOGIES from and against any claims or lawsuits, including attorney's fees, that arise as a result from the use or distribution of your END USER PRODUCT.
|
|
28
|
+
|
|
29
|
+
3. LICENSE RESTRICTIONS
|
|
30
|
+
(a) Other than as set forth in Section 2, you may not make or distribute copies of the SOFTWARE, or electronically transfer the SOFTWARE from one computer to another or over a network.
|
|
31
|
+
(b) You shall not allow any REDISTRIBUTABLE FILES to be used in any way by a DEVELOPER who does not have a licensed version of the REDISTRIBUTABLE FILES.
|
|
32
|
+
(c) You shall not use the SOFTWARE to develop any END USER PRODUCT having the same primary function as the SOFTWARE.
|
|
33
|
+
(d) You may not alter, merge, modify, adapt or translate the SOFTWARE, or decompile, reverse engineer, disassemble, or otherwise reduce the SOFTWARE to a human-perceivable form.
|
|
34
|
+
(e You may not rent, lease, lend, sell, resell, or otherwise transfer whether for value or otherwise, the SOFTWARE to third parties without LIQUID TECHNOLOGIES'S written approval and subject to written agreement by the recipient of the terms of this EULA.
|
|
35
|
+
(f) You shall not (i) install or use more than one copy of the TRIAL EDITION, (ii) download the TRIAL EDITION under more than one username, (iii) alter the computer system to enable the use of the TRIAL EDITION for a period in excess of 15 days, (iv) use or distribute any END USER PRODUCT of the TRIAL EDITION for any commercial purpose, and (v) use the TRIAL EDITION for a purpose other than the sole purpose of determining whether to purchase a license to a commercial or education version of the software; provided, however, notwithstanding the foregoing, you are strictly prohibited from installing or using the TRIAL EDITION for any commercial training purpose.
|
|
36
|
+
(g) An EDUCATION EDITION may not be used for, or distributed to any party for, any commercial purpose.
|
|
37
|
+
(h) END USER PRODUCT of the EDUCATION VERSION may not be distributed or used for any commercial purpose.
|
|
38
|
+
(i) LIQUID TECHNOLOGIES may terminate this EULA if you fail to comply with any term or condition of this EULA. In such event, you must destroy all copies of the SOFTWARE.
|
|
39
|
+
|
|
40
|
+
4. COPYRIGHT AND INTELLECTUAL PROPERTY RIGHTS
|
|
41
|
+
The SOFTWARE is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE is licensed, not sold. Furthermore, this EULA does not grant you any rights in connection with any trademarks or service marks of LIQUID TECHNOLOGIES. LIQUID TECHNOLOGIES reserves all intellectual property rights, including copyrights, and trademark rights.
|
|
42
|
+
|
|
43
|
+
5. NO WARRANTIES
|
|
44
|
+
YOU ACCEPT THE SOFTWARE "AS IS," AND LIQUID TECHNOLOGIES LIMITED (AND ITS THIRD PARTY SUPPLIERS AND LICENSORS) MAKE NO WARRANTY AS TO ITS USE, PERFORMANCE, OR OTHERWISE. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, LIQUID TECHNOLOGIES LIMITED (AND ITS THIRD PARTY SUPPLIERS AND LICENSORS) DISCLAIM ALL OTHER REPRESENTATIONS, WARRANTIES, AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE PRODUCT REMAINS WITH YOU.
|
|
45
|
+
|
|
46
|
+
6. LIMITATION OF LIABILITY
|
|
47
|
+
THIS LIMITATION OF LIABILITY IS TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW. IN NO EVENT SHALL LIQUID TECHNOLOGIES LIMITED (OR ITS THIRD PARTY SUPPLIERS AND LICENSORS) BE LIABLE FOR ANY COSTS OF SUBSTITUTE PRODUCTS OR SERVICES, OR FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION) ARISING OUT OF THIS EULA OR THE USE OF OR INABILITY TO USE THE SOFTWARE PRODUCT OR THE FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF LIQUID TECHNOLOGIES LIMITED HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, LIQUID TECHNOLOGIES LIMITED'S (AND ITS THIRD PARTY SUPPLIERS' AND LICENSORS') ENTIRE LIABILITY ARISING OUT OF THIS EULA SHALL BE LIMITED TO THE AMOUNT PAID BY YOU FOR THE SOFTWARE THAT CAUSED SUCH DAMAGE.
|
|
48
|
+
|
|
49
|
+
7. DOCUMENTATION AND EXAMPLES
|
|
50
|
+
LIQUID TECHNOLOGIES LIMITED BEARS NO LIABILITY FOR ANY TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS, OR FOR DAMAGES RESULTING FROM USE OF THE INFORMATION IN ANY PROVIDED DOCUMENTATION AND/OR EXAMPLES.
|
|
51
|
+
|
|
52
|
+
8. REFUND POLICY
|
|
53
|
+
A free limited TRIAL EDITION is granted when you download this SOFTWARE. We recommend that you use this to evaluate the product before making a purchase.
|
|
54
|
+
Refunds will be given at the discretion of the Company Management.
|
|
55
|
+
|
|
56
|
+
9. SOFTWARE UPDATES
|
|
57
|
+
This license does not grant you any right to any updates to the SOFTWARE, or any support services. The SOFTWARE has built in functionality to automatically check for updates by transmitting data to the LIQUID TECHNOLOGIES servers. You agree that LIQUID TECHNOLOGIES may transfer such data over your network and the internet to LIQUID TECHNOLOGIES servers, download updates and install them as part of the SOFTWARE.
|
|
58
|
+
|
|
59
|
+
10. TERMINATION OR EXPIRY
|
|
60
|
+
(a) The Licensor may by notice in writing to the Licensee terminate this License if any of the following events shall occur, viz.:
|
|
61
|
+
(i) if the Licensee is in breach of any term, condition or provision of this License or required by the applicable law and fails to remedy such breach (if capable of remedy) within 30 days of having received written notice of such breach from the Licensor;
|
|
62
|
+
(ii) if the Licensee, being a body corporate, shall present a petition or have a petition presented by a creditor for its winding up, or shall convene a meeting to pass a resolution for voluntary winding up, or shall enter into any liquidation (other than for the purposes of a bona fide reconstruction or amalgamation); shall call a meeting of its creditors, or shall have a receiver of all or any of its undertakings or assets appointed, or shall be deemed by the relevant statutory provisions under the applicable law to be unable to pay its debts.
|
|
63
|
+
(b) Upon termination or expiry, the Licensee shall immediately cease to use the Software, delete all copies of it and shall pay to the Licensor all costs and expenses, including legal and other fees incurred and all arrears of fees, charges or other payments arising in respect of the Software, this License or otherwise.
|
|
64
|
+
(c) Termination or expiry, howsoever or whenever occasioned shall be subject to any rights and remedies the Licensor may have under this License or in law.
|
|
65
|
+
|
|
66
|
+
11. ASSIGNMENT
|
|
67
|
+
The Licensee shall not assign or otherwise transfer all or part of the Software or this License without the prior written consent of the Licensor.
|
|
68
|
+
|
|
69
|
+
12. WAIVER
|
|
70
|
+
Failure or neglect by the Licensor to enforce at any time any of the provisions hereof shall not be construed nor shall be deemed to be a waiver of the Licensor's rights hereunder nor in any way affect the validity of the whole or any part of this License nor prejudice the Licensor's rights to take subsequent action.
|
|
71
|
+
|
|
72
|
+
13. SEVERABILITY
|
|
73
|
+
In the event that any of these terms, conditions or provisions shall be determined by any competent authority to be invalid, unlawful or unenforceable to any extent, such term, condition or provision shall to that extent be severed from the remaining terms, conditions and provisions which shall continue to be valid to the fullest extent permitted by law.
|
|
74
|
+
|
|
75
|
+
14. NOTICES
|
|
76
|
+
Any notice to be given by either party to the other may be sent by recorded delivery to the address of the other party as appearing herein or such other address as such party may from time to time have communicated to the other in writing and if so sent shall be deemed to be served 3 days following the date of posting.
|
|
77
|
+
|
|
78
|
+
15. LAW
|
|
79
|
+
The parties hereby agree that the License concluded between them and constituted on these terms and conditions shall be construed in accordance with English Law.
|
|
80
|
+
|
|
81
|
+
Copyright (c) 2001-2026 Liquid Technologies Limited. All rights reserved.
|
|
82
|
+
License-File: LICENSE.txt
|
|
83
|
+
Classifier: Programming Language :: Python :: 3
|
|
84
|
+
Classifier: Topic :: Text Processing :: Markup :: XML
|
|
85
|
+
Classifier: Typing :: Typed
|
|
86
|
+
Requires-Python: >=3.10
|
|
87
|
+
Description-Content-Type: text/markdown
|
|
88
|
+
|
|
89
|
+
# Liquid XML Objects for Python
|
|
90
|
+
|
|
91
|
+
Read and write XML as typed Python objects. The classes are generated from an XSD, and the runtime (`liquid_xml_objects`) turns them into
|
|
92
|
+
XML and back again, validating the data against the schema (facets, cardinality, `xs:choice`, `xs:alternative`, `xsi:nil`, `xsi:type` ...).
|
|
93
|
+
|
|
94
|
+
This is a port of the C# `LiquidTechnologies.XmlObjects.Runtime`, the classes have the same names (in Python style) wherever that makes sense.
|
|
95
|
+
|
|
96
|
+
* Python 3.10+, no dependencies (it uses `xml.parsers.expat` from the standard library).
|
|
97
|
+
* Fully typed (`py.typed`), the runtime passes `mypy --strict`, and so does the generated code.
|
|
98
|
+
|
|
99
|
+
## Generating the classes
|
|
100
|
+
|
|
101
|
+
Use the Liquid XML Objects generator (`LxGen`) with `-L:Python`:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
LxGen /Language:Python /OutputFolder:out /OutputNamespace:my_company.bookstore bookstore.xsd
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
| Argument | Meaning |
|
|
108
|
+
| ----------------------- | -------------------------------------------------------------------------------------------------- |
|
|
109
|
+
| `/OutputNamespace` | The package the classes are generated into (`my_company.bookstore` creates `my_company/bookstore`) |
|
|
110
|
+
| `/PythonOutput` | `Project` (default) : a Python project built with setuptools, `HatchProject` : the same built with hatchling and hatch (see below), `Files` : just the package |
|
|
111
|
+
| `/PythonModuleName` | The module inside the package that holds the classes (default `models`) |
|
|
112
|
+
| `/PythonProjectName` | The name of the distribution in the `pyproject.toml` |
|
|
113
|
+
| `/PythonProjectVersion` | The version of the distribution |
|
|
114
|
+
| `/PythonProjectDescription` | A one line description of the project |
|
|
115
|
+
| `/PythonProjectAuthor` | The author of the project |
|
|
116
|
+
| `/GenerationModel` | `Simple` (default) or `Conformant`. `ConformantWithAccessors` is not supported for Python |
|
|
117
|
+
|
|
118
|
+
### The Python project
|
|
119
|
+
|
|
120
|
+
`/PythonOutput:Project` (setuptools) and `/PythonOutput:HatchProject` (hatchling) build the standard Python environment around the generated package, using the usual tools:
|
|
121
|
+
|
|
122
|
+
| File | What it is for |
|
|
123
|
+
| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
124
|
+
| `src/<package>/` | The generated package (`src` layout), with `py.typed` |
|
|
125
|
+
| `pyproject.toml` | Build configuration (setuptools), metadata, the dependency on the runtime, the `test`, `lint` and `dev` extras, and the configuration of pytest, ruff, mypy and coverage |
|
|
126
|
+
| `requirements.txt`, `requirements-dev.txt` | `pip install -r ...` for running the project, and for working on it |
|
|
127
|
+
| `tox.ini` (`Project` only) | Tests on every supported Python, `lint` (ruff), `type` (mypy), `build` (`python -m build` and `twine check`). `HatchProject` has the same environments in the `pyproject.toml` instead (`hatch test`, `hatch run lint:check`, `hatch run types:check`, `hatch build`) |
|
|
128
|
+
| `tests/` | pytest tests: checks on the package, and a round trip of every `.xml` file in `tests/data` |
|
|
129
|
+
| `README.md`, `.gitignore` | How to set the project up, test, check and build it |
|
|
130
|
+
|
|
131
|
+
The two differ in the `pyproject.toml` (`setuptools.build_meta` or `hatchling.build` as the build backend, with the configuration of that tool) and in how the environments are managed (tox, or hatch).
|
|
132
|
+
The runtime is installed with `pip install -i https://test.pypi.org/simple/ liquid-xml-objects`, then `pip install -e ".[dev]"` installs the project and the development tools.
|
|
133
|
+
The project depends on `liquid-xml-objects~=X.Y.Z`, the version of the generator, because the runtime only works with code generated by the same major and minor version.
|
|
134
|
+
The tests that read and write XML need the license to be chosen with `LIQUID_XML_OBJECTS_LICENSE=agpl` (or `commercial`), otherwise they are skipped.
|
|
135
|
+
|
|
136
|
+
All the schemas are generated into a single module (a base class has to be declared before the classes derived from it, and schemas often refer
|
|
137
|
+
to each other). The package exports every class (`__all__`).
|
|
138
|
+
|
|
139
|
+
## Registering the license
|
|
140
|
+
|
|
141
|
+
The library can not be used until you have registered the license it is used under. Call one of these once, when your program starts (before
|
|
142
|
+
the first `serialize` / `deserialize`), otherwise a `LxLicenseException` is raised that explains what to do and summarizes the AGPL terms:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
import liquid_xml_objects
|
|
146
|
+
|
|
147
|
+
# Open source use, under the terms of the GNU Affero General Public License v3 (AGPL-3.0)
|
|
148
|
+
liquid_xml_objects.register_liquid_xml_object_license_agpl()
|
|
149
|
+
|
|
150
|
+
# or, with a commercial license
|
|
151
|
+
liquid_xml_objects.register_liquid_xml_object_license_commercial("My Company Ltd", "<license key>")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Using the classes
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from liquid_xml_objects import LxSerializer
|
|
158
|
+
import my_company.bookstore as bookstore
|
|
159
|
+
|
|
160
|
+
serializer = LxSerializer(bookstore)
|
|
161
|
+
|
|
162
|
+
company = serializer.deserialize("company.xml")
|
|
163
|
+
for book in company.catalog.books:
|
|
164
|
+
print(book.title, book.isbn)
|
|
165
|
+
|
|
166
|
+
company.catalog.books.append(bookstore.BookElm(isbn="0-123", title="A new book", author="Me", sku=1))
|
|
167
|
+
serializer.serialize(company, "copy.xml")
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
* `LxSerializer(module)` registers the generated classes of a package (or the loaded generated classes if it is given nothing).
|
|
171
|
+
* `deserialize` / `deserialize_from_string` / `deserialize_with_root_name` read a file, a stream, bytes, an `XElement` or an `XmlReader`.
|
|
172
|
+
* `serialize` / `serialize_to_string` / `serialize_to_x_element` write a file, a stream or an `XmlWriter`. An object that is based on an
|
|
173
|
+
`xs:complexType` (rather than a global `xs:element`) needs `element_name=` as well.
|
|
174
|
+
* `LxTypedSerializer[T]` is the same, with the type of the root object.
|
|
175
|
+
|
|
176
|
+
### Errors
|
|
177
|
+
|
|
178
|
+
By default a problem in the XML (or in the object being written) raises `LxSerializationException`. Give the settings an error handler to
|
|
179
|
+
collect the errors and carry on, the handler is called with `(message, severity, error_code, location, target_object)` when reading and
|
|
180
|
+
`(message, severity, error_code, target_object)` when writing:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
from liquid_xml_objects import LxReaderSettings
|
|
184
|
+
|
|
185
|
+
errors = []
|
|
186
|
+
settings = LxReaderSettings()
|
|
187
|
+
settings.error_handler = lambda message, severity, code, location, target: errors.append((code, message))
|
|
188
|
+
obj = serializer.deserialize("damaged.xml", settings)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### What the generated code looks like
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
@lx.simple_element_definition("Bookstore", NS, lx.ElementScopeType.GLOBAL_ELEMENT)
|
|
195
|
+
@dataclass(kw_only=True)
|
|
196
|
+
class BookstoreElm:
|
|
197
|
+
name: str = lx.element_value(0, "Name", NS, lx.LxValueType.VALUE, lx.XsdType.STRING, initial="")
|
|
198
|
+
rating: Decimal | None = lx.element_value(4, "Rating", NS, lx.LxValueType.VALUE, lx.XsdType.DECIMAL, min_occurs=0, initial=None)
|
|
199
|
+
books: list[BookElm] = lx.element_ref(1, lambda: BookElm, min_occurs=0, max_occurs=UNBOUNDED, initial_factory=list)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
* The classes are `dataclass(kw_only=True)`, the properties are fields. The field carries what the C# attributes carry (`attribution/attributes.py`).
|
|
203
|
+
* Names are Pythonic : `snake_case` properties, `UPPER_SNAKE_CASE` enumeration members (the value is the text used in the XML), a name that is a keyword
|
|
204
|
+
or builtin gets a trailing `_` (`class_`).
|
|
205
|
+
|
|
206
|
+
| XSD | Python |
|
|
207
|
+
| ------------------------------------------ | ------------------------------------------------------------------- |
|
|
208
|
+
| `xs:string` and the like | `str` |
|
|
209
|
+
| integers | `int` |
|
|
210
|
+
| `xs:float`, `xs:double` | `float` |
|
|
211
|
+
| `xs:decimal` | `decimal.Decimal` |
|
|
212
|
+
| `xs:boolean` | `bool` |
|
|
213
|
+
| `xs:base64Binary`, `hexBinary` | `bytes` |
|
|
214
|
+
| `xs:date`, `dateTime`, `time`, `gYear` ... | `LxDateTime` (the type says which of them it holds) |
|
|
215
|
+
| `xs:duration` ... | `LxDuration` |
|
|
216
|
+
| `xs:QName` | `LxQName` |
|
|
217
|
+
| `xs:list` | `list[...]` |
|
|
218
|
+
| enumeration | an `enum.Enum` |
|
|
219
|
+
| `xs:union` | a subclass of `LxUnion`, `.value` holds the value |
|
|
220
|
+
| optional element/attribute | `T \| None` |
|
|
221
|
+
| `maxOccurs > 1` | `list[T]` |
|
|
222
|
+
| `nillable` | `LxNillable[T]` (`.value`, `.is_nil`) |
|
|
223
|
+
| `xs:any`, `xs:anyType` | `XElement` / `XAttribute` (the runtime's own light weight xml tree) |
|
|
224
|
+
|
|
225
|
+
## Differences from the C# runtime
|
|
226
|
+
|
|
227
|
+
* The values of `xs:float`/`xs:double` are Python floats. They are written as .NET Core 3.0 and later write them, and as the Java and C++ runtimes do : the shortest text that
|
|
228
|
+
reads back as exactly the same number (`1/3` is `0.3333333333333333`, a float of `1.2345612` is `1.2345612`), plain digits unless the exponent is less than -4 or more than 16
|
|
229
|
+
(`1E-05`, `1E+17`; 8 for an `xs:float`), and `-0` for negative zero. A pattern (`float_format_override`, `double_format_override`) can ask for something else (`G7`, `F2` ...).
|
|
230
|
+
* `ConformantWithAccessors` (read only properties that flatten the compositors) is not generated.
|
|
231
|
+
* The `Simple` generation model does not keep the order of elements with different names, nor enforce cardinality (as in C#). The
|
|
232
|
+
`Conformant` model does.
|
|
233
|
+
* The JSON serializer is not ported.
|
|
234
|
+
* Change notification (`RaiseChangeEvents`) is not generated, use `dataclasses` features or `__setattr__` if you need it.
|
|
235
|
+
* Some forms of recursive schema are not supported (elm A=> seq => ref to elmA)
|
|
236
|
+
|
|
237
|
+
## Development
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
python -m venv .venv
|
|
241
|
+
.venv/Scripts/pip install -e . -r requirements-dev.txt
|
|
242
|
+
.venv/Scripts/python -m pytest # the unit tests
|
|
243
|
+
.venv/Scripts/python -m mypy src # strict
|
|
244
|
+
.venv/Scripts/python -m ruff check src tests
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The generator is tested against the regression schemas : `PythonSampleGeneratorTestSet1` (Conformant) and `PythonSampleGeneratorTestSet4` (Simple) in
|
|
248
|
+
`LiquidTechnologies.XmlObjects.RegressionTests` generate a package for each schema, byte compile and import it, then read and write every sample xml
|
|
249
|
+
with `PythonSampleBuilder/python_round_trip.py` and compare the result with the xml (or its `.Expected.xml`), like the Java and C++ tests do.
|
|
250
|
+
The packages are written to `RegressionTests/Temp/Python`.
|
|
251
|
+
|
|
252
|
+
## Releasing
|
|
253
|
+
|
|
254
|
+
The version is not written in the code, it is taken from the git tag when the package is built (hatch-vcs). The tag `v21.5.8` is version `21.5.8`. A commit that is not
|
|
255
|
+
a tag has a development version (`21.5.9.dev3+gabc1234`), which can be built and tested but not published (an index does not accept a version twice either).
|
|
256
|
+
`src/liquid_xml_objects/_version.py` is written by the build and is not kept in git, in development run `uv build` (or `pip install -e .`) to re-create it.
|
|
257
|
+
|
|
258
|
+
To make a release, create a tag and push it. The workflow *Build and publish* then runs on its own, it checks the code, builds the distribution, uploads it to the package index
|
|
259
|
+
(`PYPI_REPOSITORY_URL`, see the comments in `.github/workflows/release.yml` for the secrets), and creates the GitHub release for the tag with the distribution attached.
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
git tag v21.5.8
|
|
263
|
+
git push origin v21.5.8
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
It can also be run on demand : Actions > *Build and publish* > *Run workflow*, select the tag (`v21.5.8`), tick `publish` and `github_release`, and run.
|
|
267
|
+
Run on a branch, without the ticks, it only checks and builds (the distribution is attached to the run as the artifact `dist`).
|
|
268
|
+
|
|
269
|
+
The workflow *CI* lints, type checks and tests on Python 3.10 to 3.13 (Linux and Windows), and builds the distribution. It runs on demand (Actions > *CI* > *Run workflow*),
|
|
270
|
+
and on every push to `main`.
|
|
271
|
+
`CHANGELOG.md` is no longer written for you, add to it by hand.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
src/liquid_xml_objects/_version.py,sha256=rNxlA5wYx5H7I0Wlc8A2SeBxut-0mG0gz_xPvxsBxKE,522
|
|
2
|
+
liquid_xml_objects_runtime-21.6.2.dist-info/METADATA,sha256=t186_cXr61lu2xxNtSEo7bjnJs5fNnUH5XgyugAnE7I,25685
|
|
3
|
+
liquid_xml_objects_runtime-21.6.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
liquid_xml_objects_runtime-21.6.2.dist-info/licenses/LICENSE.txt,sha256=fCMlrbbIxKF3AIXA0dhk3y14aOve-JNI_fs_2dfnQ-o,11292
|
|
5
|
+
liquid_xml_objects_runtime-21.6.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
LIQUID TECHNOLOGIES LIMITED END-USER LICENSE AGREEMENT FOR LIQUID STUDIO AND LIQUID XML DATA BINDER
|
|
2
|
+
|
|
3
|
+
IMPORTANT: This Liquid Technologies Limited End User License Agreement ("EULA") is a legal agreement between you and Liquid Technologies Limited for the software product identified above, which includes computer software and may include associated media, printed materials, and "online" or electronic documentation (collectively, the "SOFTWARE"). PLEASE READ THIS EULA CAREFULLY BEFORE COMPLETING THE INSTALLATION PROCESS AND USING THE SOFTWARE. By installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, then do not install or use the SOFTWARE.
|
|
4
|
+
|
|
5
|
+
SOFTWARE LICENSE
|
|
6
|
+
|
|
7
|
+
1. DEFINITIONS
|
|
8
|
+
(a) "LIQUID TECHNOLOGIES" means Liquid Technologies Limited.
|
|
9
|
+
(b) "REDISTRIBUTABLE FILES" means the generated source code files compiled into a binary form and the associate LIQUID TECHNOLOGIES Run-Time files.
|
|
10
|
+
(c) "END USER PRODUCT" means data created by the SOFTWARE and distributed to any third party.
|
|
11
|
+
(d) "END USER" means a person who uses the END USER PRODUCT.
|
|
12
|
+
(e) "DEVELOPER" means a person who uses the REDISTRIBUTABLE FILES to produce an END USER PRODUCT.
|
|
13
|
+
(f) "TRIAL EDITION" means a version of the SOFTWARE, so identified, for use under a limited Trial License only to review, demonstrate and evaluate the SOFTWARE for a limited time period of 15 days.
|
|
14
|
+
(g) "EDUCATION EDITION" means a version of the SOFTWARE, so identified, for use by students and faculty of educational institutions only and not for any commercial application.
|
|
15
|
+
|
|
16
|
+
2. LICENSE GRANTS
|
|
17
|
+
This EULA grants you the following limited, non-exclusive rights subject to the terms and conditions set forth in this EULA:
|
|
18
|
+
(a) Your license rights under this EULA are NON-EXCLUSIVE and NON-TRANSFERABLE.
|
|
19
|
+
(b) You may install and use the SOFTWARE on a single computer; OR install and store the SOFTWARE on a storage device, such as a network server, used only to install the SOFTWARE on your other computers over an internal network, provided you have a license for each separate computer on which the SOFTWARE is installed and run.
|
|
20
|
+
(i) An Installed User license for the SOFTWARE may not be shared, installed or used concurrently on different computers.
|
|
21
|
+
(ii) A Concurrent User license for the SOFTWARE may be shared and installed on up to 10 computers, provided that no more than the maximum number of Concurrent User licenses purchased is in use at any one time.
|
|
22
|
+
(c) You are granted a non-exclusive, royalty-free right to make copies of the REDISTRIBUTABLE FILES, and distribute those copies to your END USERS; provided that (i) you only distribute the REDISTRIBUTABLE FILES in conjunction with, and as part of your END USER PRODUCT which adds significant and primary functionality to the REDISTRIBUTABLE FILES; (ii) you ensure all copyright notices are retained; (iii) you include a valid copyright notice on your END USER PRODUCT or include recognition that portions are the copyright of LIQUID TECHNOLOGIES; (iv) you include a license agreement with your END USER PRODUCT that does not permit further distribution of the REDISTRIBUTABLE FILES by your END USER; (v) you indemnify, hold harmless, and defend LIQUID TECHNOLOGIES from and against any claims or lawsuits, including attorney's fees, that arise as a result from the use or distribution of your END USER PRODUCT.
|
|
23
|
+
|
|
24
|
+
3. LICENSE RESTRICTIONS
|
|
25
|
+
(a) Other than as set forth in Section 2, you may not make or distribute copies of the SOFTWARE, or electronically transfer the SOFTWARE from one computer to another or over a network.
|
|
26
|
+
(b) You shall not allow any REDISTRIBUTABLE FILES to be used in any way by a DEVELOPER who does not have a licensed version of the REDISTRIBUTABLE FILES.
|
|
27
|
+
(c) You shall not use the SOFTWARE to develop any END USER PRODUCT having the same primary function as the SOFTWARE.
|
|
28
|
+
(d) You may not alter, merge, modify, adapt or translate the SOFTWARE, or decompile, reverse engineer, disassemble, or otherwise reduce the SOFTWARE to a human-perceivable form.
|
|
29
|
+
(e You may not rent, lease, lend, sell, resell, or otherwise transfer whether for value or otherwise, the SOFTWARE to third parties without LIQUID TECHNOLOGIES'S written approval and subject to written agreement by the recipient of the terms of this EULA.
|
|
30
|
+
(f) You shall not (i) install or use more than one copy of the TRIAL EDITION, (ii) download the TRIAL EDITION under more than one username, (iii) alter the computer system to enable the use of the TRIAL EDITION for a period in excess of 15 days, (iv) use or distribute any END USER PRODUCT of the TRIAL EDITION for any commercial purpose, and (v) use the TRIAL EDITION for a purpose other than the sole purpose of determining whether to purchase a license to a commercial or education version of the software; provided, however, notwithstanding the foregoing, you are strictly prohibited from installing or using the TRIAL EDITION for any commercial training purpose.
|
|
31
|
+
(g) An EDUCATION EDITION may not be used for, or distributed to any party for, any commercial purpose.
|
|
32
|
+
(h) END USER PRODUCT of the EDUCATION VERSION may not be distributed or used for any commercial purpose.
|
|
33
|
+
(i) LIQUID TECHNOLOGIES may terminate this EULA if you fail to comply with any term or condition of this EULA. In such event, you must destroy all copies of the SOFTWARE.
|
|
34
|
+
|
|
35
|
+
4. COPYRIGHT AND INTELLECTUAL PROPERTY RIGHTS
|
|
36
|
+
The SOFTWARE is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE is licensed, not sold. Furthermore, this EULA does not grant you any rights in connection with any trademarks or service marks of LIQUID TECHNOLOGIES. LIQUID TECHNOLOGIES reserves all intellectual property rights, including copyrights, and trademark rights.
|
|
37
|
+
|
|
38
|
+
5. NO WARRANTIES
|
|
39
|
+
YOU ACCEPT THE SOFTWARE "AS IS," AND LIQUID TECHNOLOGIES LIMITED (AND ITS THIRD PARTY SUPPLIERS AND LICENSORS) MAKE NO WARRANTY AS TO ITS USE, PERFORMANCE, OR OTHERWISE. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, LIQUID TECHNOLOGIES LIMITED (AND ITS THIRD PARTY SUPPLIERS AND LICENSORS) DISCLAIM ALL OTHER REPRESENTATIONS, WARRANTIES, AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE PRODUCT REMAINS WITH YOU.
|
|
40
|
+
|
|
41
|
+
6. LIMITATION OF LIABILITY
|
|
42
|
+
THIS LIMITATION OF LIABILITY IS TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW. IN NO EVENT SHALL LIQUID TECHNOLOGIES LIMITED (OR ITS THIRD PARTY SUPPLIERS AND LICENSORS) BE LIABLE FOR ANY COSTS OF SUBSTITUTE PRODUCTS OR SERVICES, OR FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION) ARISING OUT OF THIS EULA OR THE USE OF OR INABILITY TO USE THE SOFTWARE PRODUCT OR THE FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF LIQUID TECHNOLOGIES LIMITED HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, LIQUID TECHNOLOGIES LIMITED'S (AND ITS THIRD PARTY SUPPLIERS' AND LICENSORS') ENTIRE LIABILITY ARISING OUT OF THIS EULA SHALL BE LIMITED TO THE AMOUNT PAID BY YOU FOR THE SOFTWARE THAT CAUSED SUCH DAMAGE.
|
|
43
|
+
|
|
44
|
+
7. DOCUMENTATION AND EXAMPLES
|
|
45
|
+
LIQUID TECHNOLOGIES LIMITED BEARS NO LIABILITY FOR ANY TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS, OR FOR DAMAGES RESULTING FROM USE OF THE INFORMATION IN ANY PROVIDED DOCUMENTATION AND/OR EXAMPLES.
|
|
46
|
+
|
|
47
|
+
8. REFUND POLICY
|
|
48
|
+
A free limited TRIAL EDITION is granted when you download this SOFTWARE. We recommend that you use this to evaluate the product before making a purchase.
|
|
49
|
+
Refunds will be given at the discretion of the Company Management.
|
|
50
|
+
|
|
51
|
+
9. SOFTWARE UPDATES
|
|
52
|
+
This license does not grant you any right to any updates to the SOFTWARE, or any support services. The SOFTWARE has built in functionality to automatically check for updates by transmitting data to the LIQUID TECHNOLOGIES servers. You agree that LIQUID TECHNOLOGIES may transfer such data over your network and the internet to LIQUID TECHNOLOGIES servers, download updates and install them as part of the SOFTWARE.
|
|
53
|
+
|
|
54
|
+
10. TERMINATION OR EXPIRY
|
|
55
|
+
(a) The Licensor may by notice in writing to the Licensee terminate this License if any of the following events shall occur, viz.:
|
|
56
|
+
(i) if the Licensee is in breach of any term, condition or provision of this License or required by the applicable law and fails to remedy such breach (if capable of remedy) within 30 days of having received written notice of such breach from the Licensor;
|
|
57
|
+
(ii) if the Licensee, being a body corporate, shall present a petition or have a petition presented by a creditor for its winding up, or shall convene a meeting to pass a resolution for voluntary winding up, or shall enter into any liquidation (other than for the purposes of a bona fide reconstruction or amalgamation); shall call a meeting of its creditors, or shall have a receiver of all or any of its undertakings or assets appointed, or shall be deemed by the relevant statutory provisions under the applicable law to be unable to pay its debts.
|
|
58
|
+
(b) Upon termination or expiry, the Licensee shall immediately cease to use the Software, delete all copies of it and shall pay to the Licensor all costs and expenses, including legal and other fees incurred and all arrears of fees, charges or other payments arising in respect of the Software, this License or otherwise.
|
|
59
|
+
(c) Termination or expiry, howsoever or whenever occasioned shall be subject to any rights and remedies the Licensor may have under this License or in law.
|
|
60
|
+
|
|
61
|
+
11. ASSIGNMENT
|
|
62
|
+
The Licensee shall not assign or otherwise transfer all or part of the Software or this License without the prior written consent of the Licensor.
|
|
63
|
+
|
|
64
|
+
12. WAIVER
|
|
65
|
+
Failure or neglect by the Licensor to enforce at any time any of the provisions hereof shall not be construed nor shall be deemed to be a waiver of the Licensor's rights hereunder nor in any way affect the validity of the whole or any part of this License nor prejudice the Licensor's rights to take subsequent action.
|
|
66
|
+
|
|
67
|
+
13. SEVERABILITY
|
|
68
|
+
In the event that any of these terms, conditions or provisions shall be determined by any competent authority to be invalid, unlawful or unenforceable to any extent, such term, condition or provision shall to that extent be severed from the remaining terms, conditions and provisions which shall continue to be valid to the fullest extent permitted by law.
|
|
69
|
+
|
|
70
|
+
14. NOTICES
|
|
71
|
+
Any notice to be given by either party to the other may be sent by recorded delivery to the address of the other party as appearing herein or such other address as such party may from time to time have communicated to the other in writing and if so sent shall be deemed to be served 3 days following the date of posting.
|
|
72
|
+
|
|
73
|
+
15. LAW
|
|
74
|
+
The parties hereby agree that the License concluded between them and constituted on these terms and conditions shall be construed in accordance with English Law.
|
|
75
|
+
|
|
76
|
+
Copyright (c) 2001-2026 Liquid Technologies Limited. All rights reserved.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '21.6.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (21, 6, 2)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|