#123 Custom attributes must be protected#124
Conversation
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
|
A little bit afraid of this one. It can break if we add to Conan any field (also dynamic ones) and we might not notice it until all the PRs in ConanCenter fail. For example, here you are missing This is a nice hook, but I will make it a warning, not an error. wdyt? |
Do you mean protected Conan fields? But we are not allowed to use it in CCI because we can't ensure them for breaking, we only use public and exported methods.
I didn't understand,
The problem using warning level is that we need to build when reviewing and checking the log, OR read output logs from CI. IMO it doesn't work, repetitive human review is susceptible to failure. |
|
|
|
@SSE4 Indeed the example on https://docs.conan.io/en/latest/extending/python_requires.html#extending-base-classes shows its usage, but I didn't find any reference with details. |
|
My concern is that you have added @SSE4 Agree it needs better docs, it should appear in the text, not only in the example. |
|
Nice explanation, thanks @jgsogo ! |
| @run_test("KB-H035", output) | ||
| def test(out): | ||
| mock = ConanFile(conanfile.output, None) | ||
| valid_attrs = [attr for attr in dir(mock) if not callable(attr)] + ['conan_data', 'python_requires'] |
There was a problem hiding this comment.
At least, here we need python_requires_extend too. And for 1.26 we should handle new attributes/functions that could result of this PR conan-io/conan#6945
basic_load, because it requires a conan recipe (file) to be loaded. Also, the loaded injects some attributes, which are not present in the Conanfile, so I checked them adding the attributes by their names (conan_data and python_requires)closes #123
Wiki:
#KB-H035: "CUSTOM ATTRIBUTES"
When a new attribute have to be added to the recipe, and it is not a default one provided by ConanFile, it must added as protected member: