Name | pysonnet JSON |
Version |
0.0.2
JSON |
| download |
home_page | https://github.com/altescy/pysonnet |
Summary | 📜 A pure Python implementation of the Jsonnet language |
upload_time | 2024-05-24 10:48:31 |
maintainer | None |
docs_url | None |
author | altescy |
requires_python | <4.0,>=3.8 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 📜 Pysonnet
[![CI](https://github.com/altescy/pysonnet/actions/workflows/ci.yml/badge.svg)](https://github.com/altescy/pysonnet/actions/workflows/ci.yml)
[![Python version](https://img.shields.io/pypi/pyversions/pysonnet)](https://github.com/altescy/pysonnet)
[![License](https://img.shields.io/github/license/altescy/pysonnet)](https://github.com/altescy/pysonnet/blob/main/LICENSE)
[![pypi version](https://img.shields.io/pypi/v/pysonnet)](https://pypi.org/project/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
```shell
pip install pysonnet
```
## Usage
Evaluate a jsonnet file and generate a JSON string:
```python
import pysonnet
json_string = pysonnet.evaluate_file("path/to/file.jsonnet", ext_vars={...})
```
Load a string and generate a Python object:
```python
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:
```shell
pysonnet path/to/file.jsonnet
```
Raw data
{
"_id": null,
"home_page": "https://github.com/altescy/pysonnet",
"name": "pysonnet",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "altescy",
"author_email": "altescy@fastmail.com",
"download_url": "https://files.pythonhosted.org/packages/68/1a/9ebe5a221264169c85ca1506e69c6946efdad8fb7a1f4d342ebd9d3a2b63/pysonnet-0.0.2.tar.gz",
"platform": null,
"description": "# \ud83d\udcdc Pysonnet\n\n[![CI](https://github.com/altescy/pysonnet/actions/workflows/ci.yml/badge.svg)](https://github.com/altescy/pysonnet/actions/workflows/ci.yml)\n[![Python version](https://img.shields.io/pypi/pyversions/pysonnet)](https://github.com/altescy/pysonnet)\n[![License](https://img.shields.io/github/license/altescy/pysonnet)](https://github.com/altescy/pysonnet/blob/main/LICENSE)\n[![pypi version](https://img.shields.io/pypi/v/pysonnet)](https://pypi.org/project/pysonnet/)\n\nA pure Python implementation of the Jsonnet language.\n\n**Features**:\n- **Pure Python Implementation**: Fully written in Python, ensuring compatibility and ease of integration with Python projects.\n- **No External Dependencies**: Operates independently without the need for any external libraries, simplifying installation and use.\n\n> [!IMPORTANT]\n> Pysonnet is in the early stages of development.\n> While it supports all Jsonnet syntax, it lacks some standard library features, and users might encounter bugs.\n\n## Installation\n\n```shell\npip install pysonnet\n```\n\n## Usage\n\nEvaluate a jsonnet file and generate a JSON string:\n\n```python\nimport pysonnet\n\njson_string = pysonnet.evaluate_file(\"path/to/file.jsonnet\", ext_vars={...})\n```\n\nLoad a string and generate a Python object:\n\n```python\nimport pysonnet\n\noutput = pysonnet.loads(\n \"\"\"\n local Person(name='Alice') = {\n name: name,\n welcome: 'Hello ' + name + '!',\n };\n {\n person1: Person(),\n person2: Person('Bob'),\n }\n \"\"\"\n)\nassert output == {\n \"person1\": {\n \"name\": \"Alice\",\n \"welcome\": \"Hello Alice!\"\n },\n \"person2\": {\n \"name\": \"Bob\",\n \"welcome\": \"Hello Bob!\"\n }\n}\n```\n\nEvaluate file from command line:\n\n```shell\npysonnet path/to/file.jsonnet\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\ud83d\udcdc A pure Python implementation of the Jsonnet language",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/altescy/pysonnet"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9628a2f38b02948a60321076620dead7cdf9e1f3219eb5a54d8332874599da11",
"md5": "728a0d768dc0927be4456a844fcd0d63",
"sha256": "03b58b22100117044601b694ad041acd2439ceea2bddb821b379c5953d4f9c85"
},
"downloads": -1,
"filename": "pysonnet-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "728a0d768dc0927be4456a844fcd0d63",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 23492,
"upload_time": "2024-05-24T10:48:30",
"upload_time_iso_8601": "2024-05-24T10:48:30.023011Z",
"url": "https://files.pythonhosted.org/packages/96/28/a2f38b02948a60321076620dead7cdf9e1f3219eb5a54d8332874599da11/pysonnet-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "681a9ebe5a221264169c85ca1506e69c6946efdad8fb7a1f4d342ebd9d3a2b63",
"md5": "44a389dc733657d6ff071ff60d1c425b",
"sha256": "4f9150c44980543caf86bb84061db3297d94f8f64b888dcd02d7a3c7fc320390"
},
"downloads": -1,
"filename": "pysonnet-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "44a389dc733657d6ff071ff60d1c425b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 20986,
"upload_time": "2024-05-24T10:48:31",
"upload_time_iso_8601": "2024-05-24T10:48:31.830844Z",
"url": "https://files.pythonhosted.org/packages/68/1a/9ebe5a221264169c85ca1506e69c6946efdad8fb7a1f4d342ebd9d3a2b63/pysonnet-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-24 10:48:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "altescy",
"github_project": "pysonnet",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pysonnet"
}