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

Uploaded Source

Built Distributions

rjsonnet-0.4.2-cp36-abi3-win_amd64.whl (536.3 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.4.2-cp36-abi3-win32.whl (501.2 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.4.2-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.2-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.2-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.2-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.2-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.4.2-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.2-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.2-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.2-cp36-abi3-macosx_10_7_x86_64.whl (663.6 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.4.2.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.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.2.tar.gz
Algorithm Hash digest
SHA256 4f983c7bd030afa0af82126f1378034aa1d22c7af695db389587a215c2e84314
MD5 a57aedb203d8cd526fa6be6fdd7866db
BLAKE2b-256 c5342e220b3e617aa44cec233b69c049bd9cd1b976f64d143454218c46b3219e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.2-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 536.3 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.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4e48439db19e1c42bf44fec32b2a08fe80ff7f2c6ce77395df28bf74f833fdbc
MD5 9f37fbbc40f8a5562af00c8d0a0ece10
BLAKE2b-256 fa2d7c13c1991b08c7efdf0e367198e67fc0a05aa7a066926a6d42fd2aeed376

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.2-cp36-abi3-win32.whl
  • Upload date:
  • Size: 501.2 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.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 5010cc95f540ec0eed9caf63ce24ca7d7eb5464aa81d7ad690a470e54f578628
MD5 8f4a1411012f7aab4fb3c8bf5b731c1c
BLAKE2b-256 de996fc91943707f670523b4c0722ae4895ac24ccd5dbcfede94d28f66916133

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 ed2dc9de26e3518825c18c75d6107f48d53375826de0e235f36407b7e29a53bd
MD5 d1fd2f1d241aae0d87079893bafce498
BLAKE2b-256 94cf304cd6b6929a34a5fe3f2f44105c01a11ca62d017fe94c920500e6ebb29d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b9b4fedd99d2b74ab1971b1bc8f8402ac6825478c44163dc9a06b2f6daa3d709
MD5 b9bdda87d57be344225a80a4cc274b25
BLAKE2b-256 a552ccd6dfaebc7283aba32587e534690b34fb5e1d0faad34620386b1201b25a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 ad906c9c931ade94478c99ace9ed70cee91293e9b5981bc968edeb66f5fc67a8
MD5 474a896576aa745a158ffb9fa1b7f094
BLAKE2b-256 0755e8645fe6577affa358f849ee234804eaa24f5bf9865e0251c43a6b735193

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 5839d1085632aa56e1f40277e006130b6f1026ada7bfdea2cfedd49648e7e8ee
MD5 53cca956428597ecb8bf13d84e02ec10
BLAKE2b-256 01bd1cd62a0c5cb22eaac8ecb2f8c939f9721951c1b3fe266193b6e48fa163a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 606fe2c977bce61bf7d077213f56deb3ecf9ec1d1fc9f55b5f35864727f73a5a
MD5 23d330e446d9ec0f1a703ad1c577048d
BLAKE2b-256 547d3fdccfcd8eaff60c2dfa53c15b7c7a2a0dcf04a47bf37c41fc09f2d11e75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 887580871e4a935b74c5920e1e4bf903179e08095177cd36250a897f11227804
MD5 08a1304c826059f0e129498932ff74d4
BLAKE2b-256 eb76816b3c413affa4d623d2f8de349495bf848934c7b3612f3a7386d5fde1ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.2-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.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 fa0f3a501719005b85ea3aa372ad58ce1f0dc0fef977daf591699b05bb8fddd7
MD5 540b1b0b45d459789ab41510b1d6ecfe
BLAKE2b-256 d23f721df6c5043a1c3e7b634a6f00df307f74bc0902aee6777fc8bb0762ea6c

See more details on using hashes here.

File details

Details for the file rjsonnet-0.4.2-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.2-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f23298c2c435c705d3342ee061a973b8157c91f5b2b73182167f86e5d85e96f9
MD5 d4d224df5db3a7282f0abccc4a4638b0
BLAKE2b-256 9eb98d1a59b3d4d99c44c98c95e6a7162610eebd980f750c20b4402f7622386f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.2-cp36-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 663.6 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.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.2-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 354df8583b5d7f55f88cc28b444f851f8448ac0f5c8ddfe643a4fa8d5e4c52fb
MD5 194d6fc66b4e2518aabe2d185709b1ea
BLAKE2b-256 383ae066cc64c3d03abbfde51403ca2cffc4ee8f2fe6e7c5b8787da8f9e61856

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