This micro library is a PyYaml wrapper with sane behaviour to read and write readable YAML safely, typically when used with configuration files.
With saneyaml you can dump readable and clean YAML and load safely any YAML preserving ordering and avoiding surprises of type conversions by loading everything except booleans as strings.
Optionally you can check for duplicated map keys when loading YAML.
Works with Python 3. Requires PyYAML 5.x or higher.
license: apache-2.0 homepage_url: https://github.com/aboutcode-org/saneyaml
Usage:
pip install saneyaml
>>> from saneyaml import load
>>> from saneyaml import dump
>>> a=load('''version: 3.0.0.dev6
...
... description: |
... AboutCode Toolkit is a tool to process ABOUT files. An ABOUT file
... provides a way to document a software component.
... ''')
>>> a
dict([
(u'version', u'3.0.0.dev6'),
(u'description', u'AboutCode Toolkit is a tool to process ABOUT files. '
'An ABOUT file\nprovides a way to document a software component.\n')])
>>> pprint(a.items())
[(u'version', u'3.0.0.dev6'),
(u'description',
u'AboutCode Toolkit is a tool to process ABOUT files. An ABOUT file\nprovides a way to document a software component.\n')]
>>> print(dump(a))
version: 3.0.0.dev6
description: |
AboutCode Toolkit is a tool to process ABOUT files. An ABOUT file
provides a way to document a software component.
Metadata
Release files for saneyaml 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| saneyaml-0.6.1.tar.gz | 82.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| saneyaml-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 95.3 kB
Release files / saneyaml-0.6.1.tar.gz
| Download URL | saneyaml-0.6.1.tar.gz |
|---|---|
| Size | 82.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19cfbd8bf94d730998162c790fe5cec9abb5300cc5890fe37dc6dbcaa8fb16bb
|
|
BLAKE2b-256 checksum How to use checksums |
18bbb3ab128fe13964fc8da25ecbac82f9ed9beb59b2e04bfbef433886f1acb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / saneyaml-0.6.1-py3-none-any.whl
| Download URL | saneyaml-0.6.1-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60553363ac55433cef2bc1d6c5a1c9f6e2787e5f40e8c6fad5983eb701592c5b
|
|
BLAKE2b-256 checksum How to use checksums |
eac0b41733920cef3d87ee7d1fd5a618c7bb5240ba80dd2f29c73ec3416b3e04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|