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/)
  • preserve_order (bool, preserve object field order during manifestification)

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

Uploaded Source

Built Distributions

rjsonnet-0.5.4-cp37-abi3-win_amd64.whl (946.1 kB view details)

Uploaded CPython 3.7+ Windows x86-64

rjsonnet-0.5.4-cp37-abi3-win32.whl (876.0 kB view details)

Uploaded CPython 3.7+ Windows x86

rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_x86_64.whl (1.4 MB view details)

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

rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_i686.whl (1.4 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_armv7l.whl (1.5 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

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

rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.5 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

rjsonnet-0.5.4-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

rjsonnet-0.5.4-cp37-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

rjsonnet-0.5.4-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.2 MB view details)

Uploaded CPython 3.7+ macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: rjsonnet-0.5.4.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for rjsonnet-0.5.4.tar.gz
Algorithm Hash digest
SHA256 4e32a8fff9400a9c7df8d8595f2986e86e5bac3544a8eeb70c2630bb16839df6
MD5 55b827afcc8fc7b92bf223b348fb6027
BLAKE2b-256 be2b032add65f9ad3721c32c226569adcac614cd72324eda4df0e392e5df888a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.5.4-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 946.1 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c28f8405e1a9226ba5c03b0802cf3357cb7ac97ef90417fb2f337671a023d3ce
MD5 34e941a8918d04d220e0e632f12be14a
BLAKE2b-256 070c5eb912aab5d5f4c52e1574e7cc91ff816d97bc69cf6f0038754c697fbbf5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.5.4-cp37-abi3-win32.whl
  • Upload date:
  • Size: 876.0 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 e8449c8d3636f571854a158c6f6e1308a6e3adfab393f265e0f91950fd9fcd9b
MD5 66892a8d9c196a6417569cf0d9387113
BLAKE2b-256 6b4f31d4dddf6a5ccdf8ae437a8fe57c31e511b76cae55366ca2dc41a0f1d8db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b71a0d25380b58c5e0bab0d98afdba19c7351fa7d2f5729b90d7e41759f3f4ae
MD5 802bd664b5bef020cff1528d948bb765
BLAKE2b-256 10f9a5cdd23f9a7c4f3112d46a0d01c233d402fbe558d098ce104ca47dedb8f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 58b8e058f103010debedc2ded3f957abf63942d08c82c2af69ad736cc28836d5
MD5 bfd8fb155f843d59742b1c295e8cbd79
BLAKE2b-256 03b9e87f675060dfc7c7c13d97db8fa3773ae4604db8a508b1923bef25e25228

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 5044a082187f4172b7df36fa51c15ea87431dcd67260e1b8b8356684698c310e
MD5 4c2e7ffce528da8eb07a400e6064e6e1
BLAKE2b-256 efc6b1899174533ab02b659caf003c1fea181abaa710dfa6640506b4f6f33eb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 1f4af448bf566880d9072eff10171c34374cdce104046fba601532ad11605f44
MD5 833261c03df5322c3a61e564c730a066
BLAKE2b-256 2a7173c27d7fd39f19a53fd08b9ec9c151277b7644a5d4642372ff037733fcd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c8d59ad043680b9984ae0328a64b63348f7ff366d1c439117d2c61e2c15c1869
MD5 3fee929da4a622f2a905706a9498599b
BLAKE2b-256 c6c6b3a20956c44592bb36e40f72a86289b9776acc39327dc34dbf67039e6bb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 044062aeb90bfc1e205e76d1312c010f4ef02ffed0c7e2a7bb0e78388e676c90
MD5 cca6fe7167d2f92c4fca683239342116
BLAKE2b-256 bba26bc10426124438ddbb5ff419baa78b0d88d134d35f0aa46e33e0b51d97fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 e47beb353e4300d67f90803845e83be392346ece0b398dccd15b7576ee1c38db
MD5 457430f0a0c80403ed34ecbb61405660
BLAKE2b-256 995b2875ec366f7b01e970c40dc6a38cb312af94365b10577b12859fa3dd4177

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a8a2e51d319919eb480407fa98a098bec337035d9786c19b03a2b60735433a0e
MD5 8575b2f2382e4637f03c84bd8f2c8bd1
BLAKE2b-256 a2db25011c655f4dad626ee2c5a34247de39c1fdba2e59495b010ee8bed8effd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a0eb4ab241206829955108c44d810342f1c19f447a4d7c44a49374e96770c08b
MD5 426d9bc4c63fc67cb8352e32b4fe8540
BLAKE2b-256 e5fd6bc471ebb733a3b58740d6d872a227928021e65a4a50da7aee672c5ed248

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 10671a6b58a81da38cb9ae123fb0f9d0c444abdc2d82840465fd72ab09599cbf
MD5 4c278c750316e55bc1904d6b63da8147
BLAKE2b-256 441187411b6283222ada833b3a60dc51490a334a5dcc9a7bdb53f4d9d4db2a80

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.4-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 97f55f4eb611aaa05f73eb93f318e5d15a7838849be0044adbba0c5bacc575e7
MD5 1ac207da192f0eab3ca8efafadcfdd1e
BLAKE2b-256 e996f750e6fb32f867067b6955640849fc2dca6a2cccdd7758cafd9266be8de9

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.4-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.4-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 fca45e06abbabf4c6b1f8ec9821e5be355687cbb1e73fbad5ce68c94a66a2154
MD5 c58e49e0328ec9f953e27462b8963248
BLAKE2b-256 945e3a96707946467ed761cc3b33839ba96285df80f3cc18783b536a4f1a9c66

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