Skip to content

Conversation

jamestexas
Copy link
Contributor

@jamestexas jamestexas commented Aug 19, 2025

Summary

This PR updates the yaml-include dependency from 1.4.1 to 2.x while preserving backward compatibility for existing configurations. Version 1.4.1 does not seem to be a public release, and version 1.x is not supported from what I can tell.
The goal is to get this onto 2.x (which is not backward compatible, due to a new API / inclusion of fsspec) with a minimal amount of changes.

Please let me know if you'd like additional tests, or if there are other considerations related to these inclusions / yaml usage. Thanks!

Changes

  • Replace YamlIncludeConstructor.add_to_loader_class with yaml.add_constructor
  • Set base_dir=os.getcwd() to preserve prior relative-include semantics
  • Pin pyyaml-include>=2,<3 to use the supported 2.x API
  • Add test to verify !include constructor is properly registered

Testing

  • All existing unit tests pass (58/58)
  • New test verifies constructor registration
  • Existing YAML configs with !include statements load correctly
  • Preserves CWD-relative path resolution behavior

Backward Compatibility

This change should maintain full backward compatibility:

  • All existing !include statements continue to work
  • Path resolution behavior unchanged (still CWD-relative)
  • No changes required to existing configuration files

@jamestexas jamestexas marked this pull request as draft August 19, 2025 20:21
…lative !includ

- Replace YamlIncludeConstructor.add_to_loader_class with yaml.add_constructor
- Set base_dir=os.getcwd to preserve prior relative-include semantics
- Pin PyYAML>=6, pyyaml-include>=2,<3, add fsspec floor

Signed-off-by: James Gardner <[email protected]>
Signed-off-by: James Gardner <[email protected]>
@jamestexas jamestexas marked this pull request as ready for review August 19, 2025 20:43
@wagoodman wagoodman enabled auto-merge (squash) August 20, 2025 12:54
auto-merge was automatically disabled August 20, 2025 16:05

Head branch was pushed to by a user without write access

@jamestexas
Copy link
Contributor Author

Heya @wagoodman - I had missed some ruff formatting on the config.py file, which should be fixed now. Let me know if you need anything else from me!

@jamestexas jamestexas requested a review from wagoodman August 20, 2025 16:07
@wagoodman wagoodman enabled auto-merge (squash) August 20, 2025 18:28
@wagoodman wagoodman merged commit ca14089 into anchore:main Aug 20, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants