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.4.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.4-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jsonlogic_py-0.2.4.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.4.tar.gz
Algorithm Hash digest
SHA256 5cffb84fd21efc774ceda5394c599896b5d88073e78032d21d76c12994d87430
MD5 c2db5ee39c94d43e8eb9c08d1b6bd881
BLAKE2b-256 a685f4febb6356a5a39512c62b26a935dba9256f31f7ea507f90fa43bb95f649

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: jsonlogic_py-0.2.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b74a17f98acc239018e4e615c02b6d8fbbf5f008193c23648dfc165e51fc906
MD5 077a34fcea19afb81d1152fe8efc5a72
BLAKE2b-256 9af0ff96b413f37e6f0174fadccd23fbbc573b6ab6da9490fa461ae8156b36e0

See more details on using hashes here.

Provenance

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