ruamel-yaml 0.19.1


pip install ruamel-yaml

  Latest version

Released: Jan 02, 2026


Meta
Author: Anthon van der Neut
Requires Python: >=3.9

Classifiers

Development Status
  • 4 - Beta

Intended Audience
  • Developers

License
  • OSI Approved :: MIT License

Operating System
  • OS Independent

Programming Language
  • Python
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: Implementation :: CPython

Topic
  • Software Development :: Libraries :: Python Modules
  • Text Processing :: Markup

Typing
  • Typed

ruamel.yaml

ruamel.yaml is a YAML 1.2 loader/dumper package for Python.

version 0.19.0
updated 2025-01-02
documentation https://yaml.dev/doc/ruamel.yaml
repository https://sourceforge.net/projects/ruamel-yaml
pypi https://pypi.org/project/ruamel.yaml

breaking changes, that may make future uploads to PyPI impossible

If you are interested in future upgrades of ruamel.yaml please check the documentation on installing, since at some point I might not be able to upload a new version to PyPI with updated information.

ruamel.yaml was intentionally named as yaml in a namespace ruamel. The namespace allows the installation name to correspond unchanged to how the package is imported, reduces the number of links I have to create in site-packages of a Python install during development, as well as providing a recognisable set of packages my company releases to the public.

However, after uploading version 0.18.7, I got an email from PyPI, about having to change the project name to ruamel_yaml to comply with PEP 625, sometime in the future. The email doesn't say if namespace packages are no longer allowed, or how to deal with the very real clash with the pre-existing package ruamel_yaml.

I might not be able to adapt ruamel.yaml, in a way that does not negatively affect the 0.5 million daily downloads (and my own usage of the package) in time. My experience with other such service downgrades (Bitbucket, Readthedocs), has not been entirely positive.


Starting with 0.19.1 ruamel.yaml no longer has a dependency on ruamel.yaml.clibz nor on the old ruamel.yaml.clib.

Some deployment issues were reported on 0.19.0, due to the lack of proper pinning of the ruamel.yaml version used. Most of these issues had to do with the environment not having updated setuptools installed and the build dependency setuptools-zig for ruamel.yaml.clibz not being invoked, with Python falling back to invoking gcc (which was even less likely to be installed).

The already indicated simple solution of using:

    python -m pip install --no-deps ruamel.yaml ruamel.yaml.clib

turned out not to work for at least one setup.

As I am not aware that you can create an install requirement that removes a dependency, the default (Cython) dependency is removed and you should use ruamel.yaml[libyaml] resp. ruamel.yaml[oldlibyaml] as your requirements. (this is the preferred way over using ruamel.yaml.clibz and ruamel.yaml.clib directly). If you are using ruamel.yaml in its default (round-trip, YAML(typ='rt')) mode, there is currently no advantage of installing either optional extension.

The C sources are functionally unchanged, but they are now always compiled (using setuptools-zig and ziglang) on your system, instead of being downloaded as pre-compiled wheels (if available). For this to function properly your Python (virtual) environment needs to have an up-to-date version of setuptools and wheels pre-installed.

The code to load ruamel.yaml.clib has priority over ruamel.yaml.clibz if both are installed. This compatibility will at least be available during the 0.19 ruamel.yaml series (so pin your usage of ruamel.yaml if necessary and report any problems).

The motivitation for this change is the availability, and easy of use, of Zig as the toolchain (in the form of ziglang on PyPi), so lenghty, non-optimized, pre-compilation and uploading to PyPI, is no longer necessary. The time spent on creating ~60 wheels and even more time wasted on dealing with CI providers (Appveyor not being updated to support 3.14, Github CI being slow, and charging for the use of your own computer, etc).

The split out of ruamel.yaml.clib after the 0.15.100 release, was also motivated by the time spent on generating .whl files even if only Python code was changed. The use of ziglang and setuptools-zig does make re-integration of the C sources into ruamel.yaml feasable, but there are no plans yet to make this happen.

The test matrix for ruamel.yaml.clibz, of course still has many dimensions:

    Python versions: 3.9 - 3.14
    OS-es:           Linux, Alpine (musl), macOS, Windows
    Architectures:   Intel/AMD, Arm (and others), in 64 and some also in 32 bit versions
    Zig version:     ziglang < 0.16 is taken from PyPI

I try to test as much of the combinations as possible, trying at least all supported Python versions, including freethreading, on macOS-arm64, Linux arm64 (via docker containers), Ubuntu Linux-Intel, Linux musl intel (docker). And at least one Python version along each of the indicated positions of the dimensions above (e.g. Windows10 64bit was tested with Python 3.14, but I could not test the RISC-V architecture). As with generating .whl files previously (which I could not all test myself) I partly have to rely on the process of compilation/generation being likely correct, and feedback from actual users, of exotic (for me) platforms, is of course welcome.

There is new section, in the documentation, on the security of processing unchecked input.


The potentially breaking change announced for the 0.18 series, in that YAML(typ='unsafe') was going to be deprecated (now pending), has not yet been implemented, but is still considered. If you only use unsafe to dump, please use the new YAML(typ='full'), the result of that can be safely loaded with a default instance YAML(), as that will get you inspectable, tagged, scalars, instead of executed Python functions/classes. (You should probably add constructors for what you actually need, but I do consider adding a ruamel.yaml.unsafe package that will re-add the typ='unsafe' option. Please adjust/pin your dependencies accordingly if necessary.


Version 0.18.16 was the last one tested to be working with Python 3.8. Version 0.18.9 was the last one tested to be working with Python 3.7. Version 0.17.21 was the last one tested to be working on Python 3.5 and 3.6. The 0.16.13 release was the last that was tested to be working on Python 2.7.

There are two extra plug-in packages (ruamel.yaml.bytes and ruamel.yaml.string) for those not wanting to do the streaming to a io.BytesIO/StringIO buffer themselves.

If your package uses ruamel.yaml and is not listed on PyPI, drop me an email, preferably with some information on how you use the package (or a link to the repository) and I'll keep you informed when the status of the API is stable enough to make the transition.

For packaging purposes you can use a download of the tar balls of tagged source

0.19.0 (2025-01-02):

  • removed dependency on ruamel.yaml.clibz

0.19.0 (2025-12-31):

  • changed dependency on ruamel.yaml.clib to ruamel.yaml.clibz which includes support for free-threading (revisited after a bug report by Ahmed Moustafa and some insistance by Nathan Goldbaum
  • added .max_depth to YAML() instance. If set to a (positive) number this limits the recursion, so loading does throw a MaxDepthExceededError. Based on comments by Benjamin Oberdorfer via email. This also triggered the new documenation section on processing unchecked input.

0.18.17 (2025-12-17):

  • try to load C functions from _ruamel_yaml_clibz first.

0.18.16 (2025-10-22):

  • root level block style scalars that started with a directives-end marker or a document-end marker, are now indented 2 spaces.
  • merged fix for accessing end_marks on Tokens provided by Toknak

0.18.15 (2025-08-19):

  • duplicate merge keys are never allowed (not even with .allow_duplicate_keys = True
  • merge keys now keep there position if a key before the merge key gets deleted (previously a key after the merge key would move before it)

0.18.14 (2025-06-09):

0.18.13 (2025-06-06):

  • Fix line wrapping on plain scalars not observing width correctly. Issue 529, reported by Sebastien Vermeille
  • Fix sha256 and length in RECORD files. Reported by Evan

0.18.12 (2025-05-30):

  • fix additional issue with extra space in double quoted string. Reported by Saugat Pachhai
  • fix duplicate key url, now pointing to yaml.dev. Reported by Hugo
  • fix broken RECORD file, which was a problem for uv, not pip. Reported by konstin

0.18.11 (2025-05-19):

  • function load_yaml_guess_indent now takes an option yaml argument so you can provide an already created/configured YAML instance
  • Sequence item indicator with both comment/empty line before indicator and comment before sequence item, could not move comment and raise NotImplementedError. Reported by Karsten Tessarzik.
  • missing f for f-string (reported by π, via email)
  • fixed issue with extra space in double quoted dump (reported by Jan Möller)

0.18.10 (2025-01-06):

  • implemented changes to the setup.py for Python 3.14 as suggested by Miro Hrončok in merge requests (MR not merged as those files are copied in from develop config)

0.18.9 (2025-01-05):

  • fix issue with roundtripping 0 in YAML 1.1 reported by Peter Law

0.18.8 (2025-01-02):

  • added warning to README.md that PyPI might block updates due to breaking changes

0.18.7 (2024-12-30):

  • fixes for README (reported by Kees Bakker)
  • fixes preserving anchor on scalar integer 0 (issue reported by (Mor Peled)[https://sourceforge.net/u/morp/profile/] and also in a question by Ravi on Stackoverflow)
  • fix for formatting of README suggested by Michael R. Crusoe

0.18.6 (2024-02-07):

  • fixed an issue with dataclass loading when the fields were collections (bug found as a result of a question by FibroMyAlgebra on StackOverflow)
  • fixed an issue loading dataclasses with InitVar fields when from __future__ import annotations was used to delay evaluation of typing.

0.18.5 (2023-11-03):

  • there is some indication that dependent packages have been pinned to use specific (tested) and just install the latest even in Python versions that have end-of-life

0.18.4 (2023-11-01):

  • YAML() instance has a doc_infos attribute which is a cumulative list of DocInfo instances (one for load(), one per document for load_all()). DocInfo instances contain version information (requested, directive) and tag directive information
  • fix issue that the YAML instance tags attribute was not reset between documents, resulting in mixing of tag directives of multiple documents. Now only provides tag directive information on latest document after loading. This means tags for dumping must be set again after a document is loaded with the same instance. (because of this tags will be removed in a favour of a different mechanism in the future)
  • fix issue with multiple document intermixing YAML 1.2 and YAML 1.1, the VersionedResolver now resets
  • fix issue with disappearing comment when next token was Tag (still can't have both a comment before a tag and after a tag, before node)

0.18.3 (2023-10-29):

  • fix issue with spurious newline on first item after comment + nested block sequence
  • additional links in the metadata on PyPI (Reported, with pointers how to fix, by Sorin).

0.18.2 (2023-10-24):

  • calling the deprecated functions now raises an AttributeError with the, somewhat more informative, orginal warning message. Instead of calling sys.exit(1)

0.18.1 (2023-10-24):

  • calling the deprecated functions now always displays the warning message. (reported by Trend Lloyd)

0.18.0 (2023-10-23):

  • the functions scan, parse, compose, load, emit, serialize, dump and their variants (_all, safe_, round_trip_, etc) have been deprecated (the same named methods on YAML() instances are, of course, still there.
  • YAML(typ='unsafe') now issues a PendingDeprecationWarning. This will become deprecated in the 0.18 series (probably before the end of 2023). You can use YAML(typ='full') to dump unregistered Python classes/functions. For loading you'll have to register your classes/functions if you want the old, unsafe, functionality. You can still load any tag, like `!!python/name:posix.system', safely with the (default) round-trip parser.
  • fix for bytes-like object is required not 'str' while dumping binary streams. This was reported, analysed and a fix provided by Vit Zikmund

For older changes see the file CHANGES

0.19.1 Jan 02, 2026
0.19.0 Dec 31, 2025
0.18.17 Dec 17, 2025
0.18.16 Oct 22, 2025
0.18.15 Aug 19, 2025
0.18.14 Jun 09, 2025
0.18.13 Jun 06, 2025
0.18.12 May 30, 2025
0.18.11 May 25, 2025
0.18.10 Jan 06, 2025
0.18.9 Jan 05, 2025
0.18.8 Jan 02, 2025
0.18.7 Dec 30, 2024
0.18.6 Feb 07, 2024
0.18.5 Nov 03, 2023
0.18.3 Oct 29, 2023
0.18.2 Oct 24, 2023
0.18.1 Oct 24, 2023
0.18.0 Oct 23, 2023
0.17.40 Oct 20, 2023
0.17.39 Oct 19, 2023
0.17.38 Oct 19, 2023
0.17.36 Oct 19, 2023
0.17.35 Oct 04, 2023
0.17.34 Oct 03, 2023
0.17.33 Sep 28, 2023
0.17.32 Jun 17, 2023
0.17.31 May 31, 2023
0.17.30 May 30, 2023
0.17.29 May 30, 2023
0.17.28 May 26, 2023
0.17.27 May 25, 2023
0.17.26 May 09, 2023
0.17.25 May 09, 2023
0.17.24 May 06, 2023
0.17.23 May 05, 2023
0.17.22 May 02, 2023
0.17.21 Feb 12, 2022
0.17.20 Jan 03, 2022
0.17.19 Dec 26, 2021
0.17.18 Dec 24, 2021
0.17.17 Oct 31, 2021
0.17.16 Aug 29, 2021
0.17.15 Aug 28, 2021
0.17.14 Aug 25, 2021
0.17.13 Aug 21, 2021
0.17.12 Aug 21, 2021
0.17.11 Aug 19, 2021
0.17.10 Jun 24, 2021
0.17.9 Jun 10, 2021
0.17.8 Jun 09, 2021
0.17.7 May 31, 2021
0.17.6 May 31, 2021
0.17.5 May 30, 2021
0.17.4 Apr 07, 2021
0.17.3 Apr 07, 2021
0.17.2 Mar 29, 2021
0.17.1 Mar 29, 2021
0.17.0 Mar 26, 2021
0.16.13 Mar 05, 2021
0.16.12 Sep 04, 2020
0.16.11 Sep 03, 2020
0.16.10 Feb 12, 2020
0.16.9 Feb 11, 2020
0.16.7 Jan 30, 2020
0.16.6 Jan 20, 2020
0.16.5 Aug 18, 2019
0.16.4 Aug 16, 2019
0.16.3 Aug 15, 2019
0.16.2 Aug 15, 2019
0.16.1 Aug 08, 2019
0.16.0 Jul 25, 2019
0.15.100 Jul 17, 2019
0.15.99 Jul 12, 2019
0.15.98 Jul 09, 2019
0.15.97 Jun 06, 2019
0.15.96 May 16, 2019
0.15.95 May 15, 2019
0.15.94 Apr 23, 2019
0.15.93 Apr 21, 2019
0.15.92 Apr 16, 2019
0.15.91 Apr 05, 2019
0.15.90 Apr 04, 2019
0.15.89 Feb 27, 2019
0.15.88 Feb 12, 2019
0.15.87 Jan 22, 2019
0.15.86 Jan 16, 2019
0.15.85 Jan 08, 2019
0.15.84 Jan 07, 2019
0.15.83 Jan 02, 2019
0.15.82 Dec 28, 2018
0.15.81 Dec 06, 2018
0.15.80 Nov 26, 2018
0.15.79 Nov 21, 2018
0.15.78 Nov 15, 2018
0.15.77 Nov 09, 2018
0.15.76 Nov 01, 2018
0.15.75 Oct 27, 2018
0.15.74 Oct 17, 2018
0.15.73 Oct 16, 2018
0.15.72 Oct 06, 2018
0.15.71 Sep 26, 2018
0.15.70 Sep 21, 2018
0.15.69 Sep 20, 2018
0.15.68 Sep 20, 2018
0.15.67 Sep 19, 2018
0.15.66 Sep 07, 2018
0.15.65 Sep 07, 2018
0.15.64 Aug 30, 2018
0.15.63 Aug 29, 2018
0.15.62 Aug 29, 2018
0.15.61 Aug 23, 2018
0.15.60 Aug 18, 2018
0.15.59 Aug 17, 2018
0.15.58 Aug 17, 2018
0.15.57 Aug 15, 2018
0.15.56 Aug 15, 2018
0.15.55 Aug 14, 2018
0.15.54 Aug 13, 2018
0.15.53 Aug 12, 2018
0.15.52 Aug 09, 2018
0.15.51 Aug 08, 2018
0.15.50 Aug 05, 2018
0.15.49 Aug 05, 2018
0.15.48 Aug 03, 2018
0.15.47 Jul 31, 2018
0.15.46 Jul 29, 2018
0.15.45 Jul 26, 2018
0.15.44 Jul 14, 2018
0.15.43 Jul 12, 2018
0.15.42 Jul 01, 2018
0.15.41 Jun 27, 2018
0.15.40 Jun 18, 2018
0.15.39 Jun 16, 2018
0.15.38 Jun 13, 2018
0.15.37 Mar 21, 2018
0.15.35 Dec 03, 2017
0.15.34 Sep 17, 2017
0.15.33 Aug 31, 2017
0.15.32 Aug 21, 2017
0.15.31 Aug 15, 2017
0.15.30 Aug 14, 2017
0.15.29 Aug 14, 2017
0.15.28 Aug 13, 2017
0.15.27 Aug 13, 2017
0.15.26 Aug 10, 2017
0.15.25 Aug 09, 2017
0.15.24 Aug 09, 2017
0.15.23 Aug 01, 2017
0.15.22 Jul 28, 2017
0.15.21 Jul 25, 2017
0.15.20 Jul 23, 2017
0.15.19 Jul 13, 2017
0.15.18 Jul 04, 2017
0.15.17 Jul 03, 2017
0.15.16 Jul 01, 2017
0.15.15 Jun 27, 2017
0.15.14 Jun 25, 2017
0.15.13 Jun 24, 2017
0.15.12 Jun 24, 2017
0.15.11 Jun 24, 2017
0.15.10 Jun 23, 2017
0.15.9 Jun 16, 2017
0.15.8 Jun 15, 2017
0.15.7 Jun 14, 2017
0.15.6 Jun 10, 2017
0.15.5 Jun 08, 2017
0.15.4 Jun 08, 2017
0.15.3 Jun 07, 2017
0.15.2 Jun 07, 2017
0.15.1 Jun 07, 2017
0.15.0 Jun 04, 2017
0.14.12 May 14, 2017
0.14.11 May 01, 2017
0.14.10 Apr 26, 2017
0.14.9 Apr 22, 2017
0.14.8 Apr 19, 2017
0.14.7 Apr 18, 2017
0.14.6 Apr 14, 2017
0.14.5 Apr 04, 2017
0.14.4 Mar 31, 2017
0.14.3 Mar 31, 2017
0.14.2 Mar 23, 2017
0.14.1 Mar 22, 2017
0.14.0 Mar 21, 2017
0.13.14 Feb 12, 2017
0.13.13 Jan 28, 2017
0.13.11 Jan 23, 2017
0.13.10 Jan 22, 2017
0.13.9 Jan 18, 2017
0.13.8 Jan 18, 2017
0.13.7 Dec 27, 2016
0.13.6 Dec 27, 2016
0.13.5 Dec 25, 2016
0.13.4 Dec 05, 2016
0.13.3 Dec 05, 2016
0.13.2 Nov 28, 2016
0.13.1 Nov 22, 2016
0.13.0 Nov 20, 2016
0.12.18 Nov 16, 2016
0.12.17 Nov 15, 2016
0.12.16 Nov 13, 2016
0.12.15 Oct 28, 2016
0.12.14 Sep 21, 2016
0.12.13 Sep 15, 2016
0.12.12 Sep 06, 2016
0.12.11 Sep 06, 2016
0.12.10 Sep 05, 2016
0.12.9 Sep 05, 2016
0.12.8 Sep 05, 2016
0.12.7 Sep 04, 2016
0.12.6 Sep 03, 2016
0.12.5 Aug 20, 2016
0.12.4 Aug 19, 2016
0.12.3 Aug 18, 2016
0.12.2 Aug 16, 2016
0.12.1 Aug 16, 2016
0.12.0 Aug 15, 2016
0.11.15 Aug 07, 2016
0.11.14 Jul 07, 2016
0.11.11 May 02, 2016
0.11.10 Apr 19, 2016
0.11.9 Apr 14, 2016
0.11.8 Apr 07, 2016
0.11.7 Mar 05, 2016
0.11.6 Feb 29, 2016
0.11.5 Feb 29, 2016
0.11.3 Feb 27, 2016
0.11.2 Feb 27, 2016
0.11.1 Feb 18, 2016
0.11.0 Feb 18, 2016
0.10.23 Feb 17, 2016
0.10.22 Feb 16, 2016
0.10.21 Feb 16, 2016
0.10.20 Jan 31, 2016
0.10.19 Jan 31, 2016
0.10.18 Jan 30, 2016
0.10.17 Jan 22, 2016
0.10.16 Jan 22, 2016
0.10.15 Jan 18, 2016
0.10.14 Jan 18, 2016
0.10.13 Jan 08, 2016
0.10.12 Oct 08, 2015
0.10.11 Sep 17, 2015
0.10.10 Sep 15, 2015
0.10.9 Sep 14, 2015
0.10.8 Sep 12, 2015
0.10.7 Aug 28, 2015
0.10.6 Aug 27, 2015
0.10.5 Aug 25, 2015
0.10.4 Aug 07, 2015
0.10.2 Jul 04, 2015
0.10.1 Jul 03, 2015
0.10 Jun 22, 2015
0.9.8 Jun 18, 2015
0.9.7 Jun 13, 2015
0.9.6 Jun 05, 2015
0.9.5 Jun 05, 2015
0.9.4 Jun 02, 2015
0.9.2 May 27, 2015
0.9.1 May 13, 2015
0.8 Apr 15, 2015
0.7.2 Mar 29, 2015
0.7.1 Mar 27, 2015
0.7 Mar 26, 2015
0.6.1 Mar 18, 2015
0.6 Mar 11, 2015
0.5.1 Jan 14, 2015
0.5 Jan 12, 2015
0.4 Nov 25, 2014
0.3 Nov 24, 2014
0.2 Nov 23, 2014
0.1 May 28, 2015

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies: