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

Upgrade pants from 2.15 to 2.16.0a0 #5932

Merged
merged 11 commits into from
Mar 17, 2023
Merged

Upgrade pants from 2.15 to 2.16.0a0 #5932

merged 11 commits into from
Mar 17, 2023

Conversation

cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Mar 11, 2023

Background

This is another part of introducing pants, as discussed in various TSC meetings.

Related PRs can be found in:

Overview of this PR

I recommend stepping through the commits to review this PR. Ignore the "fix typo in st2actions/BUILD" commit, as it is part of #5931, which should be merged first.

This updates to pants to 2.16.0a0 which only requires:

  • regenerate the pants-plugins lockfile
  • regenerate the st2 lockfile

Unlike the upgrade to 2.15 (#5899), we do not need to update our pants-plugins because they don't use anything that changed (see the Plugin upgrade guide).

Upgrading to 2.16 gives us access to some new features and allows us to delete some of our BUILD metadata:

  • Several module_mapping definitions were upstreamed, so we no longer need to define them locally.
  • pants.backend.experimental.python.framework.stevedore: The plugin I wrote to tell pants how to manage including runners and other stevedore plugins when the tests need them to be available.
  • Uncomment env("ST2_PUBLISH_REPO") in pants-plugins/macros.py (added in pants: Add st2_*_python_distribution() macros to pants-plugins/macros.py #5901) so that we can use the ST2_PUBLISH_REPO env var to determine where we want to publish the wheels (eg to use @testpypi instead of @pypi).
  • The python-dump-source-analysis goal makes debugging dependency inference much easier. And, it was the final piece we needed to be able to use [python-infer].string_imports so that pants can infer python dependencies from strings, not just the actual imports. That made it possible to delete some of our BUILD metadata.
  • The [python-infer].ambiguity_resolution = "by_source_root" option made dependency inference a little smarter. This way, when something imports tests.base, it will use the closest tests.base instead of complaining about all of the different directories that define that. That made it possible to delete even more of the BUILD metadata, as those deps are no longer ambiguous.
  • Turn on diff output when using generate-lockfiles (does not display when our git deps change, but it helps for everything else). This is what it looked like when I regenerated the st2 lockfile (see the screenshots in Print diff report when generating new lockfiles. pantsbuild/pants#17347 as well):
    image

In a follow-up I will add support for:

  • pants.backend.experimental.visibility which gives us access to __dependency_rules__ and __dependents_rules__. This is a much more intelligent way to avoid circular imports (eg st2common does not import st2api) than the regex-lint based approach. This needs a few more bug fixes before we can use it.

Pants documentation

@cognifloyd cognifloyd added this to the pants milestone Mar 11, 2023
@cognifloyd cognifloyd self-assigned this Mar 11, 2023
@pull-request-size pull-request-size bot added the size/XL PR that changes 500-999 lines. Consider splitting work into several ones that easier to review. label Mar 11, 2023
@cognifloyd cognifloyd force-pushed the pants-upgrade-2.16 branch 5 times, most recently from 96d23e5 to 3be21fe Compare March 12, 2023 00:29
@cognifloyd cognifloyd marked this pull request as ready for review March 12, 2023 00:57
@cognifloyd cognifloyd changed the title Upgrade pants from 2.15 to 2.16 Upgrade pants from 2.15 to 2.16.0a0 Mar 12, 2023
@cognifloyd cognifloyd marked this pull request as draft March 12, 2023 02:28
@cognifloyd

This comment was marked as resolved.

@cognifloyd

This comment was marked as resolved.

@cognifloyd cognifloyd marked this pull request as ready for review March 15, 2023 17:59
@cognifloyd cognifloyd requested a review from a team March 15, 2023 18:53
@cognifloyd cognifloyd merged commit c3fc181 into master Mar 17, 2023
@cognifloyd cognifloyd deleted the pants-upgrade-2.16 branch March 17, 2023 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pantsbuild size/XL PR that changes 500-999 lines. Consider splitting work into several ones that easier to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants