Skip to main content

Python bindings to Rust jrsonnet crate

Project description

rjsonnet-py

CI PyPI

Python bindings to Rust jrsonnet crates (Rust implementation of Jsonnet language).

Installation

pip install rjsonnet

Usage

This module provides two functions:

  1. def evaluate_file(filename: str) -> str: ...
  2. def evaluate_snippet(filename: str, src: str) -> str: ...

In the latter case, the parameter filename is used in stack traces, because all errors are given with the "filename" containing the code.

Keyword arguments to these functions are used to control the virtual machine. They are:

  • max_stack (number)
  • gc_min_objects (number, ignored)
  • gc_growth_trigger (number, ignored)
  • ext_vars (dict, string to string)
  • ext_codes (dict, string to string)
  • tla_vars (dict, string to string)
  • tla_codes (dict, string to string)
  • max_trace (number)
  • import_callback (see example in tests/)
  • native_callbacks (see example in tests/)
  • preserve_order (bool, preserve object field order during manifestification)

The argument import_callback can be used to pass a callable, to trap the Jsonnet import and importstr constructs. This allows, e.g., reading files out of archives or implementing library search paths.

The argument native_callbacks is used to allow execution of arbitrary Python code via std.native(...). This is useful so Jsonnet code can access pure functions in the Python ecosystem, such as compression, encryption, encoding, etc.

If an error is raised during the evaluation of the Jsonnet code, it is formed into a stack trace and thrown as a python RuntimeError.

import rjsonnet

# evaluate a jsonnet file
rjsonnet.evaluate_file("filename.jsonnet")

# evalute a jsonnet code snippet
rjsonnet.evaluate_snippet('filename', 'jsonnet code snippet')

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

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

rjsonnet-0.5.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distributions

rjsonnet-0.5.2-cp37-abi3-win_amd64.whl (924.1 kB view details)

Uploaded CPython 3.7+ Windows x86-64

rjsonnet-0.5.2-cp37-abi3-win32.whl (851.5 kB view details)

Uploaded CPython 3.7+ Windows x86

rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ x86-64

rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_i686.whl (2.4 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_armv7l.whl (2.3 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.6 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.0 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

rjsonnet-0.5.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (2.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

rjsonnet-0.5.2-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.2 MB view details)

Uploaded CPython 3.7+ macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

rjsonnet-0.5.2-cp37-abi3-macosx_10_7_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

Details for the file rjsonnet-0.5.2.tar.gz.

File metadata

  • Download URL: rjsonnet-0.5.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for rjsonnet-0.5.2.tar.gz
Algorithm Hash digest
SHA256 95062261ffdef831a9e44a35e2d3a97a91d3870dac364ed6beae57d0851eeecd
MD5 29b3b4726d33769becbaeb563327e25a
BLAKE2b-256 5af577da28b6378b7fe3b92184bd06ec807db872e9b24ce21e023e221d073c44

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: rjsonnet-0.5.2-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 924.1 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6b7c5d2d1ee0fed32f448681cc011b93bfb718290173a15f5f055124c089ecec
MD5 82001e0cc40ce4a9f1cd082c365eed97
BLAKE2b-256 870e421c43627801b59b05ec2e594082554880e3418df32ea7a515c599114ceb

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-win32.whl.

File metadata

  • Download URL: rjsonnet-0.5.2-cp37-abi3-win32.whl
  • Upload date:
  • Size: 851.5 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 f402453f6051893ddc83377afbda6bcf6cc2a81613a65090d8dc50327ab8996c
MD5 22bebc9f85715286044cc6d38c017810
BLAKE2b-256 bd715ebd383acf4a83b3b981bf590a9b38d68641d3cb1bc984d7688846619525

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e0f5f447ea76fb279d3310ff695cee6fee52c0101d2260bafb62de2abdc44c8d
MD5 d5330e417b45365397286d07727d2acf
BLAKE2b-256 466f1622d461d294ad16834507e40f860cf62c613d86a2ea65a9315f9f64a1c7

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 1388aeb0b3caa6ce206517f8da95ed22ccca074b6f8eca94a91d526bb76bb392
MD5 1035001ea2e7bc3aa79a8256a9c4ebdc
BLAKE2b-256 979c4db5f3f752e0c362285946a26e46b9037d045d5e7e302afea7ba890d1881

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 1a8a7e587fcab68253d47bb8b76b7fe75821f649612dbca9bc43caccd8d883b9
MD5 19b914626454231e0a38f4b3d89c4ef1
BLAKE2b-256 d2792cdede14cfb2ce9d3d468ba71df38200d0205537ad4bde15494e17e44eb4

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6b01c34690d64068fb01ad62356b5b7b40bdc1b8804cfbcc6fa6a80ee86e6905
MD5 1a7e958d5ccd80b9de24b9a3b1525a5f
BLAKE2b-256 ed883d9ed7998b8dacf3ed3fc32bb6a1cbf1cae4c0a86760a4d79b61ab712d14

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5a8b72d318b2f1f24df3f7f5ed5436522f02aaf3ee8b8f4d635417fe863f6a7
MD5 a52ca17eed0fa96bd3b7ff0ecf4132b4
BLAKE2b-256 c1efe5c8270f028ad3f5415ebee1060c69f41cb07f46e8cb5375f8dbb0e2adeb

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 d14d5245c0448676125556578d489b93c13525ceb4313aa6ddfba9677b5342c5
MD5 a84872400211147782bc9fe1e5db20d6
BLAKE2b-256 b0690d435563632421aa618e03f21932597d107231abc6673d0ba0f0ef908c49

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 357a75e5ea45c674c430b7a7146d3be182e64a1b4fcb569ba9878e0ca04e8369
MD5 6e27504f3e22af72c0758ddd5a43587f
BLAKE2b-256 bc2ed7a0804858eaeb4677ab1c8f21dc4ed965e0cf138bfe5cd1efeedae6c3f5

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a3159d1309bbff4e34406e1f0259191bba5d7b7f91021061f6211298bdc22307
MD5 3049e028cd1f8ceeab200074607d0778
BLAKE2b-256 e5e70767a86327c87c4d284d869bad515a183a02fa0f564171e74ec3b08ce348

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e2fdf3f967b924020a752c45e772c107586f458c71dff1de18977cf5cc84de48
MD5 ccd11c37087186b6ab111d80859c69d4
BLAKE2b-256 43d22f477e7292a996c799cb2ec273c2ba1eeb44d0f35b90737f05c27fb0d27c

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 4bae1eb251b4e2cd7aadcc57ba99e009f1a0bb257d348095f18e7fb3f882ab36
MD5 23865d17dca28eda2f07997b5442885e
BLAKE2b-256 ce110ea81a2cb458ab91d66a8ce3a04e3d4fe7e7374da48fdc6473b144f4c9fa

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 162e3a5a01591ccc4b0e589a1afcbbe01abab3762fef110cb25f6dbd5be18b1f
MD5 87f1467eb120095e4f6695d9d3900d68
BLAKE2b-256 dc80300e3f5be1bb95f4a03bc29c9a80f3b36bbf09b86f06dcf0d6bf669b162d

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.2-cp37-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.2-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 f6e72ea6859cd7d64dd04a7c6ba53d7abe6437336b8e51768e482b82f352b380
MD5 d51ad763f1c393bb75a44eeb54da1ef9
BLAKE2b-256 49f4c8af615cf2ec00b42cfb96dba92561394c37f4b90455efd9799621fe3f9d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page