📜 A pure Python implementation of the Jsonnet language
Project description
📜 Pysonnet
A pure Python implementation of the Jsonnet language.
Features:
- Pure Python Implementation: Fully written in Python, ensuring compatibility and ease of integration with Python projects.
- No External Dependencies: Operates independently without the need for any external libraries, simplifying installation and use.
[!IMPORTANT] Pysonnet is in the early stages of development. While it supports all Jsonnet syntax, it lacks some standard library features, and users might encounter bugs.
Installation
pip install pysonnet
Usage
Evaluate a jsonnet file and generate a JSON string:
import pysonnet
json_string = pysonnet.evaluate_file("path/to/file.jsonnet", ext_vars={...})
Load a string and generate a Python object:
import pysonnet
output = pysonnet.loads(
"""
local Person(name='Alice') = {
name: name,
welcome: 'Hello ' + name + '!',
};
{
person1: Person(),
person2: Person('Bob'),
}
"""
)
assert output == {
"person1": {
"name": "Alice",
"welcome": "Hello Alice!"
},
"person2": {
"name": "Bob",
"welcome": "Hello Bob!"
}
}
Evaluate file from command line:
pysonnet path/to/file.jsonnet
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
pysonnet-0.0.2.tar.gz
(21.0 kB
view details)
Built Distribution
pysonnet-0.0.2-py3-none-any.whl
(23.5 kB
view details)
File details
Details for the file pysonnet-0.0.2.tar.gz
.
File metadata
- Download URL: pysonnet-0.0.2.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f9150c44980543caf86bb84061db3297d94f8f64b888dcd02d7a3c7fc320390 |
|
MD5 | 44a389dc733657d6ff071ff60d1c425b |
|
BLAKE2b-256 | 681a9ebe5a221264169c85ca1506e69c6946efdad8fb7a1f4d342ebd9d3a2b63 |
File details
Details for the file pysonnet-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pysonnet-0.0.2-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03b58b22100117044601b694ad041acd2439ceea2bddb821b379c5953d4f9c85 |
|
MD5 | 728a0d768dc0927be4456a844fcd0d63 |
|
BLAKE2b-256 | 9628a2f38b02948a60321076620dead7cdf9e1f3219eb5a54d8332874599da11 |