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

Uploaded Source

Built Distributions

rjsonnet-0.4.6-cp37-abi3-win_amd64.whl (584.5 kB view details)

Uploaded CPython 3.7+ Windows x86-64

rjsonnet-0.4.6-cp37-abi3-win32.whl (549.7 kB view details)

Uploaded CPython 3.7+ Windows x86

rjsonnet-0.4.6-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.6-cp37-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

rjsonnet-0.4.6-cp37-abi3-musllinux_1_2_armv7l.whl (1.9 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

rjsonnet-0.4.6-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.6-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.6-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.6-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.6-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.6-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.6-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.5 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.6-cp37-abi3-macosx_10_7_x86_64.whl (760.5 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for rjsonnet-0.4.6.tar.gz
Algorithm Hash digest
SHA256 ff175a4c73796681af40c056708d73b0e14863f37e9dae3c34cd36054c9df51e
MD5 b39d940aeef58751ffe147cf711dc7cb
BLAKE2b-256 e84cc94f3853bbabead1ce981fc94e5063eb05f8e9dee8ef20a3393c937d2913

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.6-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 584.5 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.4.6-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c97511a4f9d7d2b1f1cb63647b17e305563499c9768be88241635431c2e6dd86
MD5 809c725db081a61d67f0efc972cd92ad
BLAKE2b-256 270b4e574074bada3fd2406665876215c5b46da0a6f78631a20759ecc4a15193

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.6-cp37-abi3-win32.whl
  • Upload date:
  • Size: 549.7 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.4.6-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 24b804323a0419844c5bfb47582eca2b7012cfd3900902d63089920323a97cc5
MD5 0f672fbb7180d70a81d90d7da1e55c8d
BLAKE2b-256 c94aed01f06b39db34dc92becf0e2fee406835a63c3f4f7b0228083fcacfb4ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 541b9e726015083795307a2a7f9353bc929bf4e72b6c295303c32607aeacfa3c
MD5 f9045198feea7543748df83b49e77fe1
BLAKE2b-256 9a6c817fa53358c84d966dc45f1cee859d626f760f9eb0ec241d8d3eb789eeee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 1ab15a18f1cea2543fc45f79d2f81767b9e6a489818694fb397c54cb92ab1a97
MD5 18049269831479d0b2f0afbf306135c6
BLAKE2b-256 cbbaed48a00ea31e808c39b5c2fd35d4e010f8144c77f21652d3931213afce32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 0a4fa61b35d94fc031e29848a84a4c7f88ab4128a1d02b396cb2d3eaca17de13
MD5 6e299930c83265fbc00da3bbb2b3fe5c
BLAKE2b-256 1f4ebbb15ff31736db7dee779f9ce03ce9a4b98e8fd88e3116ac41826f15d575

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b700de615385931574a5df4a71b14b9d1aef8d1f1469533fe2c18a56ede72e6b
MD5 aafd72dbd87d6846f01e3c3554b5e1e9
BLAKE2b-256 18c82a5b3ca72c5f878c1ccb28aea1848af4862503aa0f7e466ea60fa0242204

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5246e1551d54bf068e4aef4ceb2095460fdf262a620da45815885129f786b1d6
MD5 1bccbed05112e4e38ca5fc6cc14e9155
BLAKE2b-256 f2e9dd0d10d99943b2a09faee7fe7e14eb00e96adb5f59b17721f4805d7ccbcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 69f6807e212437974bcaac473aa121f38e4033c9b1d4f6d16e4c296972fc46d2
MD5 0102b0abf1f0a1adacd7a59fe0a32245
BLAKE2b-256 ebf3fbcdd6a955bd15dc00c566ef1aacc4c4919be31c373267226b40c0dd2424

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6425bf8619edf2cde585eb8cff85c0fbfaa201ef1c6188b681a1f849c1fe14e2
MD5 84ec43e946991cb64abd6d89c6054bf5
BLAKE2b-256 140eadb1da2cc9c62653fc8cb39568abb30bc50f57621f8cdaa48016e70552b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a8a1ea95a0dd6e0b3b0f0aac4c2fcbfde74b4cd30e5de1eb389d1e1f1517b6ee
MD5 b68264418abaeff780eda0adbf659d93
BLAKE2b-256 cec1302a5f7c9b282319a76f90dd6fc82eb587c819b43a653049f05b4ff7d95b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 92cc24024628da548babf63382f28d8ba38dad899fba6ffd101e795eb890943e
MD5 f66fc6bfe433b1c2bcc177aef6f8bc92
BLAKE2b-256 a12ed7f1814ced259a3654c383739f17270ade297a450c7f8f62da8747cf87c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 1f8082678bf09ce8f04929cffd1c76010d779e96c01d91cb2a3af85abaf19ff3
MD5 c3df33e5cc0ffbe15e89d844b82f80ab
BLAKE2b-256 4bd36d210d34dadabd1443fe19aca82f5968bd49d68404bd3f0bd3f482c4db5b

See more details on using hashes here.

File details

Details for the file rjsonnet-0.4.6-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.6-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ed37b599d070f273a930cd8f784d17a97a103ed9dd7ccb8c9a468226f82d27b6
MD5 a6517eb323c794b9881da46842cd4fdd
BLAKE2b-256 0c51dca1d61896cd9fbe8bc4ae1885f0186b8fcb44e847f58a1fe59fa500ecff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.6-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4a5f746701c9527a009cc4da847b404c8adfbbae04749a56c5ac57be2ee07030
MD5 f98bd992fe8bdd80fdb471e70cf68bad
BLAKE2b-256 3cd022032cd5ec58142c157fb421d1dc2a8fbefd342aa0f05424debf5ad39707

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