📜 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.1.tar.gz
(20.2 kB
view details)
Built Distribution
pysonnet-0.0.1-py3-none-any.whl
(22.6 kB
view details)
File details
Details for the file pysonnet-0.0.1.tar.gz
.
File metadata
- Download URL: pysonnet-0.0.1.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0dce6e209b9627f8daa557c9825e2ef98c319dc4000384d481536209639a1cc |
|
MD5 | 29fe892c014bd55d2feea14c3e7621ca |
|
BLAKE2b-256 | e28a7df16bb6154f46193b429afd94ee12e591dad3c0fdcd202ec9acf1767cf9 |
File details
Details for the file pysonnet-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pysonnet-0.0.1-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52d1998340a842aad71574f2ff23f9bfeb3ad192ea3cd7c466d06f999beffc3f |
|
MD5 | d2cb0ece5c905632c93b8ac6246a2ee2 |
|
BLAKE2b-256 | 45995ce2a944b648971a6244c45eb27850b69660d50d28794a1cdfe6ef41858c |