Poseidon Rules
Validate complex json data against rules you defined.
Philosophy of this library
Business code has complex logic, and they can be wrapped deeply, so we need a DSL to define these rules in one place.
Every logic can have two basci relation, and or or, but the not logic is left to the rule evaluation written by developer.
Once one rule is not satisfied, the whole logic rule will be falsy, call the help function get_reason_stack will find the deepest name of rule, aka the exception message wrapped in the RuleFail.
Rules is defined in dict format, which is bad compared to the Haskell lazy evaluation. So you can pass a closure function to the "must" or "else_must", which will be called when "if" is evaluated to true ("must") or false ("else_must") at runtime, instead of define-time. This feature make you free from caring about the exception in some situations.
Usage
See test
Metadata
Release files for poseidon-rules 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| poseidon_rules-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Release files / poseidon_rules-0.1.4-py3-none-any.whl
| Download URL | poseidon_rules-0.1.4-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db51b818e2781b34c8495fce69e25abc7ac6f2437ba01f0234c79d6184c6ed5d
|
|
BLAKE2b-256 checksum How to use checksums |
06871c5af644c5105b0c167a7a8a7da8ab0e5b30aef9ba4385f2cc0678b88b3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.7
|
Security for poseidon-rules 0.1.4
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.