Skip to main content

Jsonnet - The data templating language

For an introduction to Jsonnet and documentation, visit our website.

This is the Python module for the original C++ implementation of Jsonnet.

Security notes: The C++ implementation is not suitable for processing untrusted inputs without significant external effort to sandbox it. It is not hardened and may have unknown exploitable bugs. It is intended for use to evaluate Jsonnet code that you trust not to be malicious (e.g., code written by you/your organisation). Even ignoring the risk of exploitable bugs in the implementation, the import, importstr, and importbin language constructs can potentially be used to exfiltrate sensitive data unless you take extra steps to restrict these or sandbox the jsonnet interpreter. By default, these constructs can import from any path accessible to the interpreter process.

Using the Jsonnet Python module

You can install from PyPI with uv add jsonnet or with your preferred Python package management tool.

The two main functions in the _jsonnet package are evaluate_file and evaluate_snippet:

  • evaluate_file(filename, ...) reads and evalutes the file at the given path, returning an output as a JSON string.
  • evaluate_snippet(filename, src, ...) evaluates the given source code (src), returning an output as a JSON string. The provided filename is used in error messages.

The functions support keyword arguments:

  • jpathdir: A string (path to a directory) or list of strings (list of directories) to be added to the import search path.
  • ext_vars, ext_codes: Dictionaries of variables to set; these can be used from within the evaluated code through the std.extVar Jsonnet function. ext_codes values are Jsonnet expressions, ext_vars values are provided to Jsonnet as plain strings.
  • tla_vars, tla_codes: Dictionaries of Top-Level arguments. If the provided Jsonnet code to evaluate represents a function, that function is called with these values as (named) arguments.
  • import_callback: A function which will be called when import (or importstr, importbin) expressions are evaluated. See below.
  • native_callbacks: A dictionary of functions which can be called from Jsonnet using the Jsonnet std.native function. See below.

And some configuration for internal implementation details:

  • max_stack
  • max_trace
  • gc_min_objects
  • gc_growth_trigger

import_callback

Usage example:

import _jsonnet

FILES = {
    "the_message.txt": b"hello, world",
}

def import_callback_memfile(dir, rel):
    """Custom import function which only returns files from some in-memory storage.
    
    Args:
      dir: The directory part of the file in which the `import` occurred.
      rel: The path string passed to the `import` expression.
    """
    if rel in FILES:
        # Note that the returned file _content_ should be a bytes value, not a string.
        return rel, FILES[rel]
    raise RuntimeError('File not found')

result = _jsonnet.evaluate_snippet(
    'example',
    'local the_message = importstr "the_message.txt"; ' +
    '{ msg: the_message }',
    import_callback=import_callback_memfile)

assert result == '{\n   "msg": "hello, world"\n}\n';

native_callbacks

Usage example:

import _jsonnet

def concat(a, b):
    return a + b
    
native_callbacks = {
    'concat': (('a', 'b'), concat),
}

result = _jsonnet.evaluate_snippet(
    'example',
    'local concat = std.native("concat"); ' +
    'concat("hello, ", "world")',
    native_callbacks=native_callbacks)

assert result == '"hello, world"\n';

Release files for jsonnet 0.22.0

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

Source distribution (sdist)

Source distribution for jsonnet 0.22.0
File Size Uploaded
jsonnet-0.22.0.tar.gz 529.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for jsonnet 0.22.0
File
jsonnet-0.22.0-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
jsonnet-0.22.0-cp314-cp314t-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 Details
jsonnet-0.22.0-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
jsonnet-0.22.0-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
jsonnet-0.22.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
jsonnet-0.22.0-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details
jsonnet-0.22.0-cp38-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.8 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
jsonnet-0.22.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details

Total release size: 30.6 MB

Release files / jsonnet-0.22.0.tar.gz

Download URL jsonnet-0.22.0.tar.gz
Size 529.7 kB
Tags Source
SHA-256 checksum
How to use checksums
eae5d9bf23c778baad39390f88c13c03b2090dfb5dfa148d6e217df8c1448258
BLAKE2b-256 checksum
How to use checksums
bd90b35ecd8d60c910874a645d153d4084e07950bc746b4e77dbbe54e199d1cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp314-cp314t-win_amd64.whl

Download URL jsonnet-0.22.0-cp314-cp314t-win_amd64.whl
Size 315.1 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
76086435dcfd973252cb3d56b22848009061a44413fa197e15b39decf5400b65
BLAKE2b-256 checksum
How to use checksums
c69129d5e9394766e123b42cd23d351b2945117706534a89060241238888d1b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp314-cp314t-musllinux_1_2_x86_64.whl

Download URL jsonnet-0.22.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Size 7.5 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
f13c60dc93d682bdcd63f4db368ea6e7e6e9ef9d2efb5bcd1b8dd78818d4fa7d
BLAKE2b-256 checksum
How to use checksums
b4ee071311a7a9cdc20e817a1419c02db509a829282fe6001dddca33ce7a5e97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL jsonnet-0.22.0-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 6.8 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f52e8aebcedace2ecc0eeebbd10a18fd3fb2d66ada892acec571a8119eff5087
BLAKE2b-256 checksum
How to use checksums
3e08ff983e8161759cfdd393699cc18d80b0391ecd4b21cb839a705a34644516
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp314-cp314t-macosx_11_0_arm64.whl

Download URL jsonnet-0.22.0-cp314-cp314t-macosx_11_0_arm64.whl
Size 444.4 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
772d6d9e85b7c296d5197b4b48d7fd1b36043c90b80b670e8a769bd21e2b1f25
BLAKE2b-256 checksum
How to use checksums
348da8534c36284a9c58a60d7be3fc499e9ff226a62631c5b63fb0e0a728a4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp38-abi3-win_amd64.whl

Download URL jsonnet-0.22.0-cp38-abi3-win_amd64.whl
Size 305.5 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
46df8787b30b001b39d9d551b3d85892d99a699cf3311a63f7bcef080d8a18ff
BLAKE2b-256 checksum
How to use checksums
90b191bd98399359b255b906cfce28d898d96d52348e37502859ccb469c083fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL jsonnet-0.22.0-cp38-abi3-musllinux_1_2_x86_64.whl
Size 7.5 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
aefd2c07038eb9412ae6c46e49b7cfec74f10c53007755b176f7e075e70646f4
BLAKE2b-256 checksum
How to use checksums
bab73270203be535725bf4b1ded5574f07c5cf530a954e2e1b4760efb5bb1e55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp38-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL jsonnet-0.22.0-cp38-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 6.7 MB
Tags CPython 3.8 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
a1136eefea98f01d654984e868f10faac2749d062464881491ec79ae5c38dc0e
BLAKE2b-256 checksum
How to use checksums
689ab1bb5a0ce21a0fc1ace044d28e69003e63f88b15bc22fcb14ca7e74cf63b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / jsonnet-0.22.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL jsonnet-0.22.0-cp38-abi3-macosx_11_0_arm64.whl
Size 443.4 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
42d86e5b2740e31a5e970997d470f517d9073c8a743ddb09ae69069e37529aa6
BLAKE2b-256 checksum
How to use checksums
48b9d0ead4a4a5fbcee2807127aed41063d7482aa969a41d6d6a7c0194cc2686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.22.0 This release

9 release files

0.20.0

1 release file

0.19.1

1 release file

0.19.0

1 release file

0.18.0

1 release file

0.17.0

1 release file

0.16.0

1 release file

0.15.0

1 release file

0.14.0

1 release file

0.13.0

1 release file

0.12.1

1 release file

0.12.0

1 release file

0.11.2

1 release file

0.11.0

1 release file

0.10.0

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.9

1 release file

v0.8.7

1 release file

v0.8.6

1 release file

v0.8.4

1 release file

v0.8.3

1 release file

v0.8.2

1 release file

v0.8.1

1 release file

v0.8.0

1 release file

v0.7.9

1 release file

v0.7.8

1 release file

v0.7.7

1 release file

v0.7.6

1 release file

v0.7.5

1 release file

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