Skip to main content

Rx schema and validation system, with added error messages

Project description

pyrx with error messages
====

Python implementation of the [Rx schema and validation system](http://rx.codesimply.com/)

Fork of [pyrx](https://github.com/uniphil/pyrx) with added error messages. Most of the readme is also taken from there, just with updated usage instuctions.


Forked
------

Forked from the main [rx github repo](https://github.com/rjbs/rx) Nov 25 '13
because the python implementation deserves its own place and testing and stuff.

The copyright line of the license for the rx repository reads:

The contents of the Rx repository are copyright (C) 2008, Ricardo SIGNES.

The license itself is GPL2: https://github.com/rjbs/rx/blob/master/LICENSE


Requirements
------------

* No external dependencies
* Python2.7


Usage
-----

```python
import pyrx

rx = pyrx.Factory({"register_core_types": True})

schema_src = {
"type": "//rec",
"required": {
"a": "//str",
"b": "//int",
},
"optional": {
"c": "//bool",
},
}

schema = rx.make_schema(schema_src)

schema.check({"a": "a string", "b": 2}).valid # returns True
schema.check({"a": "a string", "b": "another string"}).valid # returns False
schema.check({"a": "a string", "b": "another string"}).message # returns an error message

```


Testing
-------

py.test test/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrx-ats-0.3.1.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file pyrx-ats-0.3.1.tar.gz.

File metadata

  • Download URL: pyrx-ats-0.3.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyrx-ats-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7e02733de305886472f4a9fb718355973ddd878e7af80d10f855b435114f805a
MD5 2bd38f13945481ab0e61c25574e1c41a
BLAKE2b-256 d7fb54ca6e0a8fb983bc376d1333328b99e0f429ef5524aac9a47967d85fdd90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page