Python bindings to Rust jrsonnet crate
Project description
rjsonnet-py
Python bindings to Rust jrsonnet crates (Rust implementation of Jsonnet language).
Installation
pip install rjsonnet
Usage
This module provides two functions:
def evaluate_file(filename: str) -> str: ...
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file rjsonnet-0.3.2.tar.gz
.
File metadata
- Download URL: rjsonnet-0.3.2.tar.gz
- Upload date:
- Size: 7.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6633aba371c4e0d536a9e953bcc4b004f185b00da99195601ed27ff031b95dd2 |
|
MD5 | 18a76913cc450889d34f5a0fd97b6f46 |
|
BLAKE2b-256 | 56267730d765a5078e8dfb974527f9d3fc7bc3c2c0b0e019508c5281e3019fbe |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-win_amd64.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-win_amd64.whl
- Upload date:
- Size: 519.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d82e154293abb11e98798d87c93fc08c81f8fe071863babef3579c769d83f909 |
|
MD5 | 048646c66628c531528641ada478e80c |
|
BLAKE2b-256 | 184d049b02e4278ecfaa2e535b80710bdd3e71d50b064abe2d833266853d2ae7 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-win32.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-win32.whl
- Upload date:
- Size: 493.4 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ebf752327744e217f4b3214b8ada2d8a23a4c0ad54a32447c4a7d2361e78a3b |
|
MD5 | 7158f39b6637c72e29de1141e44909bc |
|
BLAKE2b-256 | ab6398dd2172f9a0515b5676fd0becff79ec31bff47d16aee64b13200b8edea0 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.6+, manylinux: glibc 2.17+ s390x
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30b142604458ad04ba6d9d2ee00ecbed0a95a96dff5daf9287bb4b7d408091fd |
|
MD5 | 0f78a230439fecd5b8b2c9801fa3fc8a |
|
BLAKE2b-256 | e1f3b10c5783e88c940b33c77aca659f4f5a714b78dd6eb1768aa8a2b5f28361 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.6+, manylinux: glibc 2.17+ ppc64le
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6064b00209ffd86825c169472f4bc99199cdee163ba0fd19ccf95fc7af54b4b0 |
|
MD5 | 57dd819578cccac1d2ae0dabdf13b6e6 |
|
BLAKE2b-256 | dde0510276b4ca0bb0b95d37b3526298e70323fe567c91a80dcd1bce04e21747 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.6+, manylinux: glibc 2.17+ ppc64
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07832fad54a01a8c3c5103f4a4b42e3f9b743d957b2375db730a6f32c5cc92b1 |
|
MD5 | aa55a2410f011feffce999207f21aae6 |
|
BLAKE2b-256 | d4a073fc4e1778b011ca94e2bb5f403c5540444c33e1b3174ea36e2503346297 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.6+, manylinux: glibc 2.17+ ARMv7l
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e896505934f436fbce5f764e610b8140fd5ec3cdbfc34eba660b4cbd7c67715c |
|
MD5 | 1918974ff511f6a5e48a6380e5a34d33 |
|
BLAKE2b-256 | cf9032a26eae5a1d725c70def92cd4282f8b589d0cfc1c964ccc1c4bfb5c9b0e |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.6+, manylinux: glibc 2.17+ ARM64
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3725aca1619021d6441d04b843282df8fa103469f9dbd2db158921496fd344b |
|
MD5 | dd2c637008e4a56151ee844db6968d33 |
|
BLAKE2b-256 | 973b44efc3bd0cef62680d0f3197f9d6a05136ba9cfbf3ec648ab34d21a16366 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.6+, manylinux: glibc 2.5+ 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1edddef79357f9642781375330458c4470c7c75a9dacd0248fd75f16f678200 |
|
MD5 | 3288f796b763a3b915312fc4c2fc4510 |
|
BLAKE2b-256 | e23ad56333fca3f3f338adc2d9437295e1535d9119649e24fb87b890da0df422 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-manylinux_2_5_i686.manylinux1_i686.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 316ac33cfec302bf66e7c61fa7a044e7e8700f034861144ef03f84fe4cc17574 |
|
MD5 | e0dbc60e554c8cb1bb5c91c6f505a3e2 |
|
BLAKE2b-256 | 1ba550aefd58a34fdc32318bf6db790a36ac17c57cde28ccc4b10c09009b061f |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.6+, macOS 10.9+ universal2 (ARM64, x86-64), macOS 10.9+ x86-64, macOS 11.0+ ARM64
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2882fea88821fe46ba058a6e56615222021f21a952e199b3f050ffb55c1ee15d |
|
MD5 | 697293417dc6a61d65d0536445a0dcd1 |
|
BLAKE2b-256 | 7b42a99c2727d405d05b5a85389007dd90a63c7062133f48b48da3f7a3b98da5 |
File details
Details for the file rjsonnet-0.3.2-cp36-abi3-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: rjsonnet-0.3.2-cp36-abi3-macosx_10_7_x86_64.whl
- Upload date:
- Size: 645.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8ad5f7242005c14631c08e9e0d0144704b7c4bc955bc954ba78bfb66398049b |
|
MD5 | 8e008d01caf78fe5fd89ac4dcd00d913 |
|
BLAKE2b-256 | 4646b9045de5b754a5b3062a36a8823da829a98101e690e1df730af512616bac |