Skip to content

Commit

Permalink
Releasing v20.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed May 14, 2020
1 parent 267148a commit 99fc56d
Show file tree
Hide file tree
Showing 12 changed files with 540 additions and 593 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ repos:
rev: v1.9.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/PyCQA/doc8
rev: 0.8.1rc3
hooks:
- id: doc8
12 changes: 11 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
20.5 (2020-05-02)
20.5.1 (2020-05-14)
-------------------
- Added support to fetch remote schemas.
- Updated duplicate attribute names handling.
- Updated code generation for enum type fields and default values.
- Fixed issue not generating classes derived from simple types.
- Fixed analyzer reaching the maximum recursion depth.
- Fixed analyzer to flatten properly inner self referencing classes.
- Moved dataclasses python conventions to jinja filters.

20.5 (2020-05-02)
-----------------
- Updated codegen cli to accept multiple definitions or directories as argument.
- Update ClassBuilder to recursively search for anonymous types.
- Updated XmlParser to be thread-safe.
Expand Down
61 changes: 36 additions & 25 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,49 @@ Naive XML Bindings for python

--------

xsData is a complete XML data binding library for python allowing developers to access
and use XML documents as simple objects rather than using DOM.

xsData comes with a code generator that can convert XML Schema 1.0 and 1.1 definitions
to simple dataclasses with type hints and as minimum footprint as possible. The
generated packages have no dependency on the library itself. So simple that you can
write the models on your own if you happen to use an XML document with no schema
available.

The XML Parser is highly optimized and uses lxml iterparse to bind the document data to
the target models. The parser accepts a configuration instance with various options
like `fail on unknown properties` and is also thread safe which means you can take
advantage of the internal model inspection caching context for even faster parsing.

The parser and serializer are constantly tested against the
`W3C XML Schema 1.1 test suite <https://github.com/tefra/xsdata-w3c-tests>`_ and
passes more than 99% of the valid instance cases.

.. image:: https://github.com/tefra/xsdata/raw/master/docs/_static/demo.svg

Check the documentation `demos <https://xsdata.readthedocs.io/demos.html>`_ or
our `W3C XML Schema 1.1 <https://github.com/tefra/xsdata-w3c-tests>`_ test runner and
the `samples repo <https://github.com/tefra/xsdata-samples>`_ for more ✨✨✨


Features
--------

- Generate data models from XML Schema 1.0 and 1.1 definitions.
- Supports qualified/unqualified elements and attributes
- Supports enumerations and inner classes
- Supports qualified elements/attributes.
- Supports enumerations and inner classes.
- Flattening strategies to keep the code as simple as possible.
- Preserve embedded documentation and references
- Pluggable code writer that supports different formats
- Output: Python Data Classes

- PEP8 naming conventions and code output
- Full support for type hints even with forward references
- XML Parser & Serializer based on lxml
- JSON Parser & Serializer

- Output: PlantUML class diagram

-------

.. image:: https://github.com/tefra/xsdata/raw/master/docs/_static/demo.svg

Check the documentation `test suites <https://xsdata.readthedocs.io/>`_ or our `W3C XML Schema 1.1 <https://github.com/tefra/xsdata-w3c-tests>`_ test runner and the `samples repo <https://github.com/tefra/xsdata-samples>`_ for more ✨✨✨


Changelog: 20.5 (2020-05-02)
----------------------------
- Updated codegen cli to accept multiple definitions or directories as argument.
- Update ClassBuilder to recursively search for anonymous types.
- Updated XmlParser to be thread-safe.
- Added performance tweaks on XmlParser.
- Added parser config to fail or not on unknown properties.
- Fixed primitive types being marked as forward references.
- Fixed nested restrictions on xs:simpleType.
- Fixed ClassAnalyzer to recover/ignore missing types.
Changelog: 20.5.1 (2020-05-14)
------------------------------
- Added support to fetch remote schemas.
- Updated duplicate attribute names handling.
- Updated code generation for enum type fields and default values.
- Fixed issue not generating classes derived from simple types.
- Fixed analyzer reaching the maximum recursion depth.
- Fixed analyzer to flatten properly inner self referencing classes.
- Moved dataclasses python conventions to jinja filters.
233 changes: 116 additions & 117 deletions docs/_static/demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ About
Why
---

Python soap clients are either dead or all of them follow the all-in-one pattern that hides all the complexity of the api from the end-user.
Python soap clients are either dead or all of them follow the all-in-one pattern that
hides all the complexity of the api from the end-user.

Python XML Binding libraries exist but either they never worked for the schemas I was working with or generated code that was very hard to read and understand.
Python XML Binding libraries exist but either they never worked for the schemas I was
working with or generated code that was very hard to read and understand.

xsData is inspired by the Java XML Binding JaxB and with the rise of python model classes like attrs, dataclasses or pydantic and the native python type hints, I felt it was time to create something similar for python.
xsData is inspired by the Java XML Binding JaxB and with the rise of python model
classes like attrs, dataclasses or pydantic and the native python type hints, I felt it
was time to create something similar for python.


Compare
Expand Down
21 changes: 14 additions & 7 deletions docs/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Schema Parser

:class:`xsdata.parser.SchemaParser`

The schema parser objectifies the xml data to simple python dataclass instances that are easy to work and extract all the relevant information.
The schema parser objectifies the xml data to simple python dataclass instances that
are easy to work and extract all the relevant information.



Expand All @@ -28,39 +29,45 @@ Class Builder

:class:`xsdata.builder.ClassBuilder`

The builder goes through all the root elements of a schema to create a list of class candidates.
The builder goes through all the root elements of a schema to create a list of class
candidates.

* All root elements are considered class candidates
* Traverse the root elements object tree
* Detect fields and extensions
* Detect inner classes
* Assign namespaces and default ``value`` fields

**Root elements**: ``simpleType``, ``attributeGroup``, ``group``, ``attribute``, ``complexType``, ``element``
**Root elements**: ``simpleType``, ``attributeGroup``, ``group``, ``attribute``,
``complexType``, ``element``

**Field elements**: ``attribute``, ``enumeration``, ``restiction``, ``element``

**Extension elements**: ``union``, ``attributeGroup``, ``group``, ``extension``, ``restriction``
**Extension elements**: ``union``, ``attributeGroup``, ``group``, ``extension``,
``restriction``


Class Analyzer
--------------

:class:`xsdata.analyzer.ClassAnalyzer`

The analyzer goes through all class candidates and flattens attributes and extensions based on certain criteria.
The analyzer goes through all class candidates and flattens attributes and extensions
based on certain criteria.

Promote for generation:

* Classes derived from xsd ``element`` with ``abstract`` flag set to ``False``
* Classes derived from xsd ``complexType`` with ``abstract`` flag set to ``False``
* Classes derived from xsd ``restiction`` with ``enumeration`` fields

The rest of the classes are marked as common and are used to flatten attributes and extensions of the promoted classes in the current schema and any upcoming sub-schemas.
The rest of the classes are marked as common and are used to flatten attributes and
extensions of the promoted classes in the current schema and any upcoming sub-schemas.

Code Writer
------------

:class:`xsdata.writer.CodeWriter`

Code writer is a factory that delegates the code generation with any language and library conventions to the given format.
Code writer is a factory that delegates the code generation with any language and
library conventions to the given format.
6 changes: 4 additions & 2 deletions docs/codegen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ want to process.
Package
-------

The package option defines where the target module(s) will be created inside the current working directory.
The package option defines where the target module(s) will be created inside the
current working directory.

If the main xsd has any parent include or import you should adjust the target package.

Expand Down Expand Up @@ -55,7 +56,8 @@ Available options: ``CRITICAL``, ``ERROR``, ``WARNING``, ``INFO`` or ``DEBUG``
Print
-----

The print flag overwrites the verbosity level to `Error` and print to stdOut the output result without writing to the target file.
The print flag overwrites the verbosity level to `Error` and print to stdOut the output
result without writing to the target file.


.. admonition:: Examples
Expand Down
45 changes: 2 additions & 43 deletions docs/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ Class Meta
Field Typing
============

Simply follow the Python lib `dataclasses <https://docs.python.org/3/library/dataclasses.html>`_ documentation.
Simply follow the Python lib
`dataclasses <https://docs.python.org/3/library/dataclasses.html>`_ documentation.

.. admonition:: Notes
:class: warning
Expand Down Expand Up @@ -319,45 +320,3 @@ but it lacks maturity and test coverage.
from xsdata.formats.dataclass.parsers import JsonParser
obj = parser.from_path("/some.json, PurchaseOrder)
Data Types
==========
In table below you case find all the xml schema data types and their mapping to
primitive python types.
+---------+------------------------------------------------------------------------------------+
| Python | XML Schema Types |
+---------+----------------------+-----------------+----------------------+--------------------+
| str | anyURI | anySimpleType | base | base64Binary |
+---------+----------------------+-----------------+----------------------+--------------------+
| | date | dateTime | derivationControl | duration |
+---------+----------------------+-----------------+----------------------+--------------------+
| | gDay | gMonth | gMonthDay | gYear |
+---------+----------------------+-----------------+----------------------+--------------------+
| | gYearMonth | ID | IDREF | hexBinary |
+---------+----------------------+-----------------+----------------------+--------------------+
| | IDREFS | lang | language | Name |
+---------+----------------------+-----------------+----------------------+--------------------+
| | NCName | NMTOKEN | NMTOKENS | normalizedString |
+---------+----------------------+-----------------+----------------------+--------------------+
| | NOTATION | QName | simpleDerivationSet | string |
+---------+----------------------+-----------------+----------------------+--------------------+
| | time | token | | |
+---------+----------------------+-----------------+----------------------+--------------------+
| bool | boolean | | | |
+---------+----------------------+-----------------+----------------------+--------------------+
| int | byte | ENTITIES | ENTITY | int |
+---------+----------------------+-----------------+----------------------+--------------------+
| | integer | long | negativeInteger | nonNegativeInteger |
+---------+----------------------+-----------------+----------------------+--------------------+
| | nonPositiveInteger | positiveInteger | short | unsignedByte |
+---------+----------------------+-----------------+----------------------+--------------------+
| float | double | float | | |
+---------+----------------------+-----------------+----------------------+--------------------+
| Decimal | decimal | | | |
+---------+----------------------+-----------------+----------------------+--------------------+
| | | | | |
+---------+----------------------+-----------------+----------------------+--------------------+
4 changes: 3 additions & 1 deletion docs/demo/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

echo -e "\e[35m# Hi, welcome to xsdata demo!"
pe "xsdata --help"
pe "clear"

sleep 1
clear

cd ../xsdata-samples

Expand Down
21 changes: 14 additions & 7 deletions docs/demos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ then converting them back to JSON and XML documents.
.. admonition:: Samples Source
:class: hint

`Definitive XML Schema <http://www.datypic.com/books/defxmlschema/>`_ by Priscilla Walmsley (c) 2012 Prentice Hall PTR
`Definitive XML Schema <http://www.datypic.com/books/defxmlschema/>`_ by Priscilla
Walmsley (c) 2012 Prentice Hall PTR

.. toctree::
:maxdepth: 1
Expand All @@ -34,21 +35,26 @@ then converting them back to JSON and XML documents.
W3C XML Schema Suite
====================

xsdata is constantly tested and measured against the `W3C XML Schema 1.1 test suite <https://github.com/w3c/xsdtests>`_.
xsdata is constantly tested and measured against the
`W3C XML Schema 1.1 test suite <https://github.com/w3c/xsdtests>`_.

The suite is quite extensible and consist of more than 26k tests cases for both XML Schema 1.0 and 1.1.
The suite is quite extensible and consist of more than 26k tests cases for both XML
Schema 1.0 and 1.1.

.. hint::

Because of the size and time it takes to run the test runner is on it's own `repo <https://github.com/tefra/xsdata-w3c-tests>`_.
Because of the size and time it takes to run the test runner is on it's own
`repo <https://github.com/tefra/xsdata-w3c-tests>`_.

At least until I can manage to reduce the total run time which is about 8 minutes without coverage.
At least until I can manage to reduce the total run time which is about 8 minutes
without coverage.


Report
------

**46** failed, **14520** passed, **110** skipped @ `travis-ci <https://travis-ci.com/tefra/xsdata-w3c-tests>`_
**45** failed, **14521** passed, **110** skipped @
`travis-ci <https://travis-ci.com/tefra/xsdata-w3c-tests>`_

✨✨✨✨

Expand All @@ -65,7 +71,8 @@ Methodology
- **Skip** if original instance or schema also fail validation.


For all XML Schema definitions we use the `xmlschema <https://pypi.org/project/xmlschema/>`_ to validate results.
For all XML Schema definitions we use the
`xmlschema <https://pypi.org/project/xmlschema/>`_ to validate results.


.. hint::
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = xsdata
version = 20.5
version = 20.5.1
description = Python XML Binding
long_description = file: README.rst
long_description_content_type = text/x-rst
Expand Down Expand Up @@ -62,3 +62,6 @@ exclude = tests/*
max-line-length = 88
ignore =
W503,ANN101,ANN102

[doc8]
max-line-length = 88
Loading

0 comments on commit 99fc56d

Please sign in to comment.