--- id: jsonnet version: "0.22.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # jsonnet — Python bindings for Jsonnet - The data templating language License: permissive · Maintenance: active · Downloads: 2.1M/mo ## What it is and what it does Jsonnet is a templating language designed to generate JSON from higher-level, more expressive syntax. This package provides Python bindings to the original C++ implementation, allowing you to evaluate Jsonnet code from Python and receive JSON output. The main entry points are `evaluate_file()` to process Jsonnet files and `evaluate_snippet()` to evaluate code strings directly. The package supports passing variables into Jsonnet code via `ext_vars` and `ext_codes`, top-level function arguments via `tla_vars` and `tla_codes`, and custom functions callable from Jsonnet via `native_callbacks`. The documentation explicitly warns that the C++ implementation is not hardened against untrusted inputs and should only be used to evaluate code you trust. Use it for: - Generate complex JSON configurations programmatically from templates with variables and functions. - Build infrastructure-as-code JSON from reusable Jsonnet libraries. - Evaluate Jsonnet as a higher-level configuration language in Python applications. - Pass external variables and top-level arguments into Jsonnet code from Python. - Expose Python functions to Jsonnet code via native_callbacks for domain-specific logic. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Jsonnet is a data templating language that evaluates Jsonnet code to produce JSON output, with Python bindings to the original C++ implementation. Yes, if you need to generate or template JSON from Jsonnet code in Python and trust the Jsonnet source. The package is actively maintained, has no known vulnerabilities, and wheels cover common platforms. However, do not use it to evaluate untrusted Jsonnet code without external sandboxing—the C++ implementation is not hardened. ## Install pip install jsonnet uv add jsonnet poetry add jsonnet ## Installing jsonnet Before you install: Medium install friction due to compiled C++ bindings, but wheels are available for common platforms (macOS ARM64, Linux x86_64, Windows x64, and musllinux). Repository is actively maintained with recent commits. License in practice: Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and notice of modifications. Quickstart: import _jsonnet result = _jsonnet.evaluate_snippet( 'example', '{ greeting: "hello" }' ) print(result) The C++ implementation is not suitable for processing untrusted inputs without sandboxing; import, importstr, and importbin language constructs can access any path the interpreter can reach. Verify before relying: - Whether pre-built wheels cover all target deployment platforms beyond the listed architectures. - Specific Python version compatibility (requires_python is unspecified in metadata). ## Package facts - License: Apache-2.0 (permissive) - Python support: unspecified - Install friction: medium - Maintenance: active - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags jsonnet templating language, json data generation, configuration templating, jsonnet python bindings, evaluate jsonnet code, json template engine, data templating, templating, json-generation, configuration-management [View on SkillFed](https://skillfed.io/packages/jsonnet) · [View on PyPI](https://pypi.org/project/jsonnet/)