# rickle - Smart Python tools for working with YAML
```
██████╗ ██╗ ██████╗██╗ ██╗██╗ ███████╗
██╔══██╗██║██╔════╝██║ ██╔╝██║ ██╔════╝
██████╔╝██║██║ █████╔╝ ██║ █████╗
██╔══██╗██║██║ ██╔═██╗ ██║ ██╔══╝
██║ ██║██║╚██████╗██║ ██╗███████╗███████╗
╚═╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚══════╝
by Zipfian Science
```
`rickle` is a versatile Python library and command-line tool that offers a wide range of functionalities for working with YAML and JSON data. Here's a brief summary of its key features:
1. **Serialization**: `rickle` allows you to easily serialize Python objects to YAML format. This is particularly useful for converting Python data structures into a human-readable and easily shareable format.
2. **Schema Validation**: It provides the capability to validate YAML and JSON data against predefined schemas. This ensures that your data adheres to a specific structure or format, helping to maintain data consistency.
3. **Schema Generation**: You can generate schema definitions from existing YAML (or JSON) files. This is helpful when you want to formalize the structure of your data or for documentation purposes.
4. **Conversion between YAML and JSON**: `rickle` offers seamless conversion between YAML and JSON formats. This facilitates data interchange between systems that use different serialization formats.
5. **Simple Web Server**: One unique feature of `rickle` is its ability to create a basic web server from a YAML file. This means you can define endpoints, routes, and data sources purely by writing it as a YAML file, making it easy to prototype web services without extensive coding, or to create mock REST APIs.
In summary, `rickle` is a powerful utility for working with YAML and JSON data in Python.
It simplifies tasks like serialization, schema validation, schema generation, format conversion,
and even enables quick web server prototyping using YAML configuration files.
This tool is valuable for developers and data engineers working
with structured data in a flexible and efficient manner.
For documentation, see [docs](https://zipfian.science/docs/rickle/index.html).
Source on [GitHub](https://github.com/Zipfian-Science/rickle).
## Install
```shell script
$ pip install rickled
```
## And use
```python
from rickled import Rickle
```
Using an example YAML file:
```yaml
BASIC:
text: test
dictionary:
one: 1
two: 2
number: 2
list:
- one
- two
- four
- name: John
age: 20
USERNAME:
type: env
load: USERNAME
callable_lambda:
type: lambda
load: "lambda: print('hell world!')"
datenow:
type: lambda
import:
- "from datetime import datetime as dd"
load: "lambda: print(dd.utcnow().strftime('%Y-%m-%d'))"
test_function:
type: function
name: test_function
args:
x: 7
y: null
s: hello world
any:
- 1
- hello
import:
- "math"
load: >
def test(x, y, s, any):
print(math.e)
iii = 111
print(iii)
print(x,s)
if y:
print(type(y))
else:
print(y)
for i in any:
print(i)
```
Then use Rickle:
```python
>> from rickled import Rickle
>> config = Rickle('./config.yaml', deep=True, load_lambda=True)
>> config.BASIC.callable_lambda()
'hell world!'
```
## Release
See the version history in [changelog](https://zipfian.science/docs/rickle/changelog.html).
- Date: 2024-05-05
- Version: 1.1.3
Raw data
{
"_id": null,
"home_page": "https://github.com/Zipfian-Science/rickle",
"name": "rickled",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Pickle, Python, YAML, JSON",
"author": "Zipfian Science",
"author_email": "about@zipfian.science",
"download_url": "https://files.pythonhosted.org/packages/34/3e/59113ea29c884df302343fdfad99e054ab38ee3045395b6f7abe90f65a9e/rickled-1.1.3.tar.gz",
"platform": null,
"description": "# rickle - Smart Python tools for working with YAML\r\n```\r\n\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\r\n\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551 \u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\r\n\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2554\u255d \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \r\n\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255d \r\n\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\r\n\u255a\u2550\u255d \u255a\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\r\n \r\nby Zipfian Science \r\n```\r\n`rickle` is a versatile Python library and command-line tool that offers a wide range of functionalities for working with YAML and JSON data. Here's a brief summary of its key features:\r\n\r\n1. **Serialization**: `rickle` allows you to easily serialize Python objects to YAML format. This is particularly useful for converting Python data structures into a human-readable and easily shareable format.\r\n\r\n2. **Schema Validation**: It provides the capability to validate YAML and JSON data against predefined schemas. This ensures that your data adheres to a specific structure or format, helping to maintain data consistency.\r\n\r\n3. **Schema Generation**: You can generate schema definitions from existing YAML (or JSON) files. This is helpful when you want to formalize the structure of your data or for documentation purposes.\r\n\r\n4. **Conversion between YAML and JSON**: `rickle` offers seamless conversion between YAML and JSON formats. This facilitates data interchange between systems that use different serialization formats.\r\n\r\n5. **Simple Web Server**: One unique feature of `rickle` is its ability to create a basic web server from a YAML file. This means you can define endpoints, routes, and data sources purely by writing it as a YAML file, making it easy to prototype web services without extensive coding, or to create mock REST APIs.\r\n\r\nIn summary, `rickle` is a powerful utility for working with YAML and JSON data in Python. \r\nIt simplifies tasks like serialization, schema validation, schema generation, format conversion, \r\nand even enables quick web server prototyping using YAML configuration files. \r\nThis tool is valuable for developers and data engineers working \r\nwith structured data in a flexible and efficient manner.\r\n\r\nFor documentation, see [docs](https://zipfian.science/docs/rickle/index.html).\r\n\r\nSource on [GitHub](https://github.com/Zipfian-Science/rickle).\r\n## Install\r\n\r\n```shell script\r\n$ pip install rickled\r\n```\r\n\r\n## And use\r\n\r\n```python\r\nfrom rickled import Rickle\r\n```\r\n\r\nUsing an example YAML file:\r\n\r\n```yaml\r\nBASIC:\r\n text: test\r\n dictionary:\r\n one: 1\r\n two: 2\r\n number: 2\r\n list:\r\n - one\r\n - two\r\n - four\r\n - name: John\r\n age: 20\r\n USERNAME:\r\n type: env\r\n load: USERNAME\r\n callable_lambda:\r\n type: lambda\r\n load: \"lambda: print('hell world!')\"\r\n datenow:\r\n type: lambda\r\n import:\r\n - \"from datetime import datetime as dd\"\r\n load: \"lambda: print(dd.utcnow().strftime('%Y-%m-%d'))\"\r\n test_function:\r\n type: function\r\n name: test_function\r\n args:\r\n x: 7\r\n y: null\r\n s: hello world\r\n any:\r\n - 1\r\n - hello\r\n import:\r\n - \"math\"\r\n load: >\r\n def test(x, y, s, any):\r\n print(math.e)\r\n iii = 111\r\n print(iii)\r\n print(x,s)\r\n if y:\r\n print(type(y))\r\n else:\r\n print(y)\r\n for i in any:\r\n print(i)\r\n```\r\n\r\nThen use Rickle:\r\n\r\n```python\r\n>> from rickled import Rickle\r\n\r\n>> config = Rickle('./config.yaml', deep=True, load_lambda=True)\r\n\r\n>> config.BASIC.callable_lambda()\r\n'hell world!'\r\n```\r\n\r\n## Release\r\n\r\nSee the version history in [changelog](https://zipfian.science/docs/rickle/changelog.html).\r\n\r\n- Date: 2024-05-05\r\n- Version: 1.1.3\r\n\r\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Tools for pickling Python objects in a completely different way",
"version": "1.1.3",
"project_urls": {
"Download": "https://github.com/Zipfian-Science/rickle/archive/v_01.tar.gz",
"Homepage": "https://github.com/Zipfian-Science/rickle"
},
"split_keywords": [
"pickle",
" python",
" yaml",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "343e59113ea29c884df302343fdfad99e054ab38ee3045395b6f7abe90f65a9e",
"md5": "60a9607951c5ca192823f464d13e53b8",
"sha256": "ab6c8c4c720a0fdd52e24b51e5d508d65c37bc8d22eb49381dc5d071a91e9cea"
},
"downloads": -1,
"filename": "rickled-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "60a9607951c5ca192823f464d13e53b8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 33722,
"upload_time": "2024-05-05T15:47:12",
"upload_time_iso_8601": "2024-05-05T15:47:12.183353Z",
"url": "https://files.pythonhosted.org/packages/34/3e/59113ea29c884df302343fdfad99e054ab38ee3045395b6f7abe90f65a9e/rickled-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-05 15:47:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Zipfian-Science",
"github_project": "rickle",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "rickled"
}