Skip to content

Conversation

araffin
Copy link
Contributor

@araffin araffin commented Sep 26, 2025

Changelog: (Feature): export recipe, is_editable and is_platform in the ConanFileInterface (fixes a TODO from the dependencies)

closes #18996

  • explicit exports using the __all__ variable

Some additional context: currently there is no easy way for a generator to know if a dependency is editable, platform, ...
This PR exposes the recipe via the ConanFileInterface so users don't have to use private method to have the info.

For the __all__ keywords, this makes it explicit what Conan exports and avoid "unused import" warnings with linters.

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2025

CLA assistant check
All committers have signed the CLA.

@memsharded memsharded self-assigned this Sep 26, 2025
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @araffin

I am afraid that it is not very clear what problem is being solved. It would be better to file an issue first to discuss the need of exposing certain things over the ConanFileInterface, as commented below, some of those things might even be an anti-pattern

data = OrderedDict((k, v) for k, v in data.items()
# TODO: Make "recipe" part of ConanFileInterface model
if v._conanfile._conan_node.recipe != RECIPE_PLATFORM)
data = OrderedDict((k, v) for k, v in data.items() if not v.is_platform)
Copy link
Member

Choose a reason for hiding this comment

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

This was done this way because we didn't want to expose this as part of the interface to consumers.
The idea that it is a platform thing should be transparent to consumers, if consumers need to check this, it is probably an anti-pattern

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.

[feature] Expose recipe to generators
3 participants