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

resolve pants plugins using direct pex invocations #21986

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Feb 21, 2025

As part of implementing #21985 to reduce the scope of the bootstrap scheduler, modify the plugin resolution rules to invoke pex directly without using any of the Pex machinery in the Python backend (e.g., CompletePexEnvironent and other support classes). This should permit future work to remove the Python backend from the bootstrap scheduler.

The plugin does consume a few subsystems from the Python backend for configuration, but no rule logic aside from the PexCli download logic which has been moved to its own file.

The direct pex calls are based on the calls performed for VenvPex-style internal venv pex files.

@tdyas tdyas added category:internal CI, fixes for not-yet-released features, etc. release-notes:not-required PR doesn't require mention in release notes labels Feb 21, 2025
@tdyas tdyas marked this pull request as draft February 21, 2025 06:07
@tdyas
Copy link
Contributor Author

tdyas commented Feb 21, 2025

Back to draft while I figure out why this works locally but not in CI.

@tdyas tdyas marked this pull request as ready for review February 21, 2025 06:40
@tdyas
Copy link
Contributor Author

tdyas commented Feb 21, 2025

Fixed that issue in CI. Ready for review again.


logger = logging.getLogger(__name__)


class PexCli(TemplatedExternalTool):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this class to pex_cli_tool.py so that plugin resolution could depend directly on the Pex download rules.

from pants.util.logging import LogLevel

logger = logging.getLogger(__name__)


@dataclass(frozen=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vendored these two classes and function from VenvScriptWriter to avoid the dependency on Python backend.

@sureshjoshi
Copy link
Member

Does this PR introduce any numerical perf differences?

@tdyas
Copy link
Contributor Author

tdyas commented Feb 21, 2025

Does this PR introduce any numerical perf differences?

I haven't measured yet since I'm still working through its correctness given the test failure in _do_test_exact_requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc. release-notes:not-required PR doesn't require mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants