diff --git a/README.md b/README.md deleted file mode 100644 index 09a3766..0000000 --- a/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# lollipop - -[![Build Status](https://travis-ci.org/maximkulkin/lollipop.svg)](https://travis-ci.org/maximkulkin/lollipop) -[![Documentation Status](https://readthedocs.org/projects/lollipop/badge/?version=latest)](http://lollipop.readthedocs.io/en/latest/?badge=latest) - -Data serialization and validation library - -Example - -```python -from lollipop.types import Object, String, Date -from lollipop.validators import Length -from datetime import date - -Person = namedtuple('Person', ['name']) -Book = namedtuple('Book', ['title', 'author']) - -PersonType = Object({ - 'name': String(validate=Length(min=1)), -}, constructor=Person) - -BookType = Object({ - 'title': String(), - 'pubish_date': Date(), - 'author': PersonType, -}, constructor=Book) - -BookType.dump( - Book(title='Moby-Dick', - publish_date=date(1854, 11, 14), - author=Person(name='Herman Melville')) -) -# => {'title': 'Moby-Dick', -# 'publish_date': '1854-11-14', -# 'author': { -# 'name': 'Herman Melville' -# }} - -BookType.load({'title': 'Moby-Dick', 'publish_date': '1854-11-14', - 'author': {'name': 'Herman Melville'}}) -# => Book(title='Moby-Dick', publish_date=date(1854, 11, 14), -# author=User(name='Herman Melville')) - -BookType.validate({'title': 'Moby-Dick', 'author': {'name': ''}}) -# => {'author': {'name': 'Length should be at least 1'}, - 'publish_date': 'Value is required'} -``` - -## Installation - -``` -pip install lollipop -``` - -## Requirements - -* Python >= 2.6 or <= 3.5 - -## License - -MIT licensed. See the bundled [LICENSE](LICENSE) file for more details. diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..aa5d847 --- /dev/null +++ b/README.rst @@ -0,0 +1,87 @@ +******** +lollipop +******** + +.. image:: https://travis-ci.org/maximkulkin/lollipop.svg + :target: https://travis-ci.org/maximkulkin/lollipop + :alt: Build Status + +.. image:: https://readthedocs.org/projects/lollipop/badge/?version=latest + :target: http://lollipop.readthedocs.io/en/latest/?badge=latest + :alt: Documentation Status + +Data serialization and validation library + +.. code-block:: python + + from lollipop.types import Object, String, Date + from lollipop.validators import Length + from collections import namedtuple + from datetime import date + + Person = namedtuple('Person', ['name']) + Book = namedtuple('Book', ['title', 'author']) + + PersonType = Object({ + 'name': String(validate=Length(min=1)), + }, constructor=Person) + + BookType = Object({ + 'title': String(), + 'pubish_date': Date(), + 'author': PersonType, + }, constructor=Book) + + BookType.dump( + Book(title='Moby-Dick', + publish_date=date(1854, 11, 14), + author=Person(name='Herman Melville')) + ) + # => {'title': 'Moby-Dick', + # 'publish_date': '1854-11-14', + # 'author': { + # 'name': 'Herman Melville' + # }} + + BookType.load({'title': 'Moby-Dick', 'publish_date': '1854-11-14', + 'author': {'name': 'Herman Melville'}}) + # => Book(title='Moby-Dick', publish_date=date(1854, 11, 14), + # author=User(name='Herman Melville')) + + BookType.validate({'title': 'Moby-Dick', 'author': {'name': ''}}) + # => {'author': {'name': 'Length should be at least 1'}, + 'publish_date': 'Value is required'} + + +Installation +============ + +:: + + $ pip install lollipop + + +Documentation +============= + +Documentation is available at http://lollipop.readthedocs.io/ . + + +Requirements +============ + +- Python >= 2.6 or <= 3.5 + + +Project Links +============= + +- Documentation: http://lollipop.readthedocs.io/ +- PyPI: https://pypi.python.org/pypi/lollipop +- Issues: https://github.com/maximkulkin/lollipop/issues + + +License +======= + +MIT licensed. See the bundled `LICENSE `_ file for more details. diff --git a/setup.py b/setup.py index 4529887..958387d 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def read(fname): name='lollipop', version=__version__, description=('Data serialization and validation library'), - long_description=read('README.md'), + long_description=read('README.rst'), author='Maxim Kulkin', author_email='maxim.kulkin@gmail.com', url='https://github.com/maximkulkin/lollipop',