Conversation
65784e2 to
05b36fe
Compare
| @@ -0,0 +1,15 @@ | |||
| - id: selene-system | |||
There was a problem hiding this comment.
Rust-based pre-commit does not work because pre-commit hardcodes the --path to . (source) which leads to build failure with error: found a virtual manifest at <path>/Cargo.toml instead of a package manifest.
Pre-commit maintainer disagrees with making --path configurable so it is not possible to add a rust based hook: pre-commit/pre-commit#2931 unless we somehow make it possible to install the binary from root level.
There was a problem hiding this comment.
I think it's possible to point entry to a custom install script. But we'd need to handle the caching, unless we distribute the executable directly.
There was a problem hiding this comment.
I was unsure if we wanted a custom install script just for the pre-commit use case. I can add it if that's something we are okay with.
There was a problem hiding this comment.
I think it would depend on how it would look like. Caching binaries by version may not be trivial and we don't get the same advantages language: rust gets, which makes me think it's likely not worth the effort to support this.
There was a problem hiding this comment.
Agree. That's why went ahead with only setting up system and docker workflows. Is there some trivial way to make this work by may be a configuration change at our end? I did some preliminary research but did not find much (but then I have not worked with rust ever before).
There was a problem hiding this comment.
Have you looked at how StyLua handles the pre-commit hook?
There was a problem hiding this comment.
Their rust workflow works because they do not use workspaces.
The python workflow seems interesting. We can integrate it, but it would depend on a python package (https://pypi.org/project/release-gitter/) to do the release download for us. If that is something we are okay with, I can add it 👍
There was a problem hiding this comment.
Added GitHub release based pre-commit hook in 5f1a755
| @@ -0,0 +1,15 @@ | |||
| - id: selene-system | |||
There was a problem hiding this comment.
I think it's possible to point entry to a custom install script. But we'd need to handle the caching, unless we distribute the executable directly.
chriscerie
left a comment
There was a problem hiding this comment.
It looks like pre-commit builds docker with docker build ., which causes the light build to be used. This isn't compatible with roblox projects. It also doesn't seem like pre-commit supports changing the build command, so a rather hacky workaround could be to move the selene-musl build to the last in the dockerfile.
Head branch was pushed to by a user without write access
8cd3099 to
5f1a755
Compare
|
@chriscerie @jenstroeger Let me know if there's something else needed from my end to get this through. |
|
I’m currently ooo, I’ll take a look at the changes within the next week or so. |
|
@amitds1997 Are you able to upload the builds under your fork's release? I think that's needed to test selene-github. |
I was able to test it out with this: - repo: https://github.com/amitds1997/selene
rev: d895ab518a9a3fd6e8efe1716fde501dd29fe8ba # The latest commit on the PR branch
hooks:
- id: selene-githubDid not face any issues. The reason I think this should work is that it looks for releases under Kampfkarren/selene's releases (see amitds1997/selene/pyproject.toml#L6). Are you seeing any particular error? |
It works when I have a local copy of selene, but it's breaking when it's not installed: You're right about it using git-url to get the upstream repo. Perhaps where it's breaking is it's missing |
|
Hello. I just started looking into Selene and noticed that this is kind of waiting on me! Sorry about that. I just pushed a new version that should resolve this issue and allow the GitHub install hook to properly download. |
b537deb to
93b27be
Compare
|
@chriscerie @jenstroeger With the latest release to release-gitter (thanks @IamTheFij), we have a working solution for pip-based pre-commit installation. With this, we should have pre-commit support using local exec, docker and pip (python). Let me know if anything else would be needed from my end. |
pyproject.toml
Outdated
| [tool.release-gitter.map-system] | ||
| Darwin = "macos" | ||
| Windows = "windows" | ||
| Linux = "linux" No newline at end of file |
There was a problem hiding this comment.
These should no longer be needed. This was common enough that I added it as default values. That said, there is no harm in leaving them.
https://github.com/IamTheFij/release-gitter/blob/main/release_gitter.py#L51
SYSTEM_SYNONYMS: list[list[str]] = [
["Darwin", "darwin", "MacOS", "macos", "macOS"],
["Windows", "windows", "win", "win32", "win64"],
["Linux", "linux"],
]There was a problem hiding this comment.
Thanks for the input! Removed this in the latest commit (391b18d).
|
@amitds1997 any help needed here |
I think this just fell through the cracks. I don't think there was anything pending from my end. If the maintainers want this in, I can do a cleanup and get this ready again. |
|
It would be really good to have pre-commit support. |
|
I would also use it. |
Fixes #539
Rust-based pre-commit does not work because pre-commit hardcodes the
--pathto.which leads to build failure and errors withfound a virtual manifest at <path>/Cargo.tomlinstead of a package manifest. Pre-commit maintainer disagrees with making this configurable so it is not possible to add arustbased hook: pre-commit/pre-commit#2931