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

Improve error message for dependencies on incompatible Python resolves #15416

Merged
merged 3 commits into from
May 13, 2022

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented May 12, 2022

Closes #14864.

This code is written generically so that we can hook it up to JVM easily.

[ci skip-rust]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]
@Eric-Arellano
Copy link
Contributor Author

bad depencencies w/ single root (test):

NoCompatibleResolveException: The target src/python/pants/util/strutil_test.py:tests uses the `resolve` `python-default`, but some of its dependencies are not compatible with that resolve:

  * src/python/pants/util/osutil_test.py:tests (another)

All dependencies must work with the same `resolve`. To fix this, either change the `resolve=` field on those dependencies to `python-default`, or change the `resolve=` of the target src/python/pants/util/strutil_test.py:tests. If those dependencies should work with multiple resolves, use the `parametrize` mechanism with the `resolve=` field or manually create multiple targets for the same entity.

For more information, see https://www.pantsbuild.org/v2.13/docs/python-third-party-dependencies#multiple-lockfiles.

bad dependencies w/ multiple roots (check):

NoCompatibleResolveException: The inputted targets use the `resolve` `python-default`, but some of their dependencies are not compatible with that resolve.

Input targets:

  * src/python/pants/util/dirutil_test.py:tests
  * src/python/pants/util/strutil_test.py:tests

Bad dependencies:

  * src/python/pants/util/osutil_test.py:tests (another)

All dependencies must work with the same `resolve`. To fix this, either change the `resolve=` field on those dependencies to `python-default`, or change the `resolve=` of the input targets. If those dependencies should work with multiple resolves, use the `parametrize` mechanism with the `resolve=` field or manually create multiple targets for the same entity.

For more information, see https://www.pantsbuild.org/v2.13/docs/python-third-party-dependencies#multiple-lockfiles.

repl with bad input roots:

NoCompatibleResolveException: The input targets did not have a resolve in common.

another:
  * src/python/pants/util/osutil_test.py:tests

python-default:
  * src/python/pants/util/strutil_test.py:tests

Targets used together must use the same resolve, set by the `resolve` field. For more information on 'resolves' (lockfiles), see https://www.pantsbuild.org/v2.13/docs/python-third-party-dependencies#multiple-lockfiles.

To work around this, choose which resolve you want to use from above. Then, run `./pants peek :: | jq -r '.[] | select(.resolve == "example") | .["address"]' | xargs ./pants repl`, where you replace "example" with the resolve name, and possibly replace the specs `::` with what you were using before. If the resolve is the `[python].default_resolve`, use `select(.resolve == "example" or .resolve == null)`. These queries will result in opening a REPL with only targets using the desired 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]
Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Looks great: thanks!

pants.toml Outdated Show resolved Hide resolved
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]
@Eric-Arellano Eric-Arellano changed the title Improve error message for dependencies on incompatible resolves Improve error message for dependencies on incompatible Python resolves May 13, 2022
@Eric-Arellano Eric-Arellano merged commit 59714cc into pantsbuild:main May 13, 2022
@Eric-Arellano Eric-Arellano deleted the error-message-resolves branch May 13, 2022 01:05
Eric-Arellano added a commit to Eric-Arellano/pants that referenced this pull request May 13, 2022
…ves (pantsbuild#15416)

Closes pantsbuild#14864.

This code is written generically so that we can hook it up to JVM easily.

[ci skip-rust]
Eric-Arellano added a commit to Eric-Arellano/pants that referenced this pull request May 13, 2022
…ves (pantsbuild#15416)

Closes pantsbuild#14864.

This code is written generically so that we can hook it up to JVM easily.

[ci skip-rust]
stuhood pushed a commit that referenced this pull request May 13, 2022
…ves (Cherry-pick of #15416) (#15440)

Closes #14864.

This code is written generically so that we can hook it up to JVM easily.

[ci skip-rust]
Eric-Arellano added a commit that referenced this pull request May 13, 2022
…ves (Cherry-pick of #15416) (#15439)

Closes #14864.

This code is written generically so that we can hook it up to JVM easily.

[ci skip-rust]
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.

NoCompatibleResolveException should suggest remedies
2 participants