Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Unclear how to use transitive python_requires #8546

Closed
1 task done
RobvanderMost-TomTom opened this issue Feb 24, 2021 · 2 comments · Fixed by #8604
Closed
1 task done

[question] Unclear how to use transitive python_requires #8546

RobvanderMost-TomTom opened this issue Feb 24, 2021 · 2 comments · Fixed by #8604
Assignees
Milestone

Comments

@RobvanderMost-TomTom
Copy link

RobvanderMost-TomTom commented Feb 24, 2021

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-function
  • conan export base-class
  • conan create consumer

It 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.

@danimtb
Copy link
Member

danimtb commented Mar 4, 2021

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 #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

@danimtb
Copy link
Member

danimtb commented Mar 4, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants