Skip to main content

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)
  • 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.

Metadata

Release files for rjsonnet 0.5.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rjsonnet 0.5.6
File Size Uploaded
rjsonnet-0.5.6.tar.gz 15.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rjsonnet 0.5.6
File
rjsonnet-0.5.6-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
rjsonnet-0.5.6-cp38-abi3-win32.whl CPython 3.8 abi3 Windows x86-32 Details
rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details
rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_i686.whl CPython 3.8 abi3 Linux musl 1.2+ x86-32 Details
rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_armv7l.whl CPython 3.8 abi3 Linux musl 1.2+ ARMv7l Details
rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_aarch64.whl CPython 3.8 abi3 Linux musl 1.2+ ARM64 Details
rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.8 abi3 Linux glibc 2.17+ IBM System/390x Details
rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.8 abi3 Linux glibc 2.17+ PowerPC 64-le Details
rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.8 abi3 Linux glibc 2.17+ ARMv7l Details
rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
rjsonnet-0.5.6-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl CPython 3.8 abi3 Linux glibc 2.5+ x86-32 Details
rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details
rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64 Details

Total release size: 18.8 MB

Release files / rjsonnet-0.5.6.tar.gz

Download URL rjsonnet-0.5.6.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
47bd8f63b4b1def67f83001c07ff7d43d6a90dbf89cb6fb680c941db809a60ce
BLAKE2b-256 checksum
How to use checksums
70654c6b1e4baf48ebbc6ff0c8cf8b50f08c63173d9abd5dd7f3af03b4bcd460
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-win_amd64.whl

Download URL rjsonnet-0.5.6-cp38-abi3-win_amd64.whl
Size 968.7 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
240b1fc47d65dd7fa9696e2d990ace346671f3db6fcd592d321ff53ed2aaf625
BLAKE2b-256 checksum
How to use checksums
1fc1ea290b90c9114236fc622f6953c778d0fe6075db0db2a6eccc6d38314cd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-win32.whl

Download URL rjsonnet-0.5.6-cp38-abi3-win32.whl
Size 888.4 kB
Tags CPython 3.8 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
046b0d999ce7bde39c40be635ba2b316fc7e73a296e0d5fb9c2c2f121574ff4d
BLAKE2b-256 checksum
How to use checksums
7bf871a41cb7650951e4997d46b0076d26aba9d1ee5c5f7c79cc5dcc5ba4a753
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_x86_64.whl
Size 1.4 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
23476746e4baddfccb1c62dd99b5dfeb1ddb3328172df358a15e274a5a350338
BLAKE2b-256 checksum
How to use checksums
c7f195841859a0fd3ec00c477ddf13cda052dd888caf16434aea5b6470a356c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_i686.whl

Download URL rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_i686.whl
Size 1.4 MB
Tags CPython 3.8 Linux musl 1.2+ x86-32 abi3
SHA-256 checksum
How to use checksums
8aee482b41bdd88615383a53c2b21df8ca56cf7301f16a42d53d902631f6ef18
BLAKE2b-256 checksum
How to use checksums
06bf953c1253ebc51cf5b9493e5b63a171a1dbe6ba9f19ca8a60efbf18ca1c33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_armv7l.whl

Download URL rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_armv7l.whl
Size 1.5 MB
Tags CPython 3.8 Linux musl 1.2+ ARMv7l abi3
SHA-256 checksum
How to use checksums
5b3da1fd61aac92f8eb825fe30ba0be1b816b922b3a9ba2f9b42dbd168063c0f
BLAKE2b-256 checksum
How to use checksums
fdd8bf4081e0ca2c2e472d73426e23b0124ec739e6f0e39af80e2d46fa1979c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL rjsonnet-0.5.6-cp38-abi3-musllinux_1_2_aarch64.whl
Size 1.4 MB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
73fe993c25968e21ce8c2fbdce288b08396a54c236bdc5b488579c7efd3313b1
BLAKE2b-256 checksum
How to use checksums
6d97af200f02c2dbdb17fd325286bb971b5f593c00f53738eac5e125140e5664
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a0c8237cdebb63c10b23f422056620252c998703b856656df582db27c666b3c9
BLAKE2b-256 checksum
How to use checksums
662c2dca7abed713ad835a5b00c23f098b6da94afbdf1033fb4fb221f8c8189d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 1.5 MB
Tags CPython 3.8 Linux glibc 2.17+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
c343553616dbbe674e1afb760a08013919242187dfd11f244c6398755918eb0b
BLAKE2b-256 checksum
How to use checksums
58613950e87ffd82aa547a9bc8f933e6d0b2ea8a27c0005986af80cb84d2cef8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 1.3 MB
Tags CPython 3.8 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
6aff98eb694e87a319b45ca675b175570121f4257f988b9204639bf8837756db
BLAKE2b-256 checksum
How to use checksums
fb1f0198f28d8e374abc8c8897c2a077e4fd819d00dd0b556e391d713a5bc913
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
d7a0953e631f6f1e08282026e10e7e0646e4c4ba811dc025ad55c6cfa22f39b6
BLAKE2b-256 checksum
How to use checksums
861b6db5520dfd5c2e48f5ff61327c958a04170e0bda964fcb2507a073e89530
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rjsonnet-0.5.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9f4f0fcc240b9666ff5b02cc932bb40a223e9c4bd7309425b92ad314ad0070de
BLAKE2b-256 checksum
How to use checksums
60c80f4ee954cdf4391fb6a673887bd0e03dee60be54aaba83938e2bef1b3e23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl

Download URL rjsonnet-0.5.6-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Size 1.3 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-32 abi3
SHA-256 checksum
How to use checksums
7835dfbc8a51516bdaa7bbbbab3eac2cdd08b57231d4a05c8838107350de4b83
BLAKE2b-256 checksum
How to use checksums
ba592460e4f56ad23e0b0dc630b7109907b58947611e0999503f11105dbed8e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.whl

Download URL rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.whl
Size 1.2 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
44b4b9bfab30ec1180b204c7f52a3cd8230539fe05f3774866e5e12181afdb89
BLAKE2b-256 checksum
How to use checksums
1d4de8e2d3a2864066539b978d9f29d38c11dffa906291e5d0f7ad35fdc90fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL rjsonnet-0.5.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 2.3 MB
Tags CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8c7e064926429758a9d71305fb8d7ac1e36309d1c3d8959ecea9778f2987e0ac
BLAKE2b-256 checksum
How to use checksums
e2910d8f7590d62f042bc1a81a5d75f0562b8bf6a2a521c85c4878d34e70b604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page