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/)preserve_order(bool, preserve object field order during manifestification)gc(bool, default:True, run garbage collection automatically)
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')
# Collect cyclic garbage in current thread created by jrsonnet
# to avoid memory leak, it's not necessary to call this function
# unless you have passed `gc=False` to `evaluate_file` or `evaluate_snippet`
rjsonnet.gc()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rjsonnet-0.5.6.tar.gz.
File metadata
- Download URL: rjsonnet-0.5.6.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47bd8f63b4b1def67f83001c07ff7d43d6a90dbf89cb6fb680c941db809a60ce
|
|
| MD5 |
4b37d9333671c16d401aa9b79a22ab7a
|
|
| BLAKE2b-256 |
70654c6b1e4baf48ebbc6ff0c8cf8b50f08c63173d9abd5dd7f3af03b4bcd460
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 968.7 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
240b1fc47d65dd7fa9696e2d990ace346671f3db6fcd592d321ff53ed2aaf625
|
|
| MD5 |
d7b69ca1c0d6dffd97ebe154ea54cfe1
|
|
| BLAKE2b-256 |
1fc1ea290b90c9114236fc622f6953c778d0fe6075db0db2a6eccc6d38314cd1
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-win32.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-win32.whl
- Upload date:
- Size: 888.4 kB
- Tags: CPython 3.8+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
046b0d999ce7bde39c40be635ba2b316fc7e73a296e0d5fb9c2c2f121574ff4d
|
|
| MD5 |
c938072c08ae78fce5a9f93c15d06fdf
|
|
| BLAKE2b-256 |
7bf871a41cb7650951e4997d46b0076d26aba9d1ee5c5f7c79cc5dcc5ba4a753
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23476746e4baddfccb1c62dd99b5dfeb1ddb3328172df358a15e274a5a350338
|
|
| MD5 |
2a7d5f32edcf41e68fe3e0cd19d354e3
|
|
| BLAKE2b-256 |
c7f195841859a0fd3ec00c477ddf13cda052dd888caf16434aea5b6470a356c6
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_i686.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aee482b41bdd88615383a53c2b21df8ca56cf7301f16a42d53d902631f6ef18
|
|
| MD5 |
3219689f39ef7b684cbc77b19a7b14b8
|
|
| BLAKE2b-256 |
06bf953c1253ebc51cf5b9493e5b63a171a1dbe6ba9f19ca8a60efbf18ca1c33
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b3da1fd61aac92f8eb825fe30ba0be1b816b922b3a9ba2f9b42dbd168063c0f
|
|
| MD5 |
02a3c23f8d636df83d365dc83fb13d4c
|
|
| BLAKE2b-256 |
fdd8bf4081e0ca2c2e472d73426e23b0124ec739e6f0e39af80e2d46fa1979c8
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73fe993c25968e21ce8c2fbdce288b08396a54c236bdc5b488579c7efd3313b1
|
|
| MD5 |
8a81df8001478c451a97ca98dc60ee4d
|
|
| BLAKE2b-256 |
6d97af200f02c2dbdb17fd325286bb971b5f593c00f53738eac5e125140e5664
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0c8237cdebb63c10b23f422056620252c998703b856656df582db27c666b3c9
|
|
| MD5 |
57882193adde947ad646448cdcb07f82
|
|
| BLAKE2b-256 |
662c2dca7abed713ad835a5b00c23f098b6da94afbdf1033fb4fb221f8c8189d
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c343553616dbbe674e1afb760a08013919242187dfd11f244c6398755918eb0b
|
|
| MD5 |
e8d1821e59ccc0a3c7fa1d8b546d96d5
|
|
| BLAKE2b-256 |
58613950e87ffd82aa547a9bc8f933e6d0b2ea8a27c0005986af80cb84d2cef8
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aff98eb694e87a319b45ca675b175570121f4257f988b9204639bf8837756db
|
|
| MD5 |
e9e71306a07f3f83c4958a2a7a45f5dd
|
|
| BLAKE2b-256 |
fb1f0198f28d8e374abc8c8897c2a077e4fd819d00dd0b556e391d713a5bc913
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7a0953e631f6f1e08282026e10e7e0646e4c4ba811dc025ad55c6cfa22f39b6
|
|
| MD5 |
ea2895be7a06bd1dd66eac98e2dcea87
|
|
| BLAKE2b-256 |
861b6db5520dfd5c2e48f5ff61327c958a04170e0bda964fcb2507a073e89530
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f4f0fcc240b9666ff5b02cc932bb40a223e9c4bd7309425b92ad314ad0070de
|
|
| MD5 |
4c6455f994b7ed7be688ae396cec2786
|
|
| BLAKE2b-256 |
60c80f4ee954cdf4391fb6a673887bd0e03dee60be54aaba83938e2bef1b3e23
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.8+, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7835dfbc8a51516bdaa7bbbbab3eac2cdd08b57231d4a05c8838107350de4b83
|
|
| MD5 |
3b3e033a15e819c2ec1afb4c78b72025
|
|
| BLAKE2b-256 |
ba592460e4f56ad23e0b0dc630b7109907b58947611e0999503f11105dbed8e0
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44b4b9bfab30ec1180b204c7f52a3cd8230539fe05f3774866e5e12181afdb89
|
|
| MD5 |
0912ce60d4042c287f1de4135e99c5d9
|
|
| BLAKE2b-256 |
1d4de8e2d3a2864066539b978d9f29d38c11dffa906291e5d0f7ad35fdc90fcf
|
File details
Details for the file rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.8+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c7e064926429758a9d71305fb8d7ac1e36309d1c3d8959ecea9778f2987e0ac
|
|
| MD5 |
da1bccaef94655ea33ae96527491da78
|
|
| BLAKE2b-256 |
e2910d8f7590d62f042bc1a81a5d75f0562b8bf6a2a521c85c4878d34e70b604
|