yamlcore


Nameyamlcore JSON
Version 0.0.4 PyPI version JSON
download
home_pageNone
SummaryYAML 1.2 Support for PyYAML
upload_time2024-10-09 17:26:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT 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.
keywords yaml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## 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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "yamlcore",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "yaml",
    "author": null,
    "author_email": "Tina M\u00fcller <cpan2@tinita.de>",
    "download_url": "https://files.pythonhosted.org/packages/eb/d4/113dfc4c85f945de13b045a20eca50be5f6efa33342d9a9bd6162d26b288/yamlcore-0.0.4.tar.gz",
    "platform": null,
    "description": "## pyyaml-core - YAML 1.2 Core Schema Support for PyYAML\n\nThis module can be used on top of [PyYAML](https://github.com/yaml/pyyaml) to\nload YAML 1.2 files.\nIt depends on PyYAML and inherits from it, it's not a fork.\n\nCurrently it supports enabling all YAML 1.2 Core Schema tags on top\nof the PyYAML BaseLoader.\nIt does not (yet) support other tags like the `<<` merge key.\nYou can add custom constructors, though.\n\nFor more information see the [comparison of 1.1 and 1.2\nschemas](https://perlpunk.github.io/yaml-test-schema/schemas.html).\n\n## Examples\n\n    import yaml\n    from yamlcore import CoreLoader\n    from yamlcore import CoreDumper\n\n    y = \"\"\"\n    ---\n    1.1: # strings\n    - yes\n    - no # norway problem anymore\n    - 1__0\n    - 10:20\n    - +0b100\n    - 0x4_2\n\n    core:\n    - true\n    - 0o10\n    - 0x42\n    - ~\n    - .inf\n    \"\"\"\n\n    d = yaml.load(y, Loader=CoreLoader)\n    out = yaml.dump(d, Dumper=CoreDumper)\n\nYou can also use `CCoreLoader` and `CCoreDumper` for using the\n[libyaml](https://github.com/yaml/libyaml) based parser and emitter.\n\n## Why?\n\nAt the time of this writing, there is a [pending pull\nrequest](https://github.com/yaml/pyyaml/pull/555) that adds YAML 1.2 Core\nSchema Support for PyYAML.\n\nIt's blocked because there is a plan to redesign the API, and no new things\nshall be added using the old API at this point.\n\nSo as long as PyYAML doesn't merge this, you can use this module as an\nalternative.\n\n## Differences\n\nThere are other differences in behaviour to PyYAML.\n\n### Duplicate keys are not allowed\n\nThe YAML spec forbids duplicate keys. PyYAML allows them, which leads to\naccidentally added duplicate keys in YAML files, eventually.\n\nI can't see a good use case that people would want to allow duplicate\nkeys in a typical YAML loading process.\nFor the use cases I see you would want your own constructor anyway.\n\nIf this is breaking anyone's use case, please let me know.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Tina M\u00fcller (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. ",
    "summary": "YAML 1.2 Support for PyYAML",
    "version": "0.0.4",
    "project_urls": {
        "Changelog": "https://github.com/perlpunk/pyyaml-core/blob/main/Changelog.md",
        "Documentation": "https://github.com/perlpunk/pyyaml-core",
        "Homepage": "https://github.com/perlpunk/pyyaml-core",
        "Issues": "https://github.com/perlpunk/pyyaml-core/issues",
        "Repository": "https://github.com/perlpunk/pyyaml-core"
    },
    "split_keywords": [
        "yaml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b147632498fd9a3fe4f175e5de71162dd8cd9b2141180a98f0bef6af293aeaa6",
                "md5": "ae59abb5b4bed229b927588890f7f595",
                "sha256": "f82a7f7d16baf6531a8c3266b0b63ece251ee2abaf2b9eee040a2f64c8fc618d"
            },
            "downloads": -1,
            "filename": "yamlcore-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ae59abb5b4bed229b927588890f7f595",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5969,
            "upload_time": "2024-10-09T17:26:01",
            "upload_time_iso_8601": "2024-10-09T17:26:01.507377Z",
            "url": "https://files.pythonhosted.org/packages/b1/47/632498fd9a3fe4f175e5de71162dd8cd9b2141180a98f0bef6af293aeaa6/yamlcore-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebd4113dfc4c85f945de13b045a20eca50be5f6efa33342d9a9bd6162d26b288",
                "md5": "6beb706251e5c5974aaa6c9e53e36abe",
                "sha256": "c2b1a08dd117cf76a70ee124e936b3c568b0b5c4e5131e69b513f4a877a44881"
            },
            "downloads": -1,
            "filename": "yamlcore-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6beb706251e5c5974aaa6c9e53e36abe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10456,
            "upload_time": "2024-10-09T17:26:02",
            "upload_time_iso_8601": "2024-10-09T17:26:02.601053Z",
            "url": "https://files.pythonhosted.org/packages/eb/d4/113dfc4c85f945de13b045a20eca50be5f6efa33342d9a9bd6162d26b288/yamlcore-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-09 17:26:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "perlpunk",
    "github_project": "pyyaml-core",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "yamlcore"
}
        
Elapsed time: 5.10514s