Metadata-Version: 2.4
Name: yamlcore
Version: 0.0.4
Summary: YAML 1.2 Support for PyYAML
Author-email: Tina Müller <cpan2@tinita.de>
License: 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-URL: Homepage, https://github.com/perlpunk/pyyaml-core
Project-URL: Documentation, https://github.com/perlpunk/pyyaml-core
Project-URL: Repository, https://github.com/perlpunk/pyyaml-core
Project-URL: Issues, https://github.com/perlpunk/pyyaml-core/issues
Project-URL: Changelog, https://github.com/perlpunk/pyyaml-core/blob/main/Changelog.md
Keywords: yaml
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyYAML
Dynamic: license-file

## pyyaml-core - YAML 1.2 Core Schema Support for PyYAML

This module can be used on top of [PyYAML](https://github.com/yaml/pyyaml) to
load YAML 1.2 files.
It depends on PyYAML and inherits from it, it's not a fork.

Currently it supports enabling all YAML 1.2 Core Schema tags on top
of the PyYAML BaseLoader.
It does not (yet) support other tags like the `<<` merge key.
You can add custom constructors, though.

For more information see the [comparison of 1.1 and 1.2
schemas](https://perlpunk.github.io/yaml-test-schema/schemas.html).

## Examples

    import yaml
    from yamlcore import CoreLoader
    from yamlcore 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](https://github.com/yaml/libyaml) based parser and emitter.

## Why?

At the time of this writing, there is a [pending pull
request](https://github.com/yaml/pyyaml/pull/555) 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.

## Differences

There are other differences in behaviour to PyYAML.

### Duplicate keys are not allowed

The YAML spec forbids duplicate keys. PyYAML allows them, which leads to
accidentally added duplicate keys in YAML files, eventually.

I can't see a good use case that people would want to allow duplicate
keys in a typical YAML loading process.
For the use cases I see you would want your own constructor anyway.

If this is breaking anyone's use case, please let me know.
