Booby: data modeling and validation
===================================
.. image:: https://img.shields.io/pypi/v/metabooby.svg
:target: https://pypi.python.org/pypi/metabooby
:alt: Latest version
.. image:: https://img.shields.io/badge/Licence-Apache2-brightgreen.svg
:target: https://www.tldrlegal.com/l/apache2
:alt: License
.. image:: https://img.shields.io/circleci/build/github/metabolize-forks/booby/master
:target: https://app.circleci.com/pipelines/github/metabolize-forks/booby
:alt: Build status
Booby is a standalone data `modeling` and `validation` library written in Python. Booby is under active development (visit `this blog post <http://jaimegildesagredo.github.io/2014/01/04/booby-05-introducing-inspection-api.html>`_ for more info and the roadmap) and licensed under the `Apache2 license <http://www.apache.org/licenses/LICENSE-2.0.html>`_, so feel free to `contribute <https://github.com/jaimegildesagredo/booby/pulls>`_ and `report errors and suggestions <https://github.com/jaimegildesagredo/booby/issues>`_.
This is an active fork.
Usage
-----
See the sample code below to get an idea of the main features.
.. code-block:: python
from booby import Model, fields
class Token(Model):
key = fields.String()
secret = fields.String()
class Address(Model):
line_1 = fields.String()
line_2 = fields.String()
class User(Model):
login = fields.String(required=True)
name = fields.String()
email = fields.Email()
token = fields.Embedded(Token, required=True)
addresses = fields.Collection(Address)
jack = User(
login='jack',
name='Jack',
email='jack@example.com',
token={
'key': 'vs7dfxxx',
'secret': 'ds5ds4xxx'
},
addresses=[
{'line_1': 'Main Street'},
{'line_1': 'Main St'}
]
)
if jack.is_valid:
print jack.to_json(indent=2)
else:
print json.dumps(dict(jack.validation_errors))
.. code-block:: json
{
"email": "jack@example.com",
"login": "jack",
"token": {
"secret": "ds5ds4xxx",
"key": "vs7dfxxx"
},
"name": "Jack",
"addresses": [
{
"line_1": "Main St",
"line_2": null
},
{
"line_1": "Main Street",
"line_2": null
}
]
}
Installation
------------
You can install the last stable release of Booby from PyPI using pip or easy_install.
.. code-block:: bash
$ pip install booby
Also you can install the latest sources from Github.
.. code-block:: bash
$ pip install -e git+git://github.com/jaimegildesagredo/booby.git#egg=booby
Tests
-----
To run the Booby test suite you should install the development requirements and then run nosetests.
.. code-block:: bash
$ pip install -r test-requirements.txt
$ nosetests tests/unit
$ nosetests tests/integration
Changes
-------
See `Changes <https://booby.readthedocs.org/en/latest/changes.html>`_.
Raw data
{
"_id": null,
"home_page": "https://github.com/jaimegildesagredo/booby",
"name": "metabooby",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Jaime Gil de Sagredo Luna",
"author_email": "jaimegildesagredo@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a5/51/329f922fbf0c2a4a2a8cda96920fb647e192f65d3d3d1c303099fd0b05aa/metabooby-0.10.0.tar.gz",
"platform": null,
"description": "Booby: data modeling and validation\n===================================\n\n.. image:: https://img.shields.io/pypi/v/metabooby.svg\n :target: https://pypi.python.org/pypi/metabooby\n :alt: Latest version\n\n.. image:: https://img.shields.io/badge/Licence-Apache2-brightgreen.svg\n :target: https://www.tldrlegal.com/l/apache2\n :alt: License\n\n.. image:: https://img.shields.io/circleci/build/github/metabolize-forks/booby/master\n :target: https://app.circleci.com/pipelines/github/metabolize-forks/booby\n :alt: Build status\n\nBooby is a standalone data `modeling` and `validation` library written in Python. Booby is under active development (visit `this blog post <http://jaimegildesagredo.github.io/2014/01/04/booby-05-introducing-inspection-api.html>`_ for more info and the roadmap) and licensed under the `Apache2 license <http://www.apache.org/licenses/LICENSE-2.0.html>`_, so feel free to `contribute <https://github.com/jaimegildesagredo/booby/pulls>`_ and `report errors and suggestions <https://github.com/jaimegildesagredo/booby/issues>`_.\n\nThis is an active fork.\n\nUsage\n-----\n\nSee the sample code below to get an idea of the main features.\n\n.. code-block:: python\n\n from booby import Model, fields\n\n\n class Token(Model):\n key = fields.String()\n secret = fields.String()\n\n\n class Address(Model):\n line_1 = fields.String()\n line_2 = fields.String()\n\n\n class User(Model):\n login = fields.String(required=True)\n name = fields.String()\n email = fields.Email()\n token = fields.Embedded(Token, required=True)\n addresses = fields.Collection(Address)\n\n jack = User(\n login='jack',\n name='Jack',\n email='jack@example.com',\n token={\n 'key': 'vs7dfxxx',\n 'secret': 'ds5ds4xxx'\n },\n addresses=[\n {'line_1': 'Main Street'},\n {'line_1': 'Main St'}\n ]\n )\n\n if jack.is_valid:\n print jack.to_json(indent=2)\n else:\n print json.dumps(dict(jack.validation_errors))\n\n.. code-block:: json\n\n {\n \"email\": \"jack@example.com\",\n \"login\": \"jack\",\n \"token\": {\n \"secret\": \"ds5ds4xxx\",\n \"key\": \"vs7dfxxx\"\n },\n \"name\": \"Jack\",\n \"addresses\": [\n {\n \"line_1\": \"Main St\",\n \"line_2\": null\n },\n {\n \"line_1\": \"Main Street\",\n \"line_2\": null\n }\n ]\n }\n\nInstallation\n------------\n\nYou can install the last stable release of Booby from PyPI using pip or easy_install.\n\n.. code-block:: bash\n\n $ pip install booby\n\nAlso you can install the latest sources from Github.\n\n.. code-block:: bash\n\n $ pip install -e git+git://github.com/jaimegildesagredo/booby.git#egg=booby\n\nTests\n-----\n\nTo run the Booby test suite you should install the development requirements and then run nosetests.\n\n.. code-block:: bash\n\n $ pip install -r test-requirements.txt\n $ nosetests tests/unit\n $ nosetests tests/integration\n\nChanges\n-------\n\nSee `Changes <https://booby.readthedocs.org/en/latest/changes.html>`_.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Data modeling and validation Python library",
"version": "0.10.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7a3057eebd39e52964824d244bc4f545018ffa882bc5350af0f8dcb1336a6d99",
"md5": "3d0e69e876d39c6a6f9930528a5d07e3",
"sha256": "e545da344ac9b744528bc58bd27010ab1b67e791067adfa00b529814470a65cc"
},
"downloads": -1,
"filename": "metabooby-0.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3d0e69e876d39c6a6f9930528a5d07e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 15722,
"upload_time": "2023-01-19T03:04:16",
"upload_time_iso_8601": "2023-01-19T03:04:16.246457Z",
"url": "https://files.pythonhosted.org/packages/7a/30/57eebd39e52964824d244bc4f545018ffa882bc5350af0f8dcb1336a6d99/metabooby-0.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a551329f922fbf0c2a4a2a8cda96920fb647e192f65d3d3d1c303099fd0b05aa",
"md5": "19de2e2a7fccfa91da5a748260dc4a98",
"sha256": "e160e8ba6538cabff965115495809e3648a1c3e2b3392a23252284ccb7b0d2f1"
},
"downloads": -1,
"filename": "metabooby-0.10.0.tar.gz",
"has_sig": false,
"md5_digest": "19de2e2a7fccfa91da5a748260dc4a98",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12040,
"upload_time": "2023-01-19T03:04:17",
"upload_time_iso_8601": "2023-01-19T03:04:17.682642Z",
"url": "https://files.pythonhosted.org/packages/a5/51/329f922fbf0c2a4a2a8cda96920fb647e192f65d3d3d1c303099fd0b05aa/metabooby-0.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-19 03:04:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jaimegildesagredo",
"github_project": "booby",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "metabooby"
}