Socket
Socket
Sign inDemoInstall

saneyaml

Package Overview
Dependencies
10
Maintainers
4
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    saneyaml

Read and write readable YAML safely preserving order and avoiding bad surprises with unwanted infered type conversions. This library is a PyYaml wrapper with sane behaviour to read and write readable YAML safely, typically when used for configuration.


Maintainers
4

Readme

======== saneyaml

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/nexB/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.

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc