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

Uploaded Source

Built Distributions

rjsonnet-0.3.1-cp36-abi3-win_amd64.whl (520.8 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.3.1-cp36-abi3-win32.whl (492.6 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.3.1-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.3.1-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.3.1-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.3.1-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.3.1-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.3.1-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.3.1-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.3.1-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.3.1-cp36-abi3-macosx_10_7_x86_64.whl (641.1 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.3.1.tar.gz
  • Upload date:
  • Size: 7.3 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.3.1.tar.gz
Algorithm Hash digest
SHA256 44878762487298df93439fb980ebff66b7ce839cf62504992ea246a96428e040
MD5 7b62303c37780001a69fdd274e3ebb41
BLAKE2b-256 619d419c62cc09d6589fc0af69d4c86ffb0338b3b4013ff2375a12893b63a56a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.3.1-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 520.8 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.3.1-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8fc711c08d7b54b406bbfbe993f76def114ee50177f89fdac860255fd7db4bd4
MD5 735fecc25b40c680694311a774dbcdfb
BLAKE2b-256 d165dda1b2fb03001c082c0e489c8250e42669df3668a170103424e0ea7148b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.3.1-cp36-abi3-win32.whl
  • Upload date:
  • Size: 492.6 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.3.1-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 212b3be59a202d290264361550d01fe38f2d24865661581a4f29669257c3366d
MD5 b336784b7360978f6cbd6aaba9325659
BLAKE2b-256 6d0808815583ec912e4cb48fc109ef8ceda2f8c9a0d088bbd0d783ff558811fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.3.1-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 0aaf259fdc1049337cd096eae5625f6e2f2482bb8291ef0c6b5fea1e464a9247
MD5 b3a6877c4e9680d02814c02d87ef228d
BLAKE2b-256 f78129f932e784fdb60cd51a6ca2e11176a878aa0b4c45dc46a491f8810ed3a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.3.1-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b60ce1f18a8aeb7c66cc874354188efb9576e4d0295a88b7a4f184aae8a44119
MD5 e974886b2006225b1b23fb53f6d976f2
BLAKE2b-256 41438aceb7de8b70650dd9adf669407692a0725d6cb6039df331497e403ba3ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.3.1-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 c65d28c301db55637b1869c4ea6a005a3ae9191e6aab5ad825a3f2bddadd0b82
MD5 822b1f5ef034133d1d7edb0965c636a5
BLAKE2b-256 c73d9dd9ff5ccc291abc1b3899f702c3d485d1e472ec90a2d8f01fc460eb110c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.3.1-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 bf35f637159c1e370eb86e226300389a4ef62568286d21d4cfa73d62c2cca027
MD5 106a62d144594421c4b66e45122525ea
BLAKE2b-256 b37c02d623db8b85bff5a1273377dd23d9dd5b3044579a27a4435f9e019a79fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.3.1-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2ae193de4e3e307c9064221c36bdf861323bea98715a3cc7178e9d08bccce23c
MD5 d17160e84ac3f5f9f88f957d96c990aa
BLAKE2b-256 b0f61db764c543954e15f811972ec35199e15e733178029baa4a189ab52b8fb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.3.1-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4cf568bfe8f9196808b845b9d3e539a5e0d5a513a57a4c4516affde96c0c0b2e
MD5 a23e37eb72d92509e3240ee690901bb7
BLAKE2b-256 27001c94cbb4cf4ba0be18b8f720cf1792fefb6b29834b8529ecd96d9a2f68a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.3.1-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.3.1-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 a38164992a7d7fb7077af98341b7fe7c7a22029ec086c269c0dbcf67b4cf9453
MD5 50d252537eecf7ef77a6f53197402f4d
BLAKE2b-256 4bde36c42b89ca830599c755821056b1587ca5bee303e564f2fae3c1c3eb79c4

See more details on using hashes here.

File details

Details for the file rjsonnet-0.3.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for rjsonnet-0.3.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d0d96e60402b4a109fc33a01c00f2081c82cb8581eef55a0764a117981ce2c69
MD5 5c5b03a1710976cb4f4d4865b5003bcd
BLAKE2b-256 24f814a541318279b139255d777b4631ae884eef139578e4a446dbb2a8fa39fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.3.1-cp36-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 641.1 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.3.1-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 e323a74cfb7dc859966178a4b79c17febe191291a1f2bfd43cb204442053ef8e
MD5 341e0de753921a859e92b8d609c5755d
BLAKE2b-256 ec54d3d75a90a08efa08081f8796573d9c4b4fdd1de0ff47553592fdcc6c70fa

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