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

[CI] Allow any python version for pre-commit #184

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

sergey-kozub
Copy link
Contributor

Currently "pre-commit" doesn't work if python3.9 is not installed (e.g. on a typical Ubuntu which has python3.12)

@sergey-kozub
Copy link
Contributor Author

sergey-kozub commented Sep 11, 2024

@jakevdp Github doesn't allow me to assign reviewers to this PR - is this intended?

@jakevdp
Copy link
Collaborator

jakevdp commented Sep 11, 2024

Thanks - I wonder if this change will cause flakiness across systems? My understanding is that this not only controls the python version used to run the hook, but also the precise set of rules enforced by pyink. Do you know if that's right?

@jakevdp
Copy link
Collaborator

jakevdp commented Sep 11, 2024

From the PyInk docs:

        # It is recommended to specify the latest version of Python
        # supported by your project here, or alternatively use
        # pre-commit's default_language_version, see
        # https://pre-commit.com/#top_level-default_language_version
        language_version: python3.9

Perhaps we should use python3.12 here instead?

@jakevdp jakevdp self-assigned this Sep 11, 2024
@jakevdp jakevdp self-requested a review September 11, 2024 16:37
@sergey-kozub
Copy link
Contributor Author

My understanding is that this not only controls the python version used to run the hook, but also the precise set of rules enforced by pyink. Do you know if that's right?

I checked pyink sources, and the python version defines the set of features supported by the language version:
https://github.com/google/pyink/blob/eebe6ee90e6d57d9276303614ac5e640f2ff79d3/src/pyink/mode.py#L141

This set is backwards compatible, i.e. features are only added, not removed, so I believe bumping the version up to 3.12 should be safe from pyink perspective.

@sergey-kozub
Copy link
Contributor Author

Perhaps we should use python3.12 here instead?

Updated the PR.

@jakevdp
Copy link
Collaborator

jakevdp commented Sep 16, 2024

It looks like we'll also need to update the Python version for the lint job in the test.yml file:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet:actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # ratchet:actions/setup-python@v5
with:
python-version: 3.9
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # ratchet: pre-commit/action@v3

@sergey-kozub
Copy link
Contributor Author

It looks like we'll also need to update the Python version for the lint job in the test.yml file:

Good catch, I haven't noticed this.
How do I test the change? There are some "ratchet" hashes around these lines, I'm not sure if those should also be updated.

Copy link
Collaborator

@jakevdp jakevdp left a comment

Choose a reason for hiding this comment

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

Thanks!

@jakevdp
Copy link
Collaborator

jakevdp commented Sep 16, 2024

There was a problem with pulldown. Could you rebase on main to trigger a new job?

@sergey-kozub
Copy link
Contributor Author

There was a problem with pulldown. Could you rebase on main to trigger a new job?

Rebased on main.

@copybara-service copybara-service bot merged commit 15e3d0a into jax-ml:main Sep 17, 2024
13 checks passed
@sergey-kozub sergey-kozub deleted the pre-commit-config branch October 3, 2024 07:44
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.

2 participants