Skip to main content

Python bindings to Rust jrsonnet crate

Project description

rjsonnet-py

CI PyPI

Python bindings to Rust jrsonnet crate

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_callback 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.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distributions

rjsonnet-0.2.0-cp36-abi3-win_amd64.whl (505.3 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.2.0-cp36-abi3-win32.whl (480.4 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.2.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-cp36-abi3-macosx_10_7_x86_64.whl (629.6 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.2.0.tar.gz
  • Upload date:
  • Size: 6.9 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.0.tar.gz
Algorithm Hash digest
SHA256 e4acb4c7da1f4208b6465603e3bf71fc49f3305b92ebb991db3d5db8977848be
MD5 b57ba3239296c477b0ca2748ad66829d
BLAKE2b-256 fd5fea73f21495b5244713002bcd80412e5f3c62ae7ad0dffe300bebcbc42ead

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.0-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 505.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.0-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 467cf4ef5ee38d2a4b5cb34e33c29ffdf309427e11a3c2d6930aa2a2f80c1a6a
MD5 22e03d01149f2526681d008a766693a9
BLAKE2b-256 f91f3253fe94dbc691185182f321fe3f8601232081728a7cb8b040411de96f7e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.0-cp36-abi3-win32.whl
  • Upload date:
  • Size: 480.4 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.0-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 e51439090333b5f8447f589ec4e80ae3309f2bdbd48d13fc78215eb63b7db964
MD5 5d569c16e0bed3321b3da8b09b79c9b0
BLAKE2b-256 b3edb55cc4895673ee43d79b4b8747a518ba7c0bbd8d3c15390655f52af8bd82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.0-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 e650e83541e6a3f5685ca21baf7140fb770cac7fee1d71eaed57a7b32fb4689d
MD5 3cc390488fc37c42847331cd0c2ca843
BLAKE2b-256 33cd04489073720728837a5eb3d9d0595137f5c5c5afbb235588738ba1310eec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.0-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 4ef739eb794f561f998d3768b73d0857aecfbb9a79c42fc7e2d0db814a5eb84a
MD5 0a896f25c644f23644267b4e821faef0
BLAKE2b-256 8d59d489850f19d180bde4db5a1903dcd4dababa47880dcaf3fda1deff77b41f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.0-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 e8841294522b2dff5e3c722326def5b876538a834040476e81242d83178ea517
MD5 d706a69b55dfb51d39fe8c4845df7c6e
BLAKE2b-256 babcf7c58d911da9a6a534ffc5499d7ec67eec691860a3e4b80eed4d0caed1f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.0-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 8a8413447e255c230cb0fe911872d0354318571fddd8eb6f8f7bbe50bc7e5bb4
MD5 7d69e5530ed488e71a5d4ff1627026d8
BLAKE2b-256 8412c07e721e3e80d30492356246fb8f0754a20b9f958f2e60d1a652d89e2f80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 468363694bb9ba6bb1065308f40e528912f9c8e82f96ebfd5a2e50aa8e4a46f6
MD5 2aebe607beb4ca56c03a8fa93afad72f
BLAKE2b-256 eb80b0c0b79c9e4d4abee14d66af1983e69cd59e1315baf57057e7b1bc182596

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.2.0-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 35f36abe46ad7e89777bbbdb67d8b34137fa1a34aa3facd5276f7b9a9c5b58e6
MD5 c4cd557be17cb0cc6f5a6eb8014e7cb7
BLAKE2b-256 e7e5bf6146604a2707abf03f5d98792ca3ee1e70938caf0d3f1592a8359f03e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.0-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.0-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 f2c83f0a81a5b1885b61b6c7a40fe0dbb2ccdac392244984085e2e4f9e727650
MD5 46ad51f3b5f8fd891c6486cb442261b5
BLAKE2b-256 333fb0ff6a8978a60f62fe9b93aef85ae1a213fca9bf8af012022712e275894b

See more details on using hashes here.

File details

Details for the file rjsonnet-0.2.0-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.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 393557965b9eb3eb3c5f6517f4da6738376f4bb67b354636380235d69a734b7a
MD5 9f0f7f72fdaf1f9fbd5e35e740612d6e
BLAKE2b-256 ea3fff58d24c59491997d28ed8cf2f1c7884a9bd493b67b156bb89efd04463e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.2.0-cp36-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 629.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.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.0-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 7f5b16df59014549bf92b62fded85307135e4ef889e96c552710ea6861f21f29
MD5 3a2e9a50b0d3d56d39d93769ef786a1d
BLAKE2b-256 403956cc1fae54df6a29bc003cd8006993ff88c38e2bf09845fade9859bcff98

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