Python bindings for JSONata
Project description
pyjsonata
Python bindings for JSONata.
Building
Required build tools:
- npm
- clang
- make
If you want to run tests:
- pytest
To build:
Ready?
-
Install docker
-
From the repository root:
git submodule update --init --recursive rm -rf dist build __pycache__ pyjsonata.egg-info docker pull quay.io/pypa/manylinux2014_x86_64 docker run -it --mount type=bind,source=$(pwd),target=/src quay.io/pypa/manylinux2014_x86_64 /src/docker-build.sh
-
If the stars have aligned, and it is Tuesday, you will now have a built
pyjsonata
wheel -
If you are me:
python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*manylinux2014_x86_64.whl
The best part about all this is that it builds a .so
using the build
procedure for CPython extensions provided by setuptools. This isn't even a
CPython extension. It just uses ctypes. But there isn't any packaging support
at all for people who use the runtime-agnostic FFI library built into Python.
Building this package is harder than writing it. Thank you, Python.
Testing
Pytest
From the repository root:
python3 -m pip install pytest
python3 -m pytest
Usage
from pyjsonata import jsonata
my_expression = "$"
my_json = "{'foo': 'bar'}"
# "{'foo': 'bar'}"
result = jsonata(my_expression, my_json)
With exception handling:
from pyjsonata import jsonata, PyjsonataError
my_expression = "$"
my_json = "{'foo': 'bar'}"
# "{'foo': 'bar'}"
try:
result = jsonata(my_expression, my_json)
except PyjsonataError as e:
print("Error: ", e)
That's it! Return values are always strings.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for pyjsonata-0.0.1a9-py3-none-manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20f131794f28996505938592592fc9117af84e4c432516eef11bdb417d471f97 |
|
MD5 | f0fefaece7534b2c0ebd2e06aa119804 |
|
BLAKE2b-256 | b0b0062ab183f0eb683e9fcbcb1fc439971815674980c8cec8d52e5a649e9954 |
Hashes for pyjsonata-0.0.1a9-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eff903cba3c795a79c04fea88db5af39184af1290128e0520b54682dbc3e7b7b |
|
MD5 | 94ee0047001f1ec6a4ba638214588777 |
|
BLAKE2b-256 | a6ea96ef0cb517fb02d37d0c919a1c6dbae497db39345bf4b836f55019a1ab6b |
Hashes for pyjsonata-0.0.1a9-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 850db90f4c7e63282d1ba041240bc18dcd0e09747cd8f87e1e218305ddf291aa |
|
MD5 | d8199cbee2f170795d70d4790d91ee4d |
|
BLAKE2b-256 | dae2b95813c1908746899beb4893ddb3f743f89ecc35259f6cce0f73a568d444 |
Hashes for pyjsonata-0.0.1a9-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43132107485b959ee0113a5458c3e55575a268f91f9ee3bd164957ec5e39b990 |
|
MD5 | cf5f7536f63efef9fe7bae779a8fc51b |
|
BLAKE2b-256 | 3027fc8e5bcfd2d7e95861e9c755dbee51987a4c0e77b9d5e2d590453a85f2f4 |
Hashes for pyjsonata-0.0.1a9-cp37-cp37m-manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 186c02b844bc4dbf62dff7954ea7bb0308eb24f5a6daefcd0c087e78aaf97aa5 |
|
MD5 | d9e5387dcd07eaa1976278fb9297a24d |
|
BLAKE2b-256 | a05243ed2eb7a8c9a7b1e6fd51b6da0cf4268b562d250aadae42bfd0f291cae9 |
Hashes for pyjsonata-0.0.1a9-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bfcf06f5900daa905a76671d74b18b9aec4db2d165fde656c563ead099c18a7 |
|
MD5 | a28ad591105079ef02d841e970770689 |
|
BLAKE2b-256 | 19ea0c826c40d7534af6a1b355865518fdcde8b257bcfac45d47b33c544c4b07 |
Hashes for pyjsonata-0.0.1a9-cp37-cp37m-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8ded3dc6710f0d84cdd6e7c279ab9de8a1379277cf4554e55324e47581cb150 |
|
MD5 | 9aa11897c39082d183f29b9ad7583d47 |
|
BLAKE2b-256 | 8845918931dbc8e73130fb2414391afe1e4261126ce081bdb8abfbc1e9b7431f |
Hashes for pyjsonata-0.0.1a9-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91ff9bf9e5b6ef377d1b7325fb48edd5e63f18cbbb928e87715669a80cf6bae7 |
|
MD5 | 0afd4b8b79c71db4224389720c15daff |
|
BLAKE2b-256 | e58ac2a9902cf8047986a66a6530f3f14b5b47d031f1df105a516b7e183668b8 |
Hashes for pyjsonata-0.0.1a9-cp36-cp36m-manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6b8663b51ff9c1fcab8164f76ac31a67fca2ea6e17fc555efeb73ebd4ac90a4 |
|
MD5 | 158abe62187e0a2a7b907ad65dfe7b8a |
|
BLAKE2b-256 | 2481d6b13ab749ed34b24311f2c1b1dd7d4073d7073ff4ed0bc1a429edf340d2 |
Hashes for pyjsonata-0.0.1a9-cp36-cp36m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f4b17bd185a88cda488f7e5072fa24cc3fd789481affcd35eeb993e5fd6bced |
|
MD5 | 0aaa6366c43ee0a23b40675b6970418f |
|
BLAKE2b-256 | 9075678c1c4c37b4ceee89b1345e2f9336861cc11ccab8cbf7ae5238ac122c5d |
Hashes for pyjsonata-0.0.1a9-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ae49fa23c058f7f227d0f03e4d4e2f008c82497714545d052bf7d6f48833f60 |
|
MD5 | 3db714972385a6d49636b9b125105993 |
|
BLAKE2b-256 | 5d1243d3b6e20a1829b09db9ee1ee519f1689cd9092f5b47a1663c6c26cfa33a |
Hashes for pyjsonata-0.0.1a9-cp35-cp35m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86bd0e7059bbf234984a6514ae410cf89cc3fa428972a898169d361023928ca3 |
|
MD5 | 14e95cb49825875b258a4e077cee5658 |
|
BLAKE2b-256 | 7e0a4fff94fc24493a2cc8a4dccba092dd927e72e177c23afc670aa9bded1d15 |