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

warn if private imports from custom commands #17664

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Jan 29, 2025

Changelog: Omit
Docs: https://github.com/conan-io/docs/pull/XXXX

The output will be a summary:

WARN: ********************************************************************************
WARN: Forbidden internal import'from conan.internal' in:
WARN:     T:\tmp7dfhixvmconans\path with spaces\.conan2\extensions\commands\cmd_mycache.py
WARN: Forbidden internal import'from conans' in:
WARN:     T:\tmp7dfhixvmconans\path with spaces\.conan2\extensions\commands\cmd_mycache.py
WARN: 
WARN: These imports will change in future releases
WARN: Please, use only public documented API in docs.conan.io
WARN: ********************************************************************************
DATA_YML: conandata.yml

@memsharded memsharded added this to the 2.13.0 milestone Jan 29, 2025
@memsharded memsharded marked this pull request as ready for review February 4, 2025 09:09
@memsharded
Copy link
Member Author

Dropping this, it will be problematic:

  • It only applies to custom commands, not other usages of Conan API
  • It cannot be silenced with core:skip_warnings because the loading of imports happen earlier than processing the arguments
  • For same reason, it cannot be made warn-as-errors
  • Users already using imports, or accepting they might be broken will not have a way to silence the warnings, and will be annoying

Unless a better way that can be silenced, and hopefully more generic, this seems not worth the complexity and risk.

@memsharded memsharded closed this Feb 4, 2025
@memsharded memsharded deleted the feature/protect_imports_customcommands branch February 4, 2025 16:12
@czoido czoido removed this from the 2.13.0 milestone Feb 5, 2025
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.

4 participants