-
Notifications
You must be signed in to change notification settings - Fork 6
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 hook fails while running on pre-commit.ci #15
Comments
Hi. Could you try to run the program with If it works with sudo, I can introduce a new variable for selecting the location where the executable will be downloaded. |
Hello again, as you can see in the linked issue network is not available at runtime 🥳 . One possible solution could be to bundle the executable with the python package. Other than that I'm not sure what else could be done. |
Hi. Yes, I could attach the executable to the Python package. I will try to release a new version in a few days. |
@mmicu Hello again! Any news on this 😃 ? |
Hey. Probably I will have some time to work on it this week. |
Hi @billsioros. I added this kind of offline mode in the version |
Hi @mmicu, excuse me but I fail to notice a new release 😢 |
Don't worry. Take your time to test it. |
What I meant is that I cannot find a release with the tag |
No worries. It's in PyPI. You can install the latest version with In any case, from the |
Hello again, The CI fails on build time. You can find the run here. I'm pretty sure
I believe a new release/tag must be created before even being able to test this out. Edit: Forgot to include a link to the pre-commit-config.yaml, which I changed. 😋 |
I created the tag |
Thank you very much! I'm facing another issue. The binary seems to be large and it is failing to install in the CI due to a max-size limit. Here, you can find the corresponding CI run. I might have to contact the maintainers of |
I just had a quick look because I couldn't believe it would be so big.
I do not know anything about the python ecosystem and how everything works here, but is this needed? |
I had to add every possible binary for this kind of offline mode. The Python wrapper simply runs the executable, so it must be chosen based on the target machine. The new logic also removes the unused tarballs and extracts content from the one that matches the target machine. However, since there is no chance to know the target machine, I had to include all of them. Then, network is not available for |
I understand, thank you for that explanation. So I see two options here:
Personally I would vote for 2. - but as I'm not the one who is using this and developed it, don't take my opinion to serious. |
No problem.
I would go for Regarding the size limit, of course we cannot adapt our tool to external ones. So, as you wrote, they are responsible for having enough space. @billsioros, I expect a kind of parameter to increase the size limit. Maybe you can check if the tool support such option. |
A better way to do this would be to download the platform specific binaries during the you can find an example of this in shellcheck-py -- you would pick the architecture of your particular running python and encode that in your produced wheel (if applicable). then you wouldn't run up against the download limits and the no-network-at-runtime bit would be satisfied here's the particular code from shellcheck-py: https://github.com/shellcheck-py/shellcheck-py/blob/master/setup.py |
Hi @asottile, thank you for your suggestion. Yes, you're right. That would be the best solution to apply. I will work on it soon. |
As an alternative, I have just proposed #16 that skips all automatic downloading altogether. We use ASDF to manage the tools locally, and on CI we have a custom docker image that already bundles all necessary tools (also provisioned via ASDF at image build time). When I forked the current repo, git clone pulled down 100Mb, all because of the bundled binaries on the EDIT: re-reading the whole thread, I think @asottile's suggestion makes a lot of sense. It will fix running the python hook on pre-commit CI within its rather restrictive environment. But we would still prefer an alternative no-download hook. |
Hello yet again! Are there any news on this? 😃 |
Hi @sergei-ivanov and @billsioros. I will implement what @asottile proposed once I am back at work. |
@billsioros, could you please try to install version |
@mmicu Hello! Would it be possible to create a new GitHub release? As I've mentioned in a previous comment |
@billsioros, you're right, I completely forgot about that. I created the new tag |
@mmicu I was able to update the hook. As you mentioned before the executable is now named - id: editorconfig-checker
name: editorconfig-checker
description: '`editorconfig-checker` is a tool to check if your files consider your .editorconfig-rules.'
entry: editorconfig-checker # should be ec
language: python
types: [text]
require_serial: true DISCLAIMER: I have never developed a pre-commit hook, so I'm going out on a limb here to say this 😄 |
@billsioros, @sergei-ivanov created a pull request for that. Once this issue will be closed and the corresponding code merged to |
@mmicu No, my PR is slightly different. It bypasses Python completely, and relies on EDIT: you will likely need to modify the existing hook as @billsioros has suggested. And when its all merged, I'll rebase my PR on top of it. |
@sergei-ivanov, Thank you for the clarification. Then, let's continue the discussion in the PR page directly. @billsioros, I will change the README based on this fix as you suggested. However, could you please share a link with a successful run with the latest version? |
@mmicu I think what @billsioros meant was: if the executable changed to
...to this: entry: ec This is because it cannot be controlled by the consumer of the hook, it is set up by the hook author. |
@sergei-ivanov, yes, I forgot to mention it, but I meant both |
@mmicu I haven't been able to get a successful run on the CI. After the recent update, which introduced the executable name change, I'm not able to get a successful run locally either. |
@billsioros, could you please try now? The new version is |
@mmicu The hook works great! Thank you very much for your efforts! Feel free to close the issue. Thanks again 😄 |
@billsioros, great, I am glad that it worked. Thank you all for you help and suggestions. |
An example run can be found here.
My pre-commit-config is the following:
Thanks in advance!
The text was updated successfully, but these errors were encountered: