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

The Python module provides two functions, evaluate_file(filename) and evaluate_snippet(filename, src). 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/)

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.3.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distributions

rjsonnet-0.3.0-cp36-abi3-win_amd64.whl (519.6 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.3.0-cp36-abi3-win32.whl (491.3 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.7 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ s390x

rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.5 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ppc64le

rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.5 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ppc64

rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.4 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ARMv7l

rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ARM64

rjsonnet-0.3.0-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.5+ x86-64

rjsonnet-0.3.0-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.4 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.5+ i686

rjsonnet-0.3.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.3 MB view details)

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

rjsonnet-0.3.0-cp36-abi3-macosx_10_7_x86_64.whl (642.1 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.3.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4b126d2e34622f05f3a92e45ddd3d95446b88db62b2698b1166dfed147ac1946
MD5 12837690c1ed740015f2fbe29750590a
BLAKE2b-256 5cd574a563bced56a8ea1fde08b992fdff0afa9d73e2f578a60465988ed0e18a

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-win_amd64.whl.

File metadata

  • Download URL: rjsonnet-0.3.0-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 519.6 kB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 08bdb2ad587d89ca9b9440d915a00941492ecfb6b9e35d804043947a270ad058
MD5 5ec3f43a46dfbe6f14fe5263e67c09a2
BLAKE2b-256 c010b4c514b7f797b943d8c73322ef519b5fb1bc00967228661bd0fa7c9221e6

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-win32.whl.

File metadata

  • Download URL: rjsonnet-0.3.0-cp36-abi3-win32.whl
  • Upload date:
  • Size: 491.3 kB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 27e38056e50dbe4b47fb37a518cdb28489d6db21a39bdf4ead64576cf40e9f9d
MD5 c46299254c28d512bf92a004da75b8d1
BLAKE2b-256 e0807f173a88aaca291c5e88b8bedb0478ce344e35b1002b508cce07131ea625

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 c5315826177c47c662e45290a37e4e84b36ddb3e5b22908a83b60c49d657c0f3
MD5 8b9f0c1b097968b1f07b93d5638750e9
BLAKE2b-256 efccdc0ad82100bcccab79587aa8acfcb897719b7e63660982eb5d47878f5b99

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 652f0b30613aeed373dee1c75f5425830ef24999673dc2732e5a7dbbf9a58f17
MD5 26450ee576b80f5d5cdcbfbdff85d673
BLAKE2b-256 bd5366a299c51806c6eb5f0274be48cc2d532cc073c59cf9eec2c42e3cdee7eb

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 ab5a84c2e9ddff9330e592fd5e1d2f91df66f47ed3875363741542c54c8c9703
MD5 ae92178fe223bb2984f72d13121cd058
BLAKE2b-256 e7e0719b04e67c127a3b755852ed719c1522be3b7077da4b39e3536b007075bb

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6a5552f629feebdfa88d99e09d9d3774805b9a8bce928bb4a28146ee4e858484
MD5 96db0edfc4966974e0022611f195aa90
BLAKE2b-256 24528ffec6234cacf5b1336fabd4ea44c3c013f2c42bc65974c3ecabd766ffe1

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d5aed66e3a9d339440b635b46ff38927acffecf16e09c52acb812ea6ad209291
MD5 2b06d520bdce7a882644246b6f9f66a1
BLAKE2b-256 332afc55b4cfe6f3561a02c08c0866c5d429b919ce2d69316a8ee2cc91b4d55f

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 214f912bd5394cb04379188ef9e896dbdb5dca6078796deb5da4e8353aa82010
MD5 be76d57e84fd9b3f19b6c30c287b181a
BLAKE2b-256 ae466b59aafabb55e8a0d1ea8884c405c0c00a799630ce3ee77bae2a5c076ad9

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

  • Download URL: rjsonnet-0.3.0-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6+, manylinux: glibc 2.5+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 3af55d15f4fbf9cc0449a3d519a3de128170993108a59fc9359f98b3bac4e3ca
MD5 e520d2a9f108d364ff432f6dd5e28b17
BLAKE2b-256 f3df2cafb7b1bd1af9c8cc0852b16e03d8d7baa4dc443ad6549f15681b0e43ec

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c68d5e479c6e8c188b051cac23f403f232da7c491af8f6d5d677ea8c42ebcdd9
MD5 34fcee9d56b3b34f96cd515d69306d19
BLAKE2b-256 9200343ef0c9bc906dc7e74d80b2ccca716a557919da1563829f7664c09a860a

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.0-cp36-abi3-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: rjsonnet-0.3.0-cp36-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 642.1 kB
  • Tags: CPython 3.6+, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.3.0-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 378e7417881ee4361eb97515ccfe36b384a76e6e159286c7f649a69a397a9b85
MD5 a4146487973450de5e374835766f0ea8
BLAKE2b-256 7c29e19af2452abdc58e0d1becb3213bfc14b203e285640466c338741f7758e1

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