The documentation at https://docs.conan.io/en/latest/extending/python_requires.html#resolution-of-python-requires states that:
python-requires can python-require other recipes too, but this should probably be limited to very few cases, we recommend to use the simplest possible structure.
But it is unclear how that should work.
I made an example where I define a base class in a python_requires module. This base class uses a helper function from another python_requires module. How can I transitively define that the base class has another python_requires? At the moment I can only get it to work by specifying all python_requires explicitly in the consumer.
Example: transitive-python_requires.tar.gz
To run the example:
conan export shared-functionconan export base-classconan create consumerIt will fail with:
ERROR: consumer/1.0.0: Error in requirements() method, line 8
assert self.python_requires["shared-function"].module.helper(1, 2) == 3
ConanException: 'shared-function' is not a python_require
Alternatively, using the old python_requires method results in a crash.
Hi @RobvanderMost-TomTom,
I tried to reproduce your case and I couldn't make it work indeed. I have opened a PR providing a test case for that here https://github.com/conan-io/conan/pull/8604. I am not sure if the base-class there is similar to what you have, so please comment there in order to have your use case reproduced in that test. I will figure out if that case is supported or not and then declare this a bug or document it properly. Thank you
It seems that this case was not supported with the new python requires syntax as we had a specific case testing that. We are working on a fix in #8604 but we have to consider the implications of it before targeting it for a future release