-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
Fix performance for generating lockfiles for pytest
and setuptools
#16591
Fix performance for generating lockfiles for pytest
and setuptools
#16591
Conversation
# 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]
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.
Thanks!
# If no Python targets in repo, fall back to MyPy constraints. | ||
assert_lockfile_request("target()", MyPy.default_interpreter_constraints) |
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.
I don't quite understand this change. But if there are no python targets in the repository, then it probably doesn't matter which we use...?
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.
It's because the rule helper says or python_setup.interpreter_constraints
when there were no interpreter constraints. Whereas the old bespoke code said or mypy.interpretre_constraints
. That's pretty unlikely to happen -- it's only when there are zero MyPy compatible targets in the repo.
pantsbuild#16591) Follow up to pantsbuild#15531. We didn't apply the optimization for Pytest and setuptools that it is no longer necessary to consult `TransitiveTargets` to determine interpreter constraints for `generate-lockfiles`, purely out of oversight. This also leverages `@rule_helper` to DRY some of our interpreter constraints code for lockfiles. That results in these slight behavior changes: * MyPy and Black are fixed to properly OR distinct interpreter constraints. We always meant to do this. * If MyPy does not encounter any MyPy-compatible targets in the repo, we fall back to `[python].interpreter_constraints` rather than the default `[mypy].interpreter_constraints`. This situation is unlikely to happen. In `pantsbuild/pants`, it now takes us 0.4 seconds rather than 4.7 seconds to calculate the interpreter constraints for `./pants generate-lockfiles --resolve=pytest`. [ci skip-rust] [ci skip-build-wheels]
…` (Cherry-pick of #16591) (#16596) Follow up to #15531. We didn't apply the optimization for Pytest and setuptools that it is no longer necessary to consult `TransitiveTargets` to determine interpreter constraints for `generate-lockfiles`, purely out of oversight. This also leverages `@rule_helper` to DRY some of our interpreter constraints code for lockfiles. That results in these slight behavior changes: * MyPy and Black are fixed to properly OR distinct interpreter constraints. We always meant to do this. * If MyPy does not encounter any MyPy-compatible targets in the repo, we fall back to `[python].interpreter_constraints` rather than the default `[mypy].interpreter_constraints`. This situation is unlikely to happen. In `pantsbuild/pants`, it now takes us 0.4 seconds rather than 4.7 seconds to calculate the interpreter constraints for `./pants generate-lockfiles --resolve=pytest`. [ci skip-rust] [ci skip-build-wheels]
pantsbuild#16591) Follow up to pantsbuild#15531. We didn't apply the optimization for Pytest and setuptools that it is no longer necessary to consult `TransitiveTargets` to determine interpreter constraints for `generate-lockfiles`, purely out of oversight. This also leverages `@rule_helper` to DRY some of our interpreter constraints code for lockfiles. That results in these slight behavior changes: * MyPy and Black are fixed to properly OR distinct interpreter constraints. We always meant to do this. * If MyPy does not encounter any MyPy-compatible targets in the repo, we fall back to `[python].interpreter_constraints` rather than the default `[mypy].interpreter_constraints`. This situation is unlikely to happen. In `pantsbuild/pants`, it now takes us 0.4 seconds rather than 4.7 seconds to calculate the interpreter constraints for `./pants generate-lockfiles --resolve=pytest`. [ci skip-rust] [ci skip-build-wheels]
Follow up to #15531. We didn't apply the optimization for Pytest and setuptools that it is no longer necessary to consult
TransitiveTargets
to determine interpreter constraints forgenerate-lockfiles
, purely out of oversight.This also leverages
@rule_helper
to DRY some of our interpreter constraints code for lockfiles. That results in these slight behavior changes:[python].interpreter_constraints
rather than the default[mypy].interpreter_constraints
. This situation is unlikely to happen.In
pantsbuild/pants
, it now takes us 0.4 seconds rather than 4.7 seconds to calculate the interpreter constraints for./pants generate-lockfiles --resolve=pytest
.[ci skip-rust]
[ci skip-build-wheels]