Skip to content

Upload local Pants PEXs to release - #19450

Merged
kaos merged 4 commits into
mainfrom
jcannon/uploadPEXs
Jul 14, 2023
Merged

Upload local Pants PEXs to release#19450
kaos merged 4 commits into
mainfrom
jcannon/uploadPEXs

Conversation

@thejcannon

@thejcannon thejcannon commented Jul 11, 2023

Copy link
Copy Markdown
Member

From #19443 and fixes #18434 (lol)

This change does 2 things:

  • Eliminates the PEX building from release.py in favor of just ./pants package src/python/pants:pants-pex. It isn't universal, but we're moving away from the universal PEX.
  • Tweaks CI to package this PEX, and if this is a release, upload the PEX to the GitHub release
  • (plus docs changes)

@thejcannon

Copy link
Copy Markdown
Member Author

This PR currently depends on changed from #19444, so it's draft until that gets merged and I can update this branch.

It stands on its own though, so please do review.

Comment thread src/python/pants/BUILD
Comment on lines +43 to +51
pex_binary(
name="pants-pex",
dependencies=[":pants-packaged"],
script="pants",
execution_mode="venv",
shebang="/usr/bin/env python",
strip_pex_env=False,
layout="zipapp",
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was copied from release.py, but without the --platforms flag. As I understand it, this will resolve only for the local platform, so that's exactly what we want!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I also am hardcoding zipapp PEX to guard against __defaults__ accidentally changing that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe that you understand correctly.

"if": "needs.release_info.outputs.is-release == 'true'",
"run": dedent(
"""\
LOCAL_TAG=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import sys;major, minor = sys.version_info[:2];import os;uname = os.uname();print(f'cp{major}{minor}-{uname.sysname.lower()}_{uname.machine.lower()}')")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is my assume-nothing way of generating the tag. Using the PEX itself means we'll land the right IC, and using Python means we'll be confident scie-pants's Python script can produce a similar tag.

The value looks like: cp39_linux_x86_64

Comment on lines -713 to -715
# TODO: We should be using `./pants package` and `pex_binary` for this...If Pants is lacking in
# capabilities, we should improve Pants. When porting, using `runtime_package_dependencies` to do
# the validation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🎉

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wrote this todo, so I'm extra psyched that it's now done!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

To be extremely fair, I don't think we can technically build a "universal" PEX still, but also that's hand wavy anyways

@thejcannon thejcannon added this to the 2.15.x milestone Jul 12, 2023
@thejcannon thejcannon removed this from the 2.15.x milestone Jul 12, 2023
@thejcannon
thejcannon marked this pull request as ready for review July 13, 2023 00:01
@thejcannon

Copy link
Copy Markdown
Member Author

This looks good to review 👍

Comment thread src/python/pants_release/generate_github_workflows.py
Comment thread src/python/pants_release/release.py
@thejcannon

thejcannon commented Jul 14, 2023

Copy link
Copy Markdown
Member Author

(FYI @benjyw @huonw @Eric-Arellano)

I'm going to work with @kaos to give this a deadline of before-he-starts-releasing so we can let this see some runtime, and gives us a chance to stabilize any issues. If anything goes awry we can always run with the code prior to the change, or revert.

We're also not cherry-picking so that we do get this time to stabilize, and so that we can have one consistent "start version" for the change (even though aspects might be uploaded to older releases)

Feel free to review post-mortem and I'll do a follow-up PR.

@benjyw benjyw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent!


This will tag the release with your PGP key, and push the tag to origin, which will kick off a [`Release` job](https://github.com/pantsbuild/pants/actions/workflows/release.yaml) to build the wheels and publish them to PyPI.

Step 4: Release a Pants PEX

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All this red makes me happy!

Comment thread src/python/pants/BUILD
Comment on lines +43 to +51
pex_binary(
name="pants-pex",
dependencies=[":pants-packaged"],
script="pants",
execution_mode="venv",
shebang="/usr/bin/env python",
strip_pex_env=False,
layout="zipapp",
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe that you understand correctly.

Comment on lines -713 to -715
# TODO: We should be using `./pants package` and `pex_binary` for this...If Pants is lacking in
# capabilities, we should improve Pants. When porting, using `runtime_package_dependencies` to do
# the validation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wrote this todo, so I'm extra psyched that it's now done!

@kaos
kaos merged commit de1a361 into main Jul 14, 2023
@kaos
kaos deleted the jcannon/uploadPEXs branch July 14, 2023 20:54
huonw added a commit that referenced this pull request Sep 24, 2023
This updates our docs to refer to the new release process, using GitHub
Releases, instead of PyPI. The `pantsbuild.pants` package becomes
somewhat of an implementation detail too, so I've adjusted these too.

Also, the docs previously referred to the universal PEX we published to
GitHub Releases which we no longer do (#19450), and thus references to
it are removed too.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Andreas Stenius <andreas.stenius@imanage.com>
WorkerPants pushed a commit that referenced this pull request Sep 24, 2023
This updates our docs to refer to the new release process, using GitHub
Releases, instead of PyPI. The `pantsbuild.pants` package becomes
somewhat of an implementation detail too, so I've adjusted these too.

Also, the docs previously referred to the universal PEX we published to
GitHub Releases which we no longer do (#19450), and thus references to
it are removed too.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Andreas Stenius <andreas.stenius@imanage.com>
huonw added a commit that referenced this pull request Sep 24, 2023
…ick of #19924) (#19930)

This updates our docs to refer to the new release process, using GitHub
Releases, instead of PyPI. The `pantsbuild.pants` package becomes
somewhat of an implementation detail too, so I've adjusted these too.

Also, the docs previously referred to the universal PEX we published to
GitHub Releases which we no longer do (#19450), and thus references to
it are removed too.

Co-authored-by: Huon Wilson <huon@exoflare.io>
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Andreas Stenius <andreas.stenius@imanage.com>
huonw added a commit that referenced this pull request Sep 24, 2023
This updates our docs to refer to the new release process, using GitHub
Releases, instead of PyPI. The `pantsbuild.pants` package becomes
somewhat of an implementation detail too, so I've adjusted these too.

Also, the docs previously referred to the universal PEX we published to
GitHub Releases which we no longer do (#19450), and thus references to
it are removed too.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Andreas Stenius <andreas.stenius@imanage.com>
huonw added a commit that referenced this pull request Sep 24, 2023
…ick of #19924) (#19936)

This updates our docs to refer to the new release process, using GitHub
Releases, instead of PyPI. The `pantsbuild.pants` package becomes
somewhat of an implementation detail too, so I've adjusted these too.

Also, the docs previously referred to the universal PEX we published to
GitHub Releases which we no longer do (#19450), and thus references to
it are removed too.

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Andreas Stenius <andreas.stenius@imanage.com>
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.

Pants pex release includes wrong pants wheels

4 participants