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.2.tar.gz (6.8 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.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jsonlogic_py-0.2.2.tar.gz
  • Upload date:
  • Size: 6.8 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.2.tar.gz
Algorithm Hash digest
SHA256 b4be24b864a265df5f37dd32770e90b3e4ee42f2fa51cc60988df003204293af
MD5 0985554ec61c463cc4e3b7ff2cd50fe8
BLAKE2b-256 a85c937fe17012a7a0d9a9a807a5c0cf769834c11206da7cea2988ba0ce55118

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonlogic_py-0.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: jsonlogic_py-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf2454d0c9a8ee7b7a578cf8f9360fb5703118cd1c5cb055939027711b862881
MD5 53114381df74dfb0b6a6f79832093b77
BLAKE2b-256 6fd97692f986c9cbc7ae4912abd065ddc586c43315f7b447dbed691fca27224b

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonlogic_py-0.2.2-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