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

Pre-commit: Specify default python version, rely on shebang #90662

Closed

Conversation

akien-mga
Copy link
Member

@akien-mga akien-mga commented Apr 14, 2024

Alternative to #90634, needs testing.

Works for me on Linux with a python3 in PATH. Not sure how reliable this approach is, it's unclear for me in the pre-commit docs how running Python scripts should be done properly. The default version is defined following https://pre-commit.com/#overriding-language-version (but I tried e.g. with python2 and it fails as it tries to start a python2 venv from python3 which doesn't work... so not sure how much this is helping).

You can test with pre-commit run --all.

CC @nlupugla @bruvzg

@chrisl8
Copy link
Contributor

chrisl8 commented Apr 14, 2024

This did not work for me on Windows. It works better than the default setup (without making any system modifications), but some thing still fail.

PS C:\Users\chris\CLionProjects\godot> pre-commit run --all
[INFO] Installing environment for https://github.com/pre-commit/mirrors-clang-format.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black-pre-commit-mirror.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
clang-format.............................................................Passed
black....................................................................Passed
make-rst.................................................................Failed
- hook id: make-rst
- exit code: 1

[WinError 3] The system cannot find the path specified

copyright-headers........................................................Passed
dotnet-format............................................................Passed

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

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

This will use shebang in the scripts, so on macOS dotnet_format.py will fail since it's using python (it's also missing +x so won't run at all). I do not think default_language_version do anything at all.

@akien-mga akien-mga marked this pull request as draft May 8, 2024 14:31
@akien-mga
Copy link
Member Author

This doesn't work, so closing.

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.

None yet

4 participants