Allow libyaml-linked PyYAML wheel in Linux onedir builds - #69949
Open
dwoz wants to merge 1 commit into
Open
Conversation
The Linux onedir build passes ``--no-binary=:all:`` to pip so every runtime dependency is compiled against the relenv toolchain and linked against the vendored openssl/krb5/etc. PyYAML's setup.py autodetects libyaml at compile time; because the relenv toolchain does not build or ship libyaml, the source build silently falls back to a pure-Python parser and the resulting onedir has no ``yaml.CSafeLoader`` and no ``_yaml.so`` extension. Salt's ``yamlloader`` uses ``getattr(yaml, "CSafeLoader", yaml.SafeLoader)`` so it does not crash, but every YAML load (configs, pillars, states, returners, mine, event bus, etc.) runs through the pure-Python parser, which is 10-20x slower. Users with segmented configs have reported ``salt-run salt.cmd test.ping`` taking ~20s where a libyaml-linked build completes in well under a second. Add ``pyyaml`` to the Linux ``--only-binary`` allow-list so pip uses PyYAML's manylinux2014 wheel, which bundles libyaml (MIT-licensed) and targets glibc 2.17+ (compatible with every relenv Linux target). This mirrors the existing precedent for ``maturin``, ``cassandra-driver``, ``hatchling``, ``cmake``, ``ninja``, and ``protobuf``. Fixes saltstack#69907
3 tasks
Contributor
Author
|
3006.x backport: #69950 |
twangboy
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
pyyamlto the--only-binaryallow-list for Linux onedir builds so pip installs PyYAML's manylinux2014 wheel (which bundles libyaml) instead of source-building it under the relenv toolchain.Why
The Linux onedir build passes
--no-binary=:all:to pip so every runtime dependency is compiled against the relenv toolchain. PyYAML'ssetup.pyautodetects libyaml at compile time; because the relenv toolchain does not build or ship libyaml, the source build silently falls back to a pure-Python parser and the resulting onedir has noyaml.CSafeLoaderand no_yaml*.soextension.Salt's
yamlloaderusesgetattr(yaml, "CSafeLoader", yaml.SafeLoader)so it does not crash, but every YAML load (configs, pillars, states, returners, mine, event bus) runs through the pure-Python parser, which is 10-20x slower. Users with segmented configs (many small pillar/state files) have reportedsalt-run salt.cmd test.pingtaking ~20s where a libyaml-linked build completes in well under a second.Reproduction
On any current 3006.27 or 3008.1 onedir install:
The reporter's workaround is:
which pulls the manylinux wheel and restores
CSafeLoader. This PR does the equivalent at build time so users get a libyaml-linked PyYAML out of the box.Scope
Linux only. The Windows path does not use
--no-binary=:all:, so pip already prefers the win_amd64 wheel (which bundles libyaml). macOS is unaffected for the same reason.Licensing
LibYAML is MIT-licensed, matching PyYAML itself; bundling it via the manylinux wheel introduces no new license obligations. This mirrors the existing precedent for
maturin,cassandra-driver,hatchling,cmake,ninja, andprotobufin the same allow-list.Test plan
hasattr(yaml, 'CSafeLoader') == False_yaml*.soFixes #69907