Skip to content

Update pants.yaml - #113

Merged
benjyw merged 1 commit into
pantsbuild:mainfrom
Kludex:patch-3
Nov 14, 2022
Merged

benjyw merged 1 commit into
pantsbuild:mainfrom
Kludex:patch-3

Conversation

@Kludex

@Kludex Kludex commented Nov 13, 2022

Copy link
Copy Markdown
Contributor

This is not obvious... I just noticed because I checked the version on the pipeline. Why do we even run "actions/setup-python" on this pipeline?

@Eric-Arellano
Eric-Arellano requested a review from benjyw November 14, 2022 16:14

@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.

Aaargh, this is subtle, but:

  • pants-python-version ensures that a python interpreter suitable for running Pants on exists on the system. I guess the default was 3.9, so we got lucky, but your fix is absolutely correct.
  • Generally, a CI job might want to use setup-python separately to ensure that a python interpreter it needs for testing its own code is available. And since this repo is intended to be an example, it's probably a good idea for it to demonstrate that.

However, what we should add is a lot of comments explaining this...

@benjyw
benjyw merged commit e5cd4ce into pantsbuild:main Nov 14, 2022
@benjyw

benjyw commented Nov 14, 2022

Copy link
Copy Markdown
Contributor

Actually now that I think of it, it's not that 3.9 was the default and we got lucky, it's that we installed 3.9 anyway, because of the explicit use of setup-python...

@benjyw

benjyw commented Nov 14, 2022

Copy link
Copy Markdown
Contributor

PS thanks for these fixes! One suggestion I have is, in the future, to give more descriptive PR titles. E.g., " Set the pants python version correctly in CI" rather than "Update pants.yaml", since the latter doesn't tell me anything about the reason for the update...

@Kludex
Kludex deleted the patch-3 branch November 14, 2022 16:44
@Kludex

Kludex commented Nov 14, 2022

Copy link
Copy Markdown
Contributor Author

Generally, a CI job might want to use setup-python separately to ensure that a python interpreter it needs for testing its own code is available. And since this repo is intended to be an example, it's probably a good idea for it to demonstrate that.

Yeah... I'd like a demonstration about what you mean here.

Actually now that I think of it, it's not that 3.9 was the default and we got lucky, it's that we installed 3.9 anyway, because of the explicit use of setup-python...

I don't get what you mean here. Isn't exactly that? The default Python version the action uses is 3.9. The setup-python doesn't matter.

See this pipeline: https://github.com/Kludex/uvicorn-extensions/actions/runs/3456291869/jobs/5768916908
From this set of commits: https://github.com/Kludex/uvicorn-extensions/pull/22/files/b466cb03b2988bb31031c52c312bdf00edaf37f7

@benjyw

benjyw commented Nov 14, 2022

Copy link
Copy Markdown
Contributor

Generally, a CI job might want to use setup-python separately to ensure that a python interpreter it needs for testing its own code is available. And since this repo is intended to be an example, it's probably a good idea for it to demonstrate that.

Yeah... I'd like a demonstration about what you mean here.

Actually now that I think of it, it's not that 3.9 was the default and we got lucky, it's that we installed 3.9 anyway, because of the explicit use of setup-python...

I don't get what you mean here. Isn't exactly that? The default Python version the action uses is 3.9. The setup-python doesn't matter.

See this pipeline: https://github.com/Kludex/uvicorn-extensions/actions/runs/3456291869/jobs/5768916908 From this set of commits: https://github.com/Kludex/uvicorn-extensions/pull/22/files/b466cb03b2988bb31031c52c312bdf00edaf37f7

Ah, that might also be the case. But my point was that we run setup-python twice, and at least one of them with the right python version, just not the semantically correct one...

Really there could be two matrixes here, one for the pants python version and the other for the code python version. It's only this repo that has this complexity, because this yaml file has two roles: 1) the actual CI for this repo and 2) a demonstration of how to set up GHA in a pants repo...

@sureshjoshi

Copy link
Copy Markdown
Member

one for the pants python version

[Rolls dice on scie-jump]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants