Skip to main content

YAML 1.2 Support for PyYAML

Project description

pyyaml-core - YAML 1.2 Core Schema Support for PyYAML

This module can be used on top of PyYAML to load YAML 1.2 files.

Currently it supports enabling all YAML 1.2 Core Schema tags on top of the PyYAML BaseLoader.

For more information see the comparison of 1.1 and 1.2 schemas.

Examples

import yaml
from yamlcore.loader import CoreLoader
from yamlcore.dumper import CoreDumper

y = """
---
1.1: # strings
- yes
- no # norway problem anymore
- 1__0
- 10:20
- +0b100
- 0x4_2

core:
- true
- 0o10
- 0x42
- ~
- .inf
"""

d = yaml.load(y, Loader=CoreLoader)
out = yaml.dump(d, Dumper=CoreDumper)

You can also use CCoreLoader and CCoreDumper for using the libyaml based parser and emitter.

Why?

At the time of this writing, there is a pending pull request that adds YAML 1.2 Core Schema Support for PyYAML.

It's blocked because there is a plan to redesign the API, and no new things shall be added using the old API at this point.

So as long as PyYAML doesn't merge this, you can use this module as an alternative.

MIT License

Copyright (c) 2024 Tina Müller (tinita)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yamlcore-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

yamlcore-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file yamlcore-0.0.1.tar.gz.

File metadata

  • Download URL: yamlcore-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for yamlcore-0.0.1.tar.gz
Algorithm Hash digest
SHA256 688fc66b48c53d5ee1713cd7d4d3571a54c8bf8715e5b2c60e73c0c9a66f41ba
MD5 8b5eb1f0ab4bcdf66fcc5013878a54bc
BLAKE2b-256 fe0d0566427af8a0070a4ad7486a8c197487a21f62db5f09cb6f52af5cef86c5

See more details on using hashes here.

File details

Details for the file yamlcore-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: yamlcore-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for yamlcore-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83c1dbfb8079f430b873cfe26a0469e53d85279f8d3583eb56fb27f32f74a79c
MD5 155927c3a83500ad254480f979215566
BLAKE2b-256 1a13b0c6a1b81e4aa662e7b6618bc97f0a95a617b3c6cfe81f5a35ff19d834b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page