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

Uploaded Source

Built Distributions

rjsonnet-0.4.1-cp36-abi3-win_amd64.whl (536.0 kB view details)

Uploaded CPython 3.6+ Windows x86-64

rjsonnet-0.4.1-cp36-abi3-win32.whl (500.3 kB view details)

Uploaded CPython 3.6+ Windows x86

rjsonnet-0.4.1-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.8 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ s390x

rjsonnet-0.4.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.4.1-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.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.4.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.4.1-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.1-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.5 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.5+ i686

rjsonnet-0.4.1-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.1-cp36-abi3-macosx_10_7_x86_64.whl (664.4 kB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.4.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a66d32e11fe658eb624f3ec15812043bf9b8ae346fc3920785f4310df8ae4fa2
MD5 425dd35ac813efc800ed74542a33fd64
BLAKE2b-256 13ee7bc80b99b693f01155d92866c29094a9c0486fe1d7403d7d88eb2621028d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.1-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 536.0 kB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0f3ec24a2fb47ba609b1b296b82e7dcd98f1a4760e04e7d521c800556d1aaf77
MD5 d693ed949612ed23b129673b3676684c
BLAKE2b-256 da42e2623b02c4c16baaf6cd60d49a5363b591375620952801de6dedf44e523f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.1-cp36-abi3-win32.whl
  • Upload date:
  • Size: 500.3 kB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 f478aabe803ecb06fb94cd5c1c46e2e9458908bd498085101a4dfd0e47e30f50
MD5 ac44c23d824fbe30de1651e9c8dee546
BLAKE2b-256 dbf7065dde3eb39e49a6d5958c5048c07a089444ae0b80d3843644baf65b283d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 9963e7292ee7c43986715d37ea76045fd5edf56aa0f5bcfeadb80a444f147276
MD5 5a562fb76857beb23946de119eea122e
BLAKE2b-256 0d8775e1b8a4e53214483e64b775638f9a5876f273e5983c94a4c4143d318547

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 8ec8f7168bad4eb563a5f83be56eaee72a2a132166816e84a0681a0ebad2bc8e
MD5 ddf798f3e6810a183217a5491fe9cfa2
BLAKE2b-256 5a6df49620f15eb74706bcb39034f19d2f7386b3dda1064d5fa4d6e14db657a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 b38a5b788f3d159e60868539ad52383d6e33aa32cceb2a69bd6f9275d0c11988
MD5 dcc16d6681cfbb96c79f993cada9b5fc
BLAKE2b-256 f5a76226463e1d813a133a1f0eb572c92143998928f4bef9ea5d980d1ec2508a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c8cfc152643b3fabbaf0b9c03dc73838810244b6f7ae5e460632924faff202b1
MD5 84c02e821ada40b655abb4a457d0bcb8
BLAKE2b-256 bec49bd79aec5688999150add2543748bf8351717e5c6afb648f4bdbb64b05d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e01b528dd632e8deadaa7a5dc4a70afe70bfd753fa5d3e94ae5be05dff953596
MD5 55b42f92cbcaa51143585c3310a2bea4
BLAKE2b-256 d781a368103fd373e0eb103b168ad42e66d0ae6cea86b145a5ab9746ee5d4cff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 aa511a7098c5d59d61bd165737817a7b282e5b711ff95ff7a5d28cdcb78678db
MD5 5f1ae8c129ee94b5de82588178979ce6
BLAKE2b-256 bcd0d5a778430e94a9a336f572e456f50a66b9fa80a8b7f689dfa67ccb67ea41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.1-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
  • Upload date:
  • Size: 1.5 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.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 46e922ee296762ca4bba5b91401a7aaf3469501640460dde04b0f416e423d158
MD5 0f5f103aea209b1f768464e0d27b47bc
BLAKE2b-256 d477f88f57962edd00aca4b62a089532a4e27f9b0bd087ad83a37f39ecc794eb

See more details on using hashes here.

File details

Details for the file rjsonnet-0.4.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.4.1-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ace81f01211aa0e688e9d3a7b0c106542745eb5901836b6f8ba7d2870ead7f38
MD5 f2bfef4e6bf8a1a5455cdfd909b9fbb2
BLAKE2b-256 7ab104095cb76f26d5923c12ed5e2e5a3db093dfada124ef422131e017928994

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rjsonnet-0.4.1-cp36-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 664.4 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.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for rjsonnet-0.4.1-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 180ef090cd27eb985cf5c77580a197c32368ff785da49ea959b602d03ce1cc22
MD5 f753bfb3028447f5461d557bfbf12889
BLAKE2b-256 ee1fd95db3fe4f42eca390ab92ac03fa517e2d3fb58b71de5b0287ac52898145

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