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/)
  • preserve_order (bool, preserve object field order during manifestification)

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

Uploaded Source

Built Distributions

rjsonnet-0.5.3-cp37-abi3-win_amd64.whl (974.9 kB view details)

Uploaded CPython 3.7+ Windows x86-64

rjsonnet-0.5.3-cp37-abi3-win32.whl (900.3 kB view details)

Uploaded CPython 3.7+ Windows x86

rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ x86-64

rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_i686.whl (2.6 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_armv7l.whl (2.4 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.8 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

rjsonnet-0.5.3-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (2.5 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

rjsonnet-0.5.3-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.4 MB view details)

Uploaded CPython 3.7+ macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

rjsonnet-0.5.3-cp37-abi3-macosx_10_7_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: rjsonnet-0.5.3.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for rjsonnet-0.5.3.tar.gz
Algorithm Hash digest
SHA256 acdb7499064f1bfbe99bd75551bea1ba9d818149164ad6801206102ac565e5f7
MD5 b03b7cc9bce0a5fb67aaa689927f704b
BLAKE2b-256 0a18c60658127971b5f67f5a391f4f062123599fb0b276d1a51485fb086c40a9

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: rjsonnet-0.5.3-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 974.9 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 51126688f5a49e089749ae377f2094025b28d5211e8d8fdc27dc37a6300e3cb7
MD5 8a33450076aba0b831df799691ef4047
BLAKE2b-256 1e624a233d0bef1616ef040ee94eb41c30baa241a2faf76718c3c77cd993f707

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-win32.whl.

File metadata

  • Download URL: rjsonnet-0.5.3-cp37-abi3-win32.whl
  • Upload date:
  • Size: 900.3 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 0c84bff33cdb160fadc1fc1a57e6a4050a38ccba4d85820ec26778fc0c7bd638
MD5 c58cecf5838193f5a4cb5353ee64132d
BLAKE2b-256 86e5a01226fc9f3eef1083bbe9b92f454348e568c8a19ba99c1842dd572d37f8

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 33e8b1412e25c0cb79f3587f5ead9287a31812b63780cfbf4e1800ee26f2cc9d
MD5 80cbcae368087685621aefc3a94c3c39
BLAKE2b-256 42414b42246896595afb362870fe37ea517cc09892155fda2ff2aa3cd0e63956

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 ed17d35d85334dbab4d3cfd3c324add6145c1f1b3617f4d5ca74671af8c5609f
MD5 f27d9d2a853a8ebf7c804a9650798f87
BLAKE2b-256 524e20c6c4d00aea948178d6158f980ea32124c24f99bcb9aec13daf3b5a2c46

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 b23f11e85fe398e491dc70f0e68ada5cc4a53a83b5986944a5764e5fb22f5805
MD5 a5b3af4db2e396bc8cf15e636796bf87
BLAKE2b-256 de46093c454bffaf4afade72bb442f5ce103b1008a64c9b39a2ccf11f40212cd

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8bf7a5c5a99b28951816f631ab8427035b4d54c86c566f07cc56ff418741a70c
MD5 4355dad90156d4063e1bf7b19eb376a9
BLAKE2b-256 51ec00aa95b234fe7435ee2e4ca5e3cc6fa4f6f8e1884078b1e0b87ca09a36e8

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c422e99f03507625d0a481c55baf698da4e39be14a93849b79c7f857d33effc
MD5 9246b73159c788463a3421b2b6bd7cf1
BLAKE2b-256 782c6af12a4737ef4ca4c77d2fc62b81c3b78035c03fa05128fccc4f8c6ec274

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 e215e0598f678e2dd401fdd5fb7253adc9eb9e470f764b213625304910ca51fa
MD5 b5385f3c79a6d34e13aec36971a1a936
BLAKE2b-256 4e87728c15fff9485cf5de3d9fd1aa3c0320f512d81275629a15ae1e16d536d8

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ad4b24615dfe8384ca238554d984f07d7599d90658be759985aafab9fd60b85e
MD5 1fd6a3ed748949a516750264b7a37b59
BLAKE2b-256 1fa916c5d8513167bab6a66407c8cacfc4d4513bf99af7833fde872950bf3ca2

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 53d7868607574d9fda73370b9b190ade6734f3dc47aa0c27125ebc5137f96ed4
MD5 61417e6eb8ba62d581e41e0481d8875e
BLAKE2b-256 f603028b957279b6bd113a589f740bea12d09606c0a806ecf10740d61b921412

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 41421804f54321a0c53a9c7755357a15c9e3115fefcc59eca5ba62133ff0467e
MD5 477aed94d546dce701f070759abeba99
BLAKE2b-256 cdf841c3249f439a24faa03f0ef710e6bfe122221c091ff509fa4cb5a48fe03d

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 bbcf9a99149c8b72d391cd69e8c2b586ad43451ce85487baec752311e2b18abf
MD5 fb471b5773e5f57cc01aecf91640a8e1
BLAKE2b-256 ed062b47f95a3e4e7e1bac5f0b12204a868e74392397e6bc42241d679ca190fa

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 20fc24d75fbd68f31423cbd7bbf0b9f52d3c27583d243fabac0ea1407a747ad7
MD5 8c98bfdaf8171e12bb2ff7ad1625ad92
BLAKE2b-256 957b7ee59f9f7356ad288f36a9617850b916a289383b384907e395a9f3955ec7

See more details on using hashes here.

File details

Details for the file rjsonnet-0.5.3-cp37-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for rjsonnet-0.5.3-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 11210f2458d5bf271aaab36b990b1914f3aa2fe54c8451dae1789473e5103adf
MD5 1ee017c07c3f45df607e6450b17aa023
BLAKE2b-256 c0ac50e27089099276b5b058a45e504f47b0e394fc09051a317915a454758138

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