← Back to issue list

feat: include libyaml-dev for apt charm plug-in builds

View original Github issue

Metadata

Project
charmcraft
Number
#1766
Type
pull request
State
merged
Author
tonyandrewmeyer
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #1766 (commit 1330582e) adds libyaml-dev to the charm plug-in's deb build packages and unit test, so ops charms build the fast libyaml-backed PyYAML.

Resolution: closed resolved

Reason: The PR was approved by 3 reviewers and merged into main as commit 1330582e; charmcraft/parts/plugins/_charm.py now returns 'libyaml-dev' in get_build_packages() for deb-based systems, with the expectation updated in tests/unit/parts/plugins/test_charm.py.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Operator framework charms will try to use the libyaml based PyYAML, which is significantly faster than the pure Python one. In an apt system, like Ubuntu, this requires `libyaml-dev` to build from source. If the libyaml dev files are not available, then the pure Python version will be built instead. Charms can get the faster version by including `libyaml-dev` in the `build-packages` section of the metadata, or by allowing PyYAML as a binary package (the wheel has the faster version). However, this is fairly esoteric knowledge. Since the charm plug-in is specifically for operator framework charms, and ops has PyYAML as a dependency so be required for every ops charm, it seems reasonable to have `libyaml-dev` as a build dependency, which means that everyone (on an apt-based system) will get the faster YAML processing for 'free'. Detailed timing for setting relation data can be found using the [example charm in this repo](https://github.com/pengwyn/charm-relation-test). Setting 4MB of relation data with the pure Python version takes around 2s, and with the libyaml version around 0.02s. This can be significant for some charms. A complete test for this would be to do a basic charm build and verify that the .so file is included in the `venv/yaml` folder, but I wasn't sure whether that sort of test would be appropriate for charmcraft or not. Let me know if I should work on that, assuming that you're inclined to accept this change.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #1766 (commit 1330582e) adds libyaml-dev to the charm plug-in's deb build packages and unit test, so ops charms build the fast libyaml-backed PyYAML.
stealth/space-bunny-alpha — closed resolved Merged charmcraft#1766 in commit 1330582e, adding libyaml-dev to apt charm plug-in build dependencies so operator-framework charms can use the faster libyaml-backed PyYAML.
qwen/qwen3.6-35b-a3b — — Merged. Adds libyaml-dev to apt charm plugin build dependencies to enable faster PyYAML compilation for operator framework charms. Accepted for consistency despite newer OS images already providing the package.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Adds libyaml-dev to apt charm plugin builds, enabling faster libyaml-based PyYAML for operator framework charms. This significantly improves relation data performance. The change ensures consistent performance across environments.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.