Skip to content

Commit

Permalink
Merge pull request #6 from dapper91/dev
Browse files Browse the repository at this point in the history
setup.py fixed.
  • Loading branch information
dapper91 committed Sep 24, 2019
2 parents 443d334 + 6d96471 commit b86053d
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 42 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

0.2.2 (2019-09-24)
------------------

- setup.py fixed.
- some documentation typos fixed.


0.2.1 (2019-08-26)
------------------

Expand Down
18 changes: 9 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ paxb
Python Architecture for XML Binding
-----------------------------------

paxb is a library that provides an API for mapping between XML documents and Python objects.
``paxb`` is a library that provides an API for mapping between XML documents and Python objects.

paxb library implements the following functionality:
``paxb`` library implements the following functionality:

- Deserialize XML documents to Python objects
- Validate deserialized data
- Access and update Python object fields
- Serialize Python objects to XML documents

paxb provides an efficient way of mapping between an XML document and a Python object. Using paxb
developers can write less boilerplate code emphasizing on application business logic.
``paxb`` provides an efficient way of mapping between an XML document and a Python object. Using ``paxb``
developers can write less boilerplate code emphasizing on application domain logic.

Since paxb based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
Since ``paxb`` based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library ``paxb`` and ``attrs``
API can be mixed together.


Expand Down Expand Up @@ -96,10 +96,10 @@ Suppose you have an xml document ``user.xml``:
</doc:envelope>
To deserialize the document you could use `XML Processing Modules <https://docs.python.org/3/library/xml.html>`_
python standard libraryr api to parse the document and then set the corresponding class fields. Such an imperative
code has a lot of boilerplate manipulations. Instead you can use paxb api to write declarative style code. All you
need to describe field mappings and types, paxb will serialize and deserialize data for you:
To deserialize the document you could use `xml <https://docs.python.org/3/library/xml.html>`_ library api to parse
the document and then access and modify the parsed xml DOM manually. Such an imperative code has a lot of boilerplate
operations that takes a lot of time and can lead to bugs. Instead you can use ``paxb`` api to write a declarative
style code. All you need to describe field mappings and types, ``paxb`` will serialize and deserialize data for you:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ paxb: Python Architecture for XML Binding
- Access and update Python object fields
- :doc:`Serialize <paxb/serialization>` Python objects to XML documents

``paxb`` provides an efficient way of mapping between an XML document and a Python object. Using paxb
``paxb`` provides an efficient way of mapping between an XML document and a Python object. Using ``paxb``
developers can write less boilerplate code emphasizing on application domain logic.

Since paxb is based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library ``paxb`` and attrs
Expand Down
2 changes: 1 addition & 1 deletion docs/paxb/attrs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
attrs library integration
=========================

Since ``paxb`` is based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
Since ``paxb`` is based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library ``paxb`` and ``attrs``
APIs can be mixed together.


Expand Down
6 changes: 3 additions & 3 deletions docs/paxb/binding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ model
-----

The :py:func:`paxb.model` decorator is used to describe a mapping of a python class to an xml element.
All encountered class fields are mapped to xml subelements. In the following example ``User`` class
All encountered class fields are mapped to the xml subelements. In the following example ``User`` class
attributes ``name`` and ``surname`` are mapped to the corresponding xml elements. The model:

.. code-block:: python
Expand Down Expand Up @@ -71,7 +71,7 @@ The name of the fields is used as an xml tag name for a mapping.
<surname>Ivanov</surname>
</User>
Similarly to the :py:func:`paxb.model` decorator the default behavior can be altered using ``name`` argument.
Similarly to the :py:func:`paxb.model` decorator the default behavior can be altered using the ``name`` argument.

.. code-block:: python
Expand Down Expand Up @@ -182,7 +182,7 @@ nested class or wrapper (will be described later). Look at the example:
wrapper
-------

It is common when a mapped element is placed in a subelement but declaring a nested class is redundant.
It is common case when a mapped element is placed in a subelement but declaring a nested class is redundant.
Here the :py:func:`paxb.wrapper` function comes forward. Let's look at the example:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/paxb/deserialization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ using :py:func:`paxb.from_xml` additional arguments. Look at the example:
User(name='Alex', surname='Ivanov', email='alex@gmail.com', phone='+79123457323')


The ``required`` argument tells the deserializer to raise an exception if the element not found in the xml tree,
The ``required`` argument tells the deserializer to raise an exception if the element is not found in the xml tree,
otherwise ``None`` will be returned (see :ref:`Errors <errors>`).

By default all fields deserialized as :py:class:`str` types. The default behaviour can be altered using a
Expand Down
8 changes: 4 additions & 4 deletions docs/paxb/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Errors
======

The package has two main exceptions: :py:exc:`paxb.exceptexcions.SerializationError` and
:py:class:`paxb.exceptexcions.DeserializationError`.
The package has two main exceptions: :py:exc:`paxb.exceptions.SerializationError` and
:py:class:`paxb.exceptions.DeserializationError`.

:py:class:`paxb.exceptexcions.DeserializationError` is raised when any deserialization error occurs.
:py:class:`paxb.exceptions.DeserializationError` is raised when any deserialization error occurs.
The most common case it is raised is a required element is not found in an xml tree. Look at the example:

.. doctest::
Expand Down Expand Up @@ -43,7 +43,7 @@ or :py:func:`paxb.wrapper` element not found. This behaviour can be altered by p
The same applies to :py:func:`paxb.field`, :py:func:`paxb.nested` and :py:func:`paxb.wrapper`.


:py:class:`paxb.exceptexcions.SerializationError` is raised when any serialization error occurs.
:py:class:`paxb.exceptions.SerializationError` is raised when any serialization error occurs.
The most common case it is raised is a required element is not set. Look at the example:

.. doctest::
Expand Down
2 changes: 1 addition & 1 deletion docs/paxb/namespaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Namespace inheritance
---------------------

The default namespace of any element is an empty namespace. Functions :py:func:`paxb.field`, :py:func:`paxb.model`,
:py:func:`paxb.wrapper` and :py:func:`paxb.nested` has a ``ns`` argument which alters the default (empty) namespace
:py:func:`paxb.wrapper` and :py:func:`paxb.nested` have a ``ns`` argument which alters the default (empty) namespace
by a passed one. Compare two examples:

.. doctest::
Expand Down
8 changes: 4 additions & 4 deletions docs/paxb/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ Suppose you have an xml document ``user.xml``:
</doc:envelope>
To deserialize the document you could use :py:mod:`xml` python standard library api to parse the document
and then set the corresponding class fields. Such an imperative code has a lot of boilerplate manipulations.
Instead you can use ``paxb`` api to write declarative style code. All you need to describe field mappings and types,
``paxb`` will serialize and deserialize data for you:
To deserialize the document you could use :py:mod:`xml` library api to parse the document and then access and
modify the parsed xml DOM manually. Such an imperative code has a lot of boilerplate operations that takes a
lot of time and can lead to bugs. Instead you can use ``paxb`` api to write a declarative style code.
All you need to describe field mappings and types, ``paxb`` will serialize and deserialize data for you:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/paxb/serialization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ By default an object fields serialized using the following rules:
- :py:class:`bytes` field serialized using base64 encoding.
- :py:class:`datetime.datetime` field serialized as iso formatted string.
- :py:class:`datetime.date` field serialized as iso formatted string.
- other types serialized using :py:meth:`__str__`.
- other types serialized using :py:meth:`__str__` method.

The default behaviour can be altered using ``encoder`` argument. Encoder must be a callable object that accepts
an encoded value and returns its :py:class:`str` representation.
Expand Down
2 changes: 1 addition & 1 deletion paxb/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__description__ = 'Python Architecture for XML Binding'
__url__ = 'https://github.com/dapper91/paxb'

__version__ = '0.2.1'
__version__ = '0.2.2'

__author__ = 'Dmitry Pershin'
__email__ = 'dapper91@mail.ru'
Expand Down
14 changes: 7 additions & 7 deletions paxb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
``paxb`` library implements the following functionality:
- Deserialize XML documents to Python objects
- Validate deserialized data
- Access and update Python object fields
- Serialize Python objects to XML documents
- Deserialize XML documents to Python objects
- Validate deserialized data
- Access and update Python object fields
- Serialize Python objects to XML documents
paxb provides an efficient way of mapping between an XML document and a Python object. Using paxb
developers can write less boilerplate code emphasizing on application business logic.
``paxb`` provides an efficient way of mapping between an XML document and a Python object. Using ``paxb``
developers can write less boilerplate code emphasizing on application domain logic.
Since paxb based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
Since ``paxb`` based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library ``paxb`` and ``attrs``
API can be mixed together.
"""

Expand Down
30 changes: 21 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

import sys
import pathlib
import setuptools.command.test
import sys
from setuptools import setup, find_packages

import paxb

requirements = [
'attrs~=19.0'
Expand All @@ -19,6 +19,18 @@
readme = file.read()


def parse_about():
about_globals = {}
this_path = pathlib.Path(__file__).parent
about_module_text = pathlib.Path(this_path, 'paxb', '__about__.py').read_text()
exec(about_module_text, about_globals)

return about_globals


about = parse_about()


class PyTest(setuptools.command.test.test):
user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]

Expand All @@ -32,14 +44,14 @@ def run_tests(self):


setup(
name=paxb.__title__,
version=paxb.__version__,
description=paxb.__description__,
name=about['__title__'],
version=about['__version__'],
description=about['__description__'],
long_description=readme,
author=paxb.__author__,
author_email=paxb.__email__,
url=paxb.__url__,
license=paxb.__license__,
author=about['__author__'],
author_email=about['__email__'],
url=about['__url__'],
license=about['__license__'],
keywords=['xml', 'binding', 'mapping', 'serialization', 'deserialization'],
python_requires=">=3.5",
packages=find_packages(),
Expand Down

0 comments on commit b86053d

Please sign in to comment.