Skip to main content

A Python package that emits JSON Logic

Project description

jsonlogic.py - JSON Logic expression generator

This package provides functionality to express JSON Logic using standard Python datastructures.

An example:

>>> from jsonlogic import Variable
>>> v1 = Variable('var1')
>>> v2 = Variable('var2')
>>> e = (v1 < v2)
>>> print(e)
{"<": [{"var": "var1"}, {"var": "var2"}]}
>>> print (v1 < 3)
{"<": [{"var": "var1"}, 3]}
>>> print ( (v1 < 3) & (v1 > v2))
{"and": [{"<": [{"var": "var1"}, 3]}, {">": [{"var": "var1"}, {"var": "var2"}]}]}
>>> print ( (v1 < 3) & ~(v1 > v2)))  # ~ is "not"
{"and": [{"<": [{"var": "v1"}, 3]}, {"not": [{">": [{"var": "v1"}, {"var": "v2"}]}]}]}

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

jsonlogic_py-0.2.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonlogic_py-0.2.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonlogic_py-0.2.1.tar.gz.

File metadata

  • Download URL: jsonlogic_py-0.2.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonlogic_py-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5479a1592c699342240e92f3c27dc8ed07d32a6467c3348be81822e7c6f5b4d1
MD5 a6cf1a8922e33dab5bd3e5f38ec29ce0
BLAKE2b-256 2c3233cccf6abf6794470c539507d1e61001cc94c05197958309f30331d6f691

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonlogic_py-0.2.1.tar.gz:

Publisher: publish-py.yaml on llnl/jsonlogic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonlogic_py-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: jsonlogic_py-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonlogic_py-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37609314454e962708fa6be85a718216401de211c31064fef100b87b5af7c434
MD5 dded6105c58a553cbb5b940f3042c7b8
BLAKE2b-256 67bae40102043c29b5713da608c55a751e966ba6581aa356d517004d70e9de65

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonlogic_py-0.2.1-py3-none-any.whl:

Publisher: publish-py.yaml on llnl/jsonlogic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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