Skip to main content
pyrx
====

[![Build Status](https://travis-ci.org/uniphil/pyrx.png)](https://travis-ci.org/uniphil/pyrx)

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


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 (python3 support coming soon)


Installation
------------

```bash
$ pip install pyrx
```


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}) # returns True
schema.check({"a": "a string", "b": "another string"}) # returns False

```


Testing
-------

I didn't bring the tests over from the rx repo. They used `TAP` or something
I'm not familiar with. The tests included here just run through a couple
trivial cases to make sure it doesn't straight-up crash.


Road Map
--------

* [x] Porting tests from the original RX repo (but using unittest)
* [x] Port to python3
* [x] Improve error messages on invalid schema tests
* [ ] Improve documentation

Metadata

Release files for PyRx 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyRx 0.3.0
File Size Uploaded Provenance
PyRx-0.3.0.tar.gz 6.0 kB Without provenance Details

Release files / PyRx-0.3.0.tar.gz

Download URL PyRx-0.3.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d69f0d1e43dc4b68effd751dfa333ceae202291479e4c276354280dbf508887b
BLAKE2b-256 checksum
How to use checksums
3692eb6a52b80b230d8ce2965e50e9cc67086a728ac5ab3f83d4d6de64e6f63c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for PyRx 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page