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

Uploaded Source

Built Distributions

rjsonnet-0.5.1-cp37-abi3-win_amd64.whl (888.9 kB view details)

Uploaded CPython 3.7+ Windows x86-64

rjsonnet-0.5.1-cp37-abi3-win32.whl (823.0 kB view details)

Uploaded CPython 3.7+ Windows x86

rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_x86_64.whl (2.3 MB view details)

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

rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_i686.whl (2.4 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_armv7l.whl (2.2 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

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

rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.6 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.0 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

rjsonnet-0.5.1-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (2.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

rjsonnet-0.5.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.2 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.5.1-cp37-abi3-macosx_10_7_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for rjsonnet-0.5.1.tar.gz
Algorithm Hash digest
SHA256 668eef4cd56dc8852690af8e972ac91fb3a9f254175aa3c05af3288923618583
MD5 7f013831421a57a80ada0aa22a5b6b39
BLAKE2b-256 02766d87e2593fe925077f2ef9834e07b10ae11a2106186733be318b95c163f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.5.1-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 888.9 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.5.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fc4895ce8329ddc147186b6d1736427a5563774e0e5f66c368c7d20fdae4ef99
MD5 839482eea10f926b5db9001c0888e085
BLAKE2b-256 d36f2b25320076c46363be57a2beb138719116fbac9affa3f94e54166d5e4268

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.5.1-cp37-abi3-win32.whl
  • Upload date:
  • Size: 823.0 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.5.1-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 f138574e19fa0fd0761025905f0585b03ddf6fc95e32805b7ce8dc336483c5d7
MD5 d23370dae015b5cb16fcfd41d89e5806
BLAKE2b-256 05e6d02d207b5b9169cf44e5005b2099ecc593cd8564e80fa8a3b415d385f251

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bee0bdd7ed1932c0d5496e382da90124cd4bcb79228e6eb153bfd0a28244210b
MD5 44b8bb98fa29c5ae7c02e587d7f7d15f
BLAKE2b-256 bfc51a56141482739a8bbef09e7819c5ad1d4eaae32df6bb8fefa45aae96df41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 0386f1b3dc72dc21da8acaec5c1e3bfe04e6fbb7017f6486843ca154fda0fc64
MD5 35baeb4e4226bac53ca6894a0572235a
BLAKE2b-256 3166be4a456aadea3e293912982b9c48d9dc193e236c8f9ead3a8a3b88a6523d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 08de42a8a0573ecdfbd0bd62d793f310bfdf5e8c2f375ac434c556135079c044
MD5 c0335a0403940b12805014524b8e38fa
BLAKE2b-256 e279db9e1a6e2001f6035e9ea06373f980645ef9d61c8726ca78d487a7e40dff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 dc60f92e94bc0309c9f624679d90259d14ed68ee5d2003e24302663733445a4c
MD5 0fad0d5d5ad4db42825ce27bd7ab4387
BLAKE2b-256 b6232e24ae81b0380284aae7570a9679ca4f06c8d43dc3131a633bc8d3cabc50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 709d3425b73e6f6ab8a540aed4538f6a0fdd04cbbf7248e008e84649502fbf1d
MD5 4d1f6a0a1d44ba9cfcaafd7b89110183
BLAKE2b-256 cd5e48bfc43d6d7e55ed3cb45ab92d2d8e53806b0eb98c19ce7fc292cd8b6558

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 6913df2993354aafe361dc4dc284feef189f372eee17080d308f1dc29b3f4979
MD5 53e0741521484a4a05fce3fb7f34f68f
BLAKE2b-256 49b0ec139b23f100aa302066440590c5be07413f34d535e5ed0e6c4a7e244a97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 e1fb4d4a9a530c7183386afaf65166fd41fff282d4f7e19f69760bd364ae71c2
MD5 74e0fbd99b366e97e7426d28cd725387
BLAKE2b-256 1d5e5169dfde52887d12037e005e82266e1f1ae1c12388ea1dd88fcfe9ae511f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 304ddedbb4a8ba5eb94b2f4533bc19dc2ec9bf94c4df7aea3c3b4dc9ae269222
MD5 9a1863c4413d6bec8769a0aee1aaf850
BLAKE2b-256 19cbc84aef106f6667d1f82bd21e45beb3e2cd8d9cb8abd2b43d144951c09a51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0a0cb5a547b9dccb61de6358cfd9f3297e75b9222b00ebea43d1087d295c00cc
MD5 f8ea8494472825064c4bd4ab45f6a1c6
BLAKE2b-256 082d9b62b8feec6bfe62e8a39600442ba2ce6b8d8ae4a5866fb0ff431865ce9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 0ac64c8d97d74da9c08c608ce91d6cc12b009d4c0031f62de04f264616c38410
MD5 701d24757faad0c25526d4d063ec6720
BLAKE2b-256 731b457c20fca01b2d7b16bc1c380023e24854d71974ede775ee1f9fb482be6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 733a5d82a8080b24029c9d478d958c84ea3c3dd7910804dde7d5b7398bf1aa0e
MD5 e37967ce43fcc54f0ecb685cb29b4b2c
BLAKE2b-256 77d505c3cdcffdd76c098af6cefe3d0d46b88b8ea36070a677d3b4105da16883

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.1-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4458631b930a56beefe9baca64dc9ab1cbf50276ec18c4fe629bd9c11f4fd394
MD5 fbd98f80ac8321ea3098fa97c7d20817
BLAKE2b-256 4d60a41069da537aa7a22bc47d89adad2df3f3a28cb09818a4e5dfbc9f6a5766

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