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/)

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

Uploaded Source

Built Distributions

rjsonnet-0.4.3-cp36-abi3-win_amd64.whl (549.9 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.4.3-cp36-abi3-win32.whl (513.3 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.4.3-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.8 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ s390x

rjsonnet-0.4.3-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.4.3-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.6 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ppc64

rjsonnet-0.4.3-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.4.3-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ARM64

rjsonnet-0.4.3-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.4 MB view details)

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

rjsonnet-0.4.3-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.5 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.5+ i686

rjsonnet-0.4.3-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.4.3-cp36-abi3-macosx_10_7_x86_64.whl (681.7 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.4.3.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.3.tar.gz
Algorithm Hash digest
SHA256 24ecae20a718302249482ad5a5e69f0b79e6e815b096af96a89ff253cdfb45bb
MD5 1b321892587da51f4cfbc674aa6d37da
BLAKE2b-256 87f7b54dad21f7c97893a6f64e87cf326d10462521e3b0a01af9b414453e2a1f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4d85181832c301cf5a8ad0f9825c15ae77e721a61b206f521f09e4f3fc7e06a0
MD5 e8ebda32124a7affb0bd5011d1b10493
BLAKE2b-256 7fb360427a8f8c472c3b6081f81245341a526179159a26d8d446def09c87f03f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 bc0bc565882be369e867e7ce949d72dae26ae61ea8a63385c6d74f89c8906bde
MD5 3075e54bb721ed4c51e15b5b170146f6
BLAKE2b-256 84ebbf23d1fdb40b0ec0ba8b394417e5608ee7d54211d28ceff79cd3ec1f4609

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 2f5f42a209a110b9c23ca70aeee37bcea853f6df200d1b16c0418fb02ce240d8
MD5 e3f1f9a5d7cb571e90980c06a63fe8c3
BLAKE2b-256 bf524fc287114abbf56f2edabaee830944bd6da435fa117fcf12747922366f1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 034f86d3ed11902516fd28163515424c3ddfa4a992260be2f1fa25f8a2939b73
MD5 9147d4ad50802e7bc408131019dbb6e1
BLAKE2b-256 7fe267d7d1f7ae04fae6c918123b67c3e316b8cc0d1f868018e19dcdbd21adb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 63e08df865a68f382e363af50eac3e5037aa18377c8ebb4cebd656136959c24d
MD5 6941ed5818695097eae7df33fbf6a57c
BLAKE2b-256 aa1a53211493e9a340a0e4c66c22e0486d9ddb39466053e6096633f3639f2e80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 7cda979165e6cf92490cfd4ef4676e8b5a6f498fdd75bfd147d135ec91e90601
MD5 1549cf317fb07df6cf50ff87a04565ff
BLAKE2b-256 197f0f261baa75c8c4ff4762c82e0eea0420e79bfd67bed2e937cacc8e5ac526

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dc5cf425dc2006889f9013b50fa6bc3953527e44c42aefaa3f0b3e33e459d509
MD5 df096bf035d02c70f3a39b022d69615e
BLAKE2b-256 ac82232c875efc5ee183f1958a682623336a466c66a4ce8c7b5dafdac4dad5e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ed07c0fca178ce62c29ad737c2fe453b2a38bf49ff811d88ded785b8956455c7
MD5 3a8f22819a515ba516e2f4494ba7bdde
BLAKE2b-256 3eb29cf508aef157e8151be6baf21017c739c201224880e72b5f2eebe2f12d74

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 c2d944e9b67f605134d32dada0564f008f5b3aa1731da4487afb6ed0ed5c74a5
MD5 6970cafc9c76fb0a5e6c54e2d6efd5a3
BLAKE2b-256 c37be785cacc8286edc7ab2cd9ab74c103c68773148eba6fa6de8d5c24d5e419

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 49ddfaf8174afd31acde83c3543d617c54316a66c0bd9fa1351cea9ab8ad7f38
MD5 c205a3b1ef442995b5ef8d9e5c34e9d3
BLAKE2b-256 4ed37d2d81a63e303966b1ad84a50cdc1a2d2d8da767f5ed965977784a75ba9f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rjsonnet-0.4.3-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 f30f292efb186cd9afaf8a8bceb32bc3f833eedb7fd1f2daeb1ad4f73d2044fc
MD5 828cd199705881047a2ba415a777044c
BLAKE2b-256 07b420361cf71031f65b6e263363e3cd5207bf5e2c8640da96cfd94f89c4ddad

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