-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Improve help
and error message for [python-infer].unowned_dependency_behavior
#15334
Merged
Eric-Arellano
merged 8 commits into
pantsbuild:main
from
Eric-Arellano:improve-unowned-deps-err-msg
May 10, 2022
Merged
Improve help
and error message for [python-infer].unowned_dependency_behavior
#15334
Eric-Arellano
merged 8 commits into
pantsbuild:main
from
Eric-Arellano:improve-unowned-deps-err-msg
May 10, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…cy_behavior` # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust]
Eric-Arellano
changed the title
Improve
WIP: Improve May 4, 2022
help
and error message for [python-infer].unowned_dependency_behavior
help
and error message for [python-infer].unowned_dependency_behavior
Eric-Arellano
changed the title
WIP: Improve
Improve May 5, 2022
help
and error message for [python-infer].unowned_dependency_behavior
help
and error message for [python-infer].unowned_dependency_behavior
Eric-Arellano
commented
May 5, 2022
if unowned_dependency_behavior is UnownedDependencyUsage.LogWarning: | ||
logger.warning(msg) | ||
else: | ||
raise UnownedDependencyError(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We before were logging at ERROR level, and then raising an error. I didn't see much benefit to splitting it up like that.
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
This was referenced May 5, 2022
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
stuhood
approved these changes
May 9, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
This caught a bug when the target has multiple resolves. I want to make sure we handle when a target has a single resolve # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
Eric-Arellano
added a commit
to Eric-Arellano/pants
that referenced
this pull request
May 10, 2022
…cy_behavior` (Cherry-pick of pantsbuild#15334) This mostly points at https://www.pantsbuild.org/v2.11/docs/troubleshooting#import-errors-and-missing-dependencies because we decided it was too noisy of a warning/error message to reproduce the whole guide. We want the terminal to highlight diagnostics unique to the particular issue, and leave general guidance elsewhere. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` Closes pantsbuild#15326 by improving the error message when resolves are likely the culprit. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) These imports are not in the resolve used by the target (`another`), but they were present in other resolves: * pants.util.strutil.bullet_list: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_binary: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_text: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.first_paragraph: 'python-default' from src/python/pants/util/strutil.py ... * pytest: 'python-default' from 3rdparty/python#pytest If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` [ci skip-rust] # Conflicts: # src/python/pants/backend/python/dependency_inference/rules.py # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
Eric-Arellano
added a commit
that referenced
this pull request
May 10, 2022
…cy_behavior` (Cherry-pick of #15334) (#15389) * Improve `help` and error message for `[python-infer].unowned_dependency_behavior` (Cherry-pick of #15334) This mostly points at https://www.pantsbuild.org/v2.11/docs/troubleshooting#import-errors-and-missing-dependencies because we decided it was too noisy of a warning/error message to reproduce the whole guide. We want the terminal to highlight diagnostics unique to the particular issue, and leave general guidance elsewhere. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` Closes #15326 by improving the error message when resolves are likely the culprit. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) These imports are not in the resolve used by the target (`another`), but they were present in other resolves: * pants.util.strutil.bullet_list: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_binary: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_text: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.first_paragraph: 'python-default' from src/python/pants/util/strutil.py ... * pytest: 'python-default' from 3rdparty/python#pytest If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` [ci skip-rust]
Eric-Arellano
added a commit
to Eric-Arellano/pants
that referenced
this pull request
May 10, 2022
…cy_behavior` (pantsbuild#15334) This mostly points at https://www.pantsbuild.org/v2.11/docs/troubleshooting#import-errors-and-missing-dependencies because we decided it was too noisy of a warning/error message to reproduce the whole guide. We want the terminal to highlight diagnostics unique to the particular issue, and leave general guidance elsewhere. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` Closes pantsbuild#15326 by improving the error message when resolves are likely the culprit. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) These imports are not in the resolve used by the target (`another`), but they were present in other resolves: * pants.util.strutil.bullet_list: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_binary: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_text: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.first_paragraph: 'python-default' from src/python/pants/util/strutil.py ... * pytest: 'python-default' from 3rdparty/python#pytest If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
Eric-Arellano
added a commit
that referenced
this pull request
May 11, 2022
…cy_behavior` (Cherry-pick of #15334) (#15391) This mostly points at https://www.pantsbuild.org/v2.11/docs/troubleshooting#import-errors-and-missing-dependencies because we decided it was too noisy of a warning/error message to reproduce the whole guide. We want the terminal to highlight diagnostics unique to the particular issue, and leave general guidance elsewhere. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` Closes #15326 by improving the error message when resolves are likely the culprit. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) These imports are not in the resolve used by the target (`another`), but they were present in other resolves: * pants.util.strutil.bullet_list: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_binary: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_text: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.first_paragraph: 'python-default' from src/python/pants/util/strutil.py ... * pytest: 'python-default' from 3rdparty/python#pytest If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` [ci skip-rust]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This mostly points at https://www.pantsbuild.org/v2.11/docs/troubleshooting#import-errors-and-missing-dependencies because we decided it was too noisy of a warning/error message to reproduce the whole guide. We want the terminal to highlight diagnostics unique to the particular issue, and leave general guidance elsewhere.
Closes #15326 by improving the error message when resolves are likely the culprit.
[ci skip-rust]