Skip to content

Use ruamel.yaml.clib as default#4712

Open
LecrisUT wants to merge 1 commit intoteemtee:mainfrom
LecrisUT:feat/yaml-clib
Open

Use ruamel.yaml.clib as default#4712
LecrisUT wants to merge 1 commit intoteemtee:mainfrom
LecrisUT:feat/yaml-clib

Conversation

@LecrisUT
Copy link
Member

It seems the only thing we need to do to enable this is to pull in this dependency and switch to using safe type by default. This would be a better apple-to-apple comparison with #4486 since that one uses a C library for handling json.

Reference:


Pull Request Checklist

  • implement the feature
  • include a release note

Related to #4406

Signed-off-by: Cristian Le <git@lecris.dev>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR enables ruamel.yaml.clib by default by adding it as a dependency and setting the default YAML type to 'safe'. A suggestion is provided for tmt/utils/__init__.py to improve conciseness. Add a release note for this performance improvement.

Comment on lines +3510 to 3511
yaml_type = yaml_type or "safe"
yaml = YAML(typ=yaml_type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Combine these lines for conciseness.

Suggested change
yaml_type = yaml_type or "safe"
yaml = YAML(typ=yaml_type)
yaml = YAML(typ=yaml_type or "safe")

"pygments>=2.7.4",
"requests>=2.25.1",
"ruamel.yaml>=0.16.6",
"ruamel-yaml-clib",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making ruamel-yaml-clib an unconditional dependency will break installations on non-CPython implementations (PyPy, Jython, etc.) since it's a C extension only available for CPython. The removed marker in pylock.toml (line 2405) previously restricted it to platform_python_implementation == 'CPython'.

This should be:

"ruamel-yaml-clib; platform_python_implementation == 'CPython'",

Without this marker, pip install will fail on PyPy and other implementations where the C extension cannot be compiled/installed.

Suggested change
"ruamel-yaml-clib",
"ruamel-yaml-clib; platform_python_implementation == 'CPython'",

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Member Author

@LecrisUT LecrisUT Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting observation. We are implying CPython in many other places though due to other dependencies. Will keep it open for discussions

@github-project-automation github-project-automation bot moved this to backlog in planning Mar 19, 2026
@LecrisUT LecrisUT moved this from backlog to review in planning Mar 19, 2026
@LecrisUT LecrisUT added ci | full test Pull request is ready for the full test execution review | trivial Very easy for review, even for beginners, so don't be afraid to have a look! :-) labels Mar 19, 2026
@LecrisUT
Copy link
Member Author

/packit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution review | trivial Very easy for review, even for beginners, so don't be afraid to have a look! :-)

Projects

Status: review

Development

Successfully merging this pull request may close these issues.

1 participant