Name | yamlloader JSON |
Version |
1.5.1
JSON |
| download |
home_page | None |
Summary | Ordered YAML loader and dumper for PyYAML. |
upload_time | 2025-01-01 17:31:36 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | Copyright 2017 Jonas Eschle 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. Parts of the code, mostly from ordereddict.py including within others the functions construct_yaml_map, construct_mapping are licensed under the following license. Copyright 2017 François Ménabé 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 |
pyyaml
dict
dumper
loader
ordered
yaml
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
.. image:: https://github.com/Phynix/yamlloader/actions/workflows/ci.yml/badge.svg
:target: https://github.com/Phynix/yamlloader/actions
.. image:: https://img.shields.io/pypi/pyversions/yamlloader.svg
:target: https://pypi.org/project/yamlloader/
.. image:: https://badge.fury.io/py/yamlloader.svg
:target: https://badge.fury.io/py/yamlloader
.. image:: https://coveralls.io/repos/github/Phynix/yamlloader/badge.svg
:target: https://coveralls.io/github/Phynix/yamlloader
yamlloader
==========
This module provides loaders and dumpers for PyYAML. Currently, an OrderedDict loader/dumper is
implemented, allowing to keep items order
when loading resp. dumping a file from/to an OrderedDict (Python 3.7+: Also regular dicts are supported and are the default items to be loaded to. As of Python 3.7 preservation of insertion order is a language feature of regular dicts.)
This project was originally mirrored from
`yamlordereddict <https://github.com/fmenabe/python-yamlordereddictloader>`_
Many thanks to the original author François Ménabé!
The library contains several improvements including automated testing and
the much faster C-versions of the Loaders/Dumpers.
`API Documentation <https://yamlloader.readthedocs.io/>`_
Install
-------
There is a pip and a conda version available
.. code-block:: bash
$ pip install yamlloader
or
.. code-block:: bash
$ conda install yamlloader -c conda-forge
But does [your special case here] also work?
--------------------------------------------
Tests are run continuously using randomly generated yaml files.
Also, there are no fails to be expected.
Still, if you are concerned that *your* special case may breaks in the future, please
add your own tests as `test_ext_anyname.py` under `tests/` or let us know about your needs.
This guarantees that no code will be added that breaks *your* case.
C vs non-C version
------------------
A significant speedup can be reached by replacing the Loader* and Dumper* classes by CLoader*
and CDumper*. The package hereby relies on the implementations from PyYAML. If they have not
been compiled, *yamlloader* **automatically** falls back to the non-C versions.
Therefore using the C-version is safe: if it is not available, the pure Python version is
automatically used.
Usage examples
==============
Loader usage
------------
.. code-block:: python
import yaml
import yamlloader
with open('myfile.yml') as yaml_file:
data = yaml.load(yaml_file,
Loader=yamlloader.ordereddict.CLoader)
# CLoader is faster than Loader
**Note:** For using the safe loader (which takes standard YAML tags and does
not construct arbitrary Python objects), replace ``yamlloader.ordereddict.CLoader`` by
``yamlloader.ordereddict.CSafeLoader``.
Dumper usage
------------
.. code-block:: python
import yaml
import yamlloader
from collections import OrderedDict
data = OrderedDict([('key1', 'val1'),
('key2', OrderedDict([('key21', 'val21'),
('key22', 'val22')]))])
with open('myfile.yaml', 'w') as yaml_file:
yaml.dump(data, yaml_file,
Dumper=yamlloader.ordereddict.CDumper)
**Note:** For using the safe dumper (which produce standard YAML tags and does
not represent arbitrary Python objects), replace ``yamlloader.ordereddict.CDumper`` by
``yamlloader.ordereddict.CSafeDumper``.
FAQ
===
C version not working
---------------------------
If the C version is not working (it falls back by default to a non-C version),
check if yaml.cyaml exists. If not, the cyaml module was not compiled during the installation of
yaml (pyyaml). Make sure that cython is installed (`pip install Cython`) and the yaml.h file is
there (apt: libyaml-dev).
Raw data
{
"_id": null,
"home_page": null,
"name": "yamlloader",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "Jonas Eschle <jonas.eschle@gmail.com>",
"keywords": "PyYAML, dict, dumper, loader, ordered, yaml",
"author": null,
"author_email": "Jonas Eschle <jonas.eschle@gmail.com>, Johannes Lade <johannes.lade@phynix.science>",
"download_url": "https://files.pythonhosted.org/packages/6f/6b/7f094b4d9009794cb69dea18c99bdee4e62b4e0ee69bb19128178191f18a/yamlloader-1.5.1.tar.gz",
"platform": null,
"description": "\n.. image:: https://github.com/Phynix/yamlloader/actions/workflows/ci.yml/badge.svg\n :target: https://github.com/Phynix/yamlloader/actions\n.. image:: https://img.shields.io/pypi/pyversions/yamlloader.svg\n :target: https://pypi.org/project/yamlloader/\n.. image:: https://badge.fury.io/py/yamlloader.svg\n :target: https://badge.fury.io/py/yamlloader\n.. image:: https://coveralls.io/repos/github/Phynix/yamlloader/badge.svg\n :target: https://coveralls.io/github/Phynix/yamlloader\n\nyamlloader\n==========\n\n\nThis module provides loaders and dumpers for PyYAML. Currently, an OrderedDict loader/dumper is\nimplemented, allowing to keep items order\nwhen loading resp. dumping a file from/to an OrderedDict (Python 3.7+: Also regular dicts are supported and are the default items to be loaded to. As of Python 3.7 preservation of insertion order is a language feature of regular dicts.)\n\nThis project was originally mirrored from\n`yamlordereddict <https://github.com/fmenabe/python-yamlordereddictloader>`_\nMany thanks to the original author Fran\u00e7ois M\u00e9nab\u00e9!\nThe library contains several improvements including automated testing and\nthe much faster C-versions of the Loaders/Dumpers.\n\n\n`API Documentation <https://yamlloader.readthedocs.io/>`_\n\n\nInstall\n-------\nThere is a pip and a conda version available\n\n.. code-block:: bash\n\n $ pip install yamlloader\n\nor\n\n.. code-block:: bash\n\n $ conda install yamlloader -c conda-forge\n\n\nBut does [your special case here] also work?\n--------------------------------------------\n\nTests are run continuously using randomly generated yaml files.\nAlso, there are no fails to be expected.\n\nStill, if you are concerned that *your* special case may breaks in the future, please\nadd your own tests as `test_ext_anyname.py` under `tests/` or let us know about your needs.\nThis guarantees that no code will be added that breaks *your* case.\n\n\nC vs non-C version\n------------------\n\nA significant speedup can be reached by replacing the Loader* and Dumper* classes by CLoader*\nand CDumper*. The package hereby relies on the implementations from PyYAML. If they have not\nbeen compiled, *yamlloader* **automatically** falls back to the non-C versions.\n\nTherefore using the C-version is safe: if it is not available, the pure Python version is\nautomatically used.\n\nUsage examples\n==============\n\n\nLoader usage\n------------\n\n.. code-block:: python\n\n import yaml\n import yamlloader\n\n with open('myfile.yml') as yaml_file:\n data = yaml.load(yaml_file,\n Loader=yamlloader.ordereddict.CLoader)\n # CLoader is faster than Loader\n\n**Note:** For using the safe loader (which takes standard YAML tags and does\nnot construct arbitrary Python objects), replace ``yamlloader.ordereddict.CLoader`` by\n``yamlloader.ordereddict.CSafeLoader``.\n\nDumper usage\n------------\n\n.. code-block:: python\n\n import yaml\n import yamlloader\n from collections import OrderedDict\n\n data = OrderedDict([('key1', 'val1'),\n ('key2', OrderedDict([('key21', 'val21'),\n ('key22', 'val22')]))])\n\n with open('myfile.yaml', 'w') as yaml_file:\n yaml.dump(data, yaml_file,\n Dumper=yamlloader.ordereddict.CDumper)\n\n**Note:** For using the safe dumper (which produce standard YAML tags and does\nnot represent arbitrary Python objects), replace ``yamlloader.ordereddict.CDumper`` by\n``yamlloader.ordereddict.CSafeDumper``.\n\n\nFAQ\n===\n\nC version not working\n---------------------------\nIf the C version is not working (it falls back by default to a non-C version),\ncheck if yaml.cyaml exists. If not, the cyaml module was not compiled during the installation of\nyaml (pyyaml). Make sure that cython is installed (`pip install Cython`) and the yaml.h file is\nthere (apt: libyaml-dev).\n",
"bugtrack_url": null,
"license": "Copyright 2017 Jonas Eschle 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. Parts of the code, mostly from ordereddict.py including within others the functions construct_yaml_map, construct_mapping are licensed under the following license. Copyright 2017 Fran\u00e7ois M\u00e9nab\u00e9 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": "Ordered YAML loader and dumper for PyYAML.",
"version": "1.5.1",
"project_urls": {
"Documentation": "https://yamlloader.readthedocs.io/",
"Homepage": "https://github.com/Phynix/yamlloader"
},
"split_keywords": [
"pyyaml",
" dict",
" dumper",
" loader",
" ordered",
" yaml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "680f28323a9c418403cd4080d1736873c354bf058ad34306be5ff58639dcaedd",
"md5": "1a004e138ce7050679089271593111c0",
"sha256": "610014b14e25d7328d69f6526524d4616a552561f4c1b919f1282695bc1f4a11"
},
"downloads": -1,
"filename": "yamlloader-1.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1a004e138ce7050679089271593111c0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7684,
"upload_time": "2025-01-01T17:31:33",
"upload_time_iso_8601": "2025-01-01T17:31:33.627294Z",
"url": "https://files.pythonhosted.org/packages/68/0f/28323a9c418403cd4080d1736873c354bf058ad34306be5ff58639dcaedd/yamlloader-1.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6f6b7f094b4d9009794cb69dea18c99bdee4e62b4e0ee69bb19128178191f18a",
"md5": "a666496037c2b816a5009c1f36c4c769",
"sha256": "8dece19b050acb1c6a8ca14aa30793388f9be154f734b826541f9a1828d41cec"
},
"downloads": -1,
"filename": "yamlloader-1.5.1.tar.gz",
"has_sig": false,
"md5_digest": "a666496037c2b816a5009c1f36c4c769",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 77157,
"upload_time": "2025-01-01T17:31:36",
"upload_time_iso_8601": "2025-01-01T17:31:36.453854Z",
"url": "https://files.pythonhosted.org/packages/6f/6b/7f094b4d9009794cb69dea18c99bdee4e62b4e0ee69bb19128178191f18a/yamlloader-1.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-01 17:31:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Phynix",
"github_project": "yamlloader",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "yamlloader"
}