yamlordereddictloader


Nameyamlordereddictloader JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://github.com/fmenabe/python-yamlordereddictloader
SummaryYAML loader and dumper for PyYAML allowing to keep keys order.
upload_time2023-09-22 13:49:58
maintainer
docs_urlNone
authorFrançois Ménabé
requires_python
licenseMIT License
keywords yaml loader dumper ordered ordereddict pyyaml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            python-yamlordereddictloader
============================

**DEPRECATED: the** `Phynix/yamlloader <https://github.com/Phynix/yamlloader>`_ **project
provide an improved version of this library with unit tests, performance improvements
(by providing access to the C implementation of PyYAML) and is more actively developed.
You should use it!**

.. image:: https://img.shields.io/pypi/l/yamlordereddictloader.svg
           :target: https://opensource.org/licenses/MIT
           :alt: License

.. image:: https://img.shields.io/pypi/pyversions/yamlordereddictloader.svg
           :target: https://pypi.python.org/pypi/yamlordereddictloader
           :alt: Versions

.. image:: https://img.shields.io/pypi/v/yamlordereddictloader.svg
           :target: https://pypi.python.org/pypi/yamlordereddictloader
           :alt: PyPi

.. image:: https://img.shields.io/badge/github-repo-yellow.jpg
           :target: https://github.com/fmenabe/python-yamlordereddictloader
           :alt: Code repo

.. image:: https://landscape.io/github/fmenabe/python-yamlordereddictloader/master/landscape.svg?style=flat
           :target: https://landscape.io/github/fmenabe/python-yamlordereddictloader/master
           :alt: Code Health

This module provide a loader and a dumper for PyYAML allowing to keep items order
when loading a file (by putting them in ``OrderedDict`` objects) and to manage
``OrderedDict`` objects when dumping to a file.

The loader is based on stackoverflow topic (thanks to Eric Naeseth):
http://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts#answer-5121963

Self promotion: I use it a lot with `clg <https://clg.readthedocs.io>`_, which
allows to generate command-line definition from a configuration file, for keeping
order of subcommands, options and arguments in the help message!


To install it
-------------

.. code-block:: bash

    $ pip install yamlordereddictloader

Loader usage
------------

.. code-block:: python

    import yaml
    import yamlordereddictloader

    data = yaml.load(open('myfile.yml'), Loader=yamlordereddictloader.Loader)

**Note:** For using the safe loader (which want standard YAML tags and does
not construct arbitrary Python objects), replace ``yamlorderdictloader.Loader`` by
``yamlorderedictloader.SafeLoader``.

Dumper usage
------------

.. code-block:: python

    import yaml
    import yamlordereddictloader
    from collections import OrderedDict

    data = OrderedDict([
        ('key1', 'val1'),
        ('key2', OrderedDict([('key21', 'val21'), ('key22', 'val22')]))
    ])
    yaml.dump(
        data,
        open('myfile.yml', 'w'),
        Dumper=yamlordereddictloader.Dumper,
        default_flow_style=False)

**Note:** For using the safe dumper (which produce standard YAML tags and does
not represent arbitrary Python objects), replace ``yamlorderdictloader.Dumper`` by
``yamlorderedictloader.SafeDumper``.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fmenabe/python-yamlordereddictloader",
    "name": "yamlordereddictloader",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "YAML,loader,dumper,ordered,OrderedDict,pyyaml",
    "author": "Fran\u00e7ois M\u00e9nab\u00e9",
    "author_email": "francois.menabe@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/23/78/f853b0db6d8f3ea0ae4c648e4504ba376d024c139ba1292a256ce6180dd0/yamlordereddictloader-0.4.2.tar.gz",
    "platform": null,
    "description": "python-yamlordereddictloader\n============================\n\n**DEPRECATED: the** `Phynix/yamlloader <https://github.com/Phynix/yamlloader>`_ **project\nprovide an improved version of this library with unit tests, performance improvements\n(by providing access to the C implementation of PyYAML) and is more actively developed.\nYou should use it!**\n\n.. image:: https://img.shields.io/pypi/l/yamlordereddictloader.svg\n           :target: https://opensource.org/licenses/MIT\n           :alt: License\n\n.. image:: https://img.shields.io/pypi/pyversions/yamlordereddictloader.svg\n           :target: https://pypi.python.org/pypi/yamlordereddictloader\n           :alt: Versions\n\n.. image:: https://img.shields.io/pypi/v/yamlordereddictloader.svg\n           :target: https://pypi.python.org/pypi/yamlordereddictloader\n           :alt: PyPi\n\n.. image:: https://img.shields.io/badge/github-repo-yellow.jpg\n           :target: https://github.com/fmenabe/python-yamlordereddictloader\n           :alt: Code repo\n\n.. image:: https://landscape.io/github/fmenabe/python-yamlordereddictloader/master/landscape.svg?style=flat\n           :target: https://landscape.io/github/fmenabe/python-yamlordereddictloader/master\n           :alt: Code Health\n\nThis module provide a loader and a dumper for PyYAML allowing to keep items order\nwhen loading a file (by putting them in ``OrderedDict`` objects) and to manage\n``OrderedDict`` objects when dumping to a file.\n\nThe loader is based on stackoverflow topic (thanks to Eric Naeseth):\nhttp://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts#answer-5121963\n\nSelf promotion: I use it a lot with `clg <https://clg.readthedocs.io>`_, which\nallows to generate command-line definition from a configuration file, for keeping\norder of subcommands, options and arguments in the help message!\n\n\nTo install it\n-------------\n\n.. code-block:: bash\n\n    $ pip install yamlordereddictloader\n\nLoader usage\n------------\n\n.. code-block:: python\n\n    import yaml\n    import yamlordereddictloader\n\n    data = yaml.load(open('myfile.yml'), Loader=yamlordereddictloader.Loader)\n\n**Note:** For using the safe loader (which want standard YAML tags and does\nnot construct arbitrary Python objects), replace ``yamlorderdictloader.Loader`` by\n``yamlorderedictloader.SafeLoader``.\n\nDumper usage\n------------\n\n.. code-block:: python\n\n    import yaml\n    import yamlordereddictloader\n    from collections import OrderedDict\n\n    data = OrderedDict([\n        ('key1', 'val1'),\n        ('key2', OrderedDict([('key21', 'val21'), ('key22', 'val22')]))\n    ])\n    yaml.dump(\n        data,\n        open('myfile.yml', 'w'),\n        Dumper=yamlordereddictloader.Dumper,\n        default_flow_style=False)\n\n**Note:** For using the safe dumper (which produce standard YAML tags and does\nnot represent arbitrary Python objects), replace ``yamlorderdictloader.Dumper`` by\n``yamlorderedictloader.SafeDumper``.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "YAML loader and dumper for PyYAML allowing to keep keys order.",
    "version": "0.4.2",
    "project_urls": {
        "Download": "https://github.com/fmenabe/python-yamlordereddictloader",
        "Homepage": "https://github.com/fmenabe/python-yamlordereddictloader"
    },
    "split_keywords": [
        "yaml",
        "loader",
        "dumper",
        "ordered",
        "ordereddict",
        "pyyaml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3b664e84e26c52343dc48e9ffefd7d5e82b986f3bc2bd6da753420f41645718",
                "md5": "37246c001984680615c07d702ff06824",
                "sha256": "dc048adb67026786cd24119bd71241f35bc8b0fd37d24b415c37bbc8049f9cd7"
            },
            "downloads": -1,
            "filename": "yamlordereddictloader-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "37246c001984680615c07d702ff06824",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4190,
            "upload_time": "2023-09-22T13:49:56",
            "upload_time_iso_8601": "2023-09-22T13:49:56.820952Z",
            "url": "https://files.pythonhosted.org/packages/d3/b6/64e84e26c52343dc48e9ffefd7d5e82b986f3bc2bd6da753420f41645718/yamlordereddictloader-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2378f853b0db6d8f3ea0ae4c648e4504ba376d024c139ba1292a256ce6180dd0",
                "md5": "c782a0fa8302a19651c2c3f12f92fff2",
                "sha256": "36af2f6210fcff5da4fc4c12e1d815f973dceb41044e795e1f06115d634bca13"
            },
            "downloads": -1,
            "filename": "yamlordereddictloader-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c782a0fa8302a19651c2c3f12f92fff2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3905,
            "upload_time": "2023-09-22T13:49:58",
            "upload_time_iso_8601": "2023-09-22T13:49:58.745653Z",
            "url": "https://files.pythonhosted.org/packages/23/78/f853b0db6d8f3ea0ae4c648e4504ba376d024c139ba1292a256ce6180dd0/yamlordereddictloader-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-22 13:49:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fmenabe",
    "github_project": "python-yamlordereddictloader",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "yamlordereddictloader"
}
        
Elapsed time: 0.24587s