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

Uploaded Source

Built Distributions

rjsonnet-0.4.0-cp36-abi3-win_amd64.whl (521.0 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.4.0-cp36-abi3-win32.whl (494.5 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.4.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.4.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.4.0-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.0-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.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.4.0-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.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.4.0-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.0-cp36-abi3-macosx_10_7_x86_64.whl (646.5 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.4.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.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.4.0.tar.gz
Algorithm Hash digest
SHA256 b43c0e0d98e9eb65eefcf5b1fe114fd4a36ae6dff3705e950974be9d18bc7d54
MD5 4214fe36f23524494a926458c9399875
BLAKE2b-256 d2e0bec1cbcd548a2cf80c5d4830a877707af07274e1d0aa1e1b3f6a9a1592af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.0-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 521.0 kB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.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.4.0-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a3914b8c0f9241a3c9ebd60ba3fa65c7a26c2bea4bb21c9f65282f10b16bf2ef
MD5 f6fe7dfd52a2fdee582265f5c589d2f0
BLAKE2b-256 893a9f3aa03596bc68fbc4df12c122da42f238f28e2bb40a99798440c0c1fd56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.0-cp36-abi3-win32.whl
  • Upload date:
  • Size: 494.5 kB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.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.4.0-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 5f6a911e2e2cf641cb897aa97084112e4271cc839437745e0256a3d4a9dae72d
MD5 049ba83a767fdcf2b8e00121c8aeb79d
BLAKE2b-256 0867f5a17963497ac59bf445accd8c29a7b537ae4e589145b47ba676c1f039f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.0-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 501f13f725e08807ecf0837ac12266c0c9eb00c4186c4260fd096815956833ad
MD5 e08654e335c0eb37650dca80ccc7459b
BLAKE2b-256 bb668f8a8d04dcc48926b1d1bf62a6ec27a2ec38a563a47343e717d580a2f8ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.0-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 45428e26239b99cd3a537887c3c358d0ef983ce4929c5a390a41876fe86d1f07
MD5 b4670031443acc2a8843104914e78913
BLAKE2b-256 abae38c1f06e8b76b3e15fef7ed576913919e313acecd2c90bba3e0aa748c5b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.0-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 46a0752e48636bc52e53c49e13f8ccf2682a7b3d8e29b5444933f7ad25d75246
MD5 584ab7300a679c700c9a141d8c4c10c3
BLAKE2b-256 3edd375b2f0c1963ae94bcaa8621804da3d83f0cb4fc92b213c2ca38f52fc0e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.0-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 4f5a27d652e7a841779ab420af3fa8970835d3d59696ef88cc57f06e9a729075
MD5 c97c1444a23e2a407699b900de601cd9
BLAKE2b-256 b55798edd6bd01d76542888666282e87dcc7cd260c9db58f6dc5b0b6b7ded048

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 02183acbf4903a575d40ef8bce68e7e6df3d5c902c8da5f633aec85aa3e8f739
MD5 96617edefe78a5909db0ea4d583f0bfc
BLAKE2b-256 08937276f88955cccf03fc1f2111fb2a3e9fafd4dd87c3e1f11dde887992aa8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.0-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0ead4bd2772faf8705ba11de49243378e0284be8d7a4ee4f2e32b15a158420aa
MD5 76e7c027d67a17fd6f429991a2e3efdc
BLAKE2b-256 3b2bfd3bd658628d186182aec871318a8eabc69ac643d902e6b52b88d299b0d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.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.6.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.4.0-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 d11243a8b56d7a1e60461f79deef3917091991fb420ee560ddb488613364cfaa
MD5 79cc933464d87df60b95221f845b91b2
BLAKE2b-256 76eba1909df4b6ac996599bedd32826b7a7eaee156387808216f554b7a347f89

See more details on using hashes here.

File details

Details for the file rjsonnet-0.4.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.4.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 19a8911bbd7cd1ac2ce7cfa14895f1460d59b4e5e60bb9f96e9619cbbb8482ce
MD5 78828db1908c1e053abd1526ebccac6c
BLAKE2b-256 7e0a570ce24daa6e0bbfb1badb124078c1112155e7c7e4abf36b7dd2ea79ba93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.0-cp36-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 646.5 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.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.4.0-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4acdbc1fff400fb3e9d9cc29e2b888417adf71fd2cd9e320a05a272ca8e54e03
MD5 47113e90588e1b8e43fae4e122b3b519
BLAKE2b-256 1fbef777a0fbe66ad650181059a106052af51730dc36e1363dc58db28203e8da

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