Skip to content

Reintroduce settings_yml to config subapi as an interface#19078

Merged
memsharded merged 7 commits into
conan-io:develop2from
AbrilRBS:ar/reintroduce-settings-yml
Oct 20, 2025
Merged

Reintroduce settings_yml to config subapi as an interface#19078
memsharded merged 7 commits into
conan-io:develop2from
AbrilRBS:ar/reintroduce-settings-yml

Conversation

@AbrilRBS

@AbrilRBS AbrilRBS commented Oct 13, 2025

Copy link
Copy Markdown
Member

Changelog: Fix: Reintroduce settings.yml access to config Sub-API.
Docs: Omit

This new approach creates an interface to avoid users having access to non-scheme related methods, as this object won't have the settings values filled.

Maybe the name can be changed, and the interface location can be changed

Closes #19059

…erface to only expose scheme-related oprations
@AbrilRBS AbrilRBS added this to the 2.22.0 milestone Oct 13, 2025
Comment thread conan/api/subapi/config.py Outdated
Comment thread conan/api/subapi/config.py Outdated
Comment thread conan/api/subapi/config.py
AbrilRBS and others added 3 commits October 13, 2025 13:35
I missed them the first time around
Comment thread conan/api/subapi/config.py Outdated
test
\"""
settings = conan_api.config.settings_yml
ConanOutput().info(f"settings.fields: {settings.fields}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

User was commenting about an update use case, it doesn't look possible with this interface. IIRC, something like adding new settings, then saving the file to disk, as a way to create custom variations?

May be worth to investigate a bit further, I wonder why not using settings_user.yml instead.

@AbrilRBS AbrilRBS requested a review from memsharded October 16, 2025 18:01
Comment thread conan/api/conan_api.py
@property
def settings_yml(self):
return load_settings_yml(self._conan_api.home_folder)
if self._settings_yml is None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We still need to be careful with user side code keeping a reference to the returned object, that will not be invalidated and updated after a reinit() after updating the conf.
This would need a private move constructor to keep the internal self._settings_yml reference and just move the new loaded settings.yml into the existing reference.
That sounds too much for this PR, I think lets first make the API available, we can address the issue of dangling references later, very minimal use case.

@memsharded memsharded merged commit e62a3d2 into conan-io:develop2 Oct 20, 2025
16 checks passed
@AbrilRBS AbrilRBS deleted the ar/reintroduce-settings-yml branch October 20, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[question] Replacement API for config.settings_yml?

2 participants