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

Uploaded Source

Built Distributions

rjsonnet-0.4.5-cp37-abi3-win_amd64.whl (580.6 kB view details)

Uploaded CPython 3.7+ Windows x86-64

rjsonnet-0.4.5-cp37-abi3-win32.whl (538.5 kB view details)

Uploaded CPython 3.7+ Windows x86

rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_x86_64.whl (1.8 MB view details)

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

rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_armv7l.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

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

rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.9 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.8 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.6 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

rjsonnet-0.4.5-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

rjsonnet-0.4.5-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.4 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.4.5-cp37-abi3-macosx_10_7_x86_64.whl (722.2 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.4.5.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for rjsonnet-0.4.5.tar.gz
Algorithm Hash digest
SHA256 0ae1053206568be6877ec04f427bf4f0d17446c48ab8e780a560fd61665ea496
MD5 926353a4393c2745dc3fac69f3af1a3f
BLAKE2b-256 1a6fc868d75a27f7e05fb136c39b8c8804f08fc472af1afac49949888a9583ae

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0d4b052a664ad9e96a66ca9844e88dc9480524e5e9cca0f2326a1f4a5675b44a
MD5 9d6420dba22ba7af8b3732df688b6626
BLAKE2b-256 e5f118e870a4bf6acb83fb4ea870ab054d5ef0f95037d79916835dc8baea5379

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.5-cp37-abi3-win32.whl
  • Upload date:
  • Size: 538.5 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 37aa09ef4fcb20e3b56c2cacd725cbd26f09b70719c48494d3635fe076c3f9a1
MD5 9e56763c3481d4000d7c5b2d0d145070
BLAKE2b-256 a4f0b2f0ce1fcdae579194b07e427c8bf1a377fde576aa6c7e3cc2be3c661b2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 747e14ae7971faf695f1400d291cd609c397f858d8b3ea72b071924fb722c1e6
MD5 ebf06855aacd4f50cb8509ff50ff44e0
BLAKE2b-256 11b28fe1b1aec2a4edde55863cafe4ea47fe25143a0f994426324b83d7f5c7a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 aa21e09b598a488cfc757dc356f02272b1b660ae65ee735b4c1dcd5f73315585
MD5 635023bfc9fb4f01bd547948d9ed1fb5
BLAKE2b-256 765cf5a0578efc0b43e696494abc917154a71c282bdfd2b0920ea4ea60950aea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 8db143051b158e7fd41fb234af05c769effb75d17b9ec01031a0054196c48d5a
MD5 b17b111e7ec6d47f9f9a5a2c4600e450
BLAKE2b-256 15c73cf69a7db8cd9a6f8b3393b7dbd06b22cc18f17119ed1bbc6c0ef471cc2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 53fb60a6b6800de760d9a8c2579599fd6f7f4ca85ee7f3ae16e8d71e00b0f522
MD5 af545e98bb0a3477289c5006b27769a4
BLAKE2b-256 40b2a5cf377ced210008bf3dce2654eab204e135ba77e0ab0acddcbae07cc9ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8217417b8ea42cf97edd62a66d66e0cc4fd8b05e57f06305026b924a0525dad9
MD5 a054f59e37b4035ed64864435a9b18b7
BLAKE2b-256 bd6b46601512db8dd0bbcd751031974a0bb2bc68ee1039a19c2fcbbd5df0538f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 d4f63528ac9a2fd68f683ec0da478817a86f965167c874be9bb0434fe5e411e2
MD5 2cd6e9bbce679d50d62c9189fc007f16
BLAKE2b-256 2608715de841cff93a7298e9727c80728b55828edc547eb2e29bd03f1112323f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 7cda0bdd4ee656dfb4d6d4a45ce9fbbf7ddaddecbfb6b5efd381960a79564d3f
MD5 36bd6d55be0498f9fc37d19cd510a7c2
BLAKE2b-256 d48a4ba817fa07bb0e0e8515cbd5f8a1779824e45381f5a98cfbb5453c0eb063

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 82e7c8b189fa8074a3956c5283dcd36220cd945fb2fe547ec0f72ffd2712f20b
MD5 5059ef837abf26fe77885743b63ea7b6
BLAKE2b-256 727c39f39237e3c0648256d7a20d9ec530f2b5fbf021ba77ba89ace7e79688a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4921e610f73c4cad44a41e2b5b6aeac70d29c172e54a9f9838d7d6d1696512d1
MD5 7a6706ab868302f2e5a19679a25d2c7f
BLAKE2b-256 10c646e967b947668ca4439f6c5aec8bb00617f4c433b7bc6f64028ca7808498

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 21083c46516f95005b343dc8f69ecea140718028482b041ac55b357ac8e1615f
MD5 8d532db141fa881f1a29991de61dac7c
BLAKE2b-256 0fca52906c3b39bf42e70b4b76b7ca074e026c67ce56d8f2b30a8c627964209d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 84c4b4eaea2c11881c0e23ede9867c384e7cccf4c14e279260b715dec7aaaecb
MD5 0a25413828d76d6f382e87492fe5acbb
BLAKE2b-256 a33221bb4b89c862086657647785d58a95fc5c8243a2b9f3cd97fcf0f6ccae7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.5-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 efe3ebfc5caf22aa3e2b50270bcd786f9b546b1bdf5a64df1099cd43a54b73df
MD5 67fa300c5d3fbb3d8d682784d7c61b9b
BLAKE2b-256 5c79238ced80c29a5306c8f6bce333a7c77a91a5c7935900d8df0f1039af8729

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