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

Uploaded Source

Built Distributions

rjsonnet-0.2.1-cp36-abi3-win_amd64.whl (509.3 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.2.1-cp36-abi3-win32.whl (482.8 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.2.1-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.2.1-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.2.1-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.2.1-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ARMv7l

rjsonnet-0.2.1-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.2.1-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.2.1-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.2.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.2 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.2.1-cp36-abi3-macosx_10_7_x86_64.whl (632.4 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.2.1.tar.gz
  • Upload date:
  • Size: 7.0 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.2.1.tar.gz
Algorithm Hash digest
SHA256 9951befd9423981f680112f90e2c791289633be5f29b703319c296835bcb4a16
MD5 0f257549a75d6cf1286f207c6fd9e2d7
BLAKE2b-256 fecb879fa1bb8cb0fa49e3e9f2909982c7743d9b45ce6973e7a25826d4b46e52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.1-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 509.3 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.2.1-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 01808cc12343fd30c08efebee8ae08408fd0ec0d94684787c2157f6bfde188a0
MD5 0075b7afdddd668c71e569fb24511db1
BLAKE2b-256 9e9f714ace39d4e585cd143f770accedc5a2f659df3abd7acb381121b04cc2fd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.1-cp36-abi3-win32.whl
  • Upload date:
  • Size: 482.8 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.2.1-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 e83eb4ce2420a1112d419133dc52dc795070c4811684ef2ed6089c3a0426ab05
MD5 bc11b103d75585e7cf18b44f777c3caa
BLAKE2b-256 34167d799d150a2a48460ab360f07237e9a6661b5cbf454ff06a72725e880bf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.1-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 a937dc90435400b67c40f4847e2b3e09539372e8126ef473027f54cbd2a22ec7
MD5 630aedf6fd7abfbea3b37c026b3d07f4
BLAKE2b-256 650efd009542494c8ff512b25cebeef059d17c155a071c47e835d0f9a0390807

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.1-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 cd53b7b4f6d86407bca3be3650e63cb74fee6dad286019c88e5d7500c8c02e5a
MD5 7490adeaa6ed987cdce2fead7c7182d9
BLAKE2b-256 55c9bdf180a252c73e977cf293012376af7144824081d325eb46fbcc02863419

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.1-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 affa3afecc9a469694dcb65c89fa01b4e49760042cdcb98041f0b34719d7ec17
MD5 fbb6a7a5ea0ff85c6984f3780fe59416
BLAKE2b-256 9f14ef5ae4cd9568aa8e04ae4f22f96deb6a71de6d092f1bb5c37e429e1e9ac3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.1-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 eaded86195ad7a5167100fa88d50623ee83fc0eb4e9f0ca9e08013cab912197e
MD5 1a50d498436e2229304209305232cd05
BLAKE2b-256 5b87d93e4d9fd498cc8fe1e2ea60efa4a2b90136fe6bdaf63ff7da0144e479ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.1-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 03d329be05bb35f67621802e7e146aec757b83175c87d458e397d11ffaaf8afd
MD5 8f888960269aaec03cf6badafc547cc4
BLAKE2b-256 820ec9aba06ebd4c429da2234a070f8ed257a0a81eabc369a396ddd1399561d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.1-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d591dfa537767f2103929f1462e1abe91cf5c58f787f2e78bf4c3517e07b89a1
MD5 92fdb7024e2db8c9bab97eac67989dc6
BLAKE2b-256 eb0220210053d774da3863a7f95360d23d91b64e168cf0334144f6c6ee6c2fe8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.1-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.2.1-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 8819234af018c4346b0b8bf7bfb2178698280ea925a8380342316aeeb848e0e8
MD5 2d2c35cdc50dd2831065609f45b4284b
BLAKE2b-256 12b9e82c132b239875e70e19d42822362fc3cdb6b631d9c2b8ef9379fddf9cef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4fa144ae7477cc0966f70dad99bbca4eadd10cbbc08fc8b2600e000da81a787a
MD5 14e77b4ac8bbd9c176fd7c9a5cc9cb79
BLAKE2b-256 f87b77ec9afb629761bc782247c9e59bcad2f48a84c12fc50451c81ca8137afb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.1-cp36-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 632.4 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.2.1-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ce8c1a11a841431d76890e2d90d58ce220efa6bb578e500afa6bd85bc71d2e89
MD5 7a66d86ca532922309577866ea3dbd19
BLAKE2b-256 71226bcbc988a46b361935d3fd6e8ab90d509482e5a3b561cae85d886c3796f9

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