yamelish
yamelish is a non-parsable YAML-ish output format that was designed as a convenience to diff JSON files.
"non-parsable" means that yamelish was not designed to be parsed by computers. It might actually be parsable with some care and caveats (e.g. no way to distinguish boolean/null values from their string counterparts), but this is not the object of this project.
YAML-ish means that it looks like YAML but is not YAML. Specifically, it looks like YAML, without quotes (except for empty strings), indicators like > or | and advanced features:
postId: 1
id: 1
name: id labore ex et quam laborum
email: Eliseo@gardner.biz
body:
laudantium enim quasi est quidem magnam voluptate ipsam eos
tempora quo necessitatibus
dolor quam autem quasi
reiciendis et nam sapiente accusantium
examples:
booleans:
- True
- False
null_value: None
integer: 4
float: 4.4
empty_string: ""
empty_array: []
empty_object: {}
yamelish's main limitation is that it offers no way to distinguish non-string values from their textual representation: the "True" string and the true boolean values will both end up as True. Consequently, yamelish remains relevant to spot changing values and structures but not changing types.
Command-line usage
$ yamelish file1.json file2.json
Git usage
Git configuration (typically ~/.config/git/config):
[diff "json_diff"]
textconv = /path/to/yamelish
; Optional:
[alias]
showobject = show --ext-diff
Repository's .gitattributes file:
*.json diff=json_diff
Python usage
from yamelish.handlers import handle
yamelish = handle(your_data)[0]
print(yamelish)
Why not ... ?
Why not JSON?
JSON diff is hard to read because of:
- escaped strings:
"this\nis\na\nmultiline\nstring\nand\nthis\nis\npainful""\"wait, what?\""
- extra commas when appending to an array:
{
"array": [
"a",
- "b"
+ "b",
+ "c"
]
}
Why not gron?
Because the gron format reflects array indices, inserting an element into an array makes diff way longer than expected:
json = {};
json.array = [];
-json.array[0] = "a";
-json.array[1] = "b";
+json.array[0] = "z";
+json.array[1] = "a";
+json.array[2] = "b";
Why not YAML?
YAML is better but it still clutters the output with quotes, escaped values and/or little things like |-; this is because YAML is a format that is meant to be parsed, so it has to keep this kind of things.
array:
- "# this string is double-quoted because otherwise it would be a YAML comment"
-- "# this string is double-quoted because otherwise it would be a YAML comment"
+- this string is no longer double-quoted
- "# this string is double-quoted because otherwise it would be a YAML comment"
License
yamelish is licensed under WTFPL.
Metadata
Release files for yamelish 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yamelish-1.0.0.tar.gz | 4.4 kB | Without provenance | Details for yamelish-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yamelish-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for yamelish-1.0.0-py3-none-any.whl |
Total release size: 9.6 kB
Release files / yamelish-1.0.0.tar.gz
| Download URL | yamelish-1.0.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71dcf55941d7f92e9c41ecf0a0dc309be6482ffa550366432752c8023e079680
|
|
BLAKE2b-256 checksum How to use checksums |
8674cd28f1c9c69df5b696238c373de0ae4d2055e0b67ba3059c75aaf424ca8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / yamelish-1.0.0-py3-none-any.whl
| Download URL | yamelish-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b7cb0a42e7067132e3bcb43e51b385fde925fda2ecedc71f43591589491ebc7
|
|
BLAKE2b-256 checksum How to use checksums |
b2d5d0084e33bea025dc3e872d980f8ac86606fb57f72ab60ba3b9c94a715b61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Security for yamelish 1.0.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.