[PATCH] Add flake8 and isort to .pre-commit-config.yaml
Tom de Vries
tdevries@suse.de
Tue Apr 9 12:56:13 GMT 2024
On 4/9/24 11:41, Kévin Le Gouguec wrote:
> Tom de Vries <tdevries@suse.de> writes:
>
>> just to report back on this with my current state.
>>
>> I use openleap 15.4 with python 3.6, and the used version of flake8 requires python 3.7, so I ran into trouble after this commit.
>>
>> Then I learned about "git commit -n", and started using that as workaround, but eventually ran into trouble because that doesn't seem to work while rebasing.
>>
>> I then decided to install python 3.11 and use a virtual environment, and use git commit from within that environment. AFAICT, the virtual environment works as expected:
>> ...
>> $ python --version
>> Python 3.11.5
>> $ python3 --version
>> Python 3.11.5
>> ...
>> but for some reason I keep getting:
>> ...
>> SyntaxError: future feature annotations is not defined
>> ...
>> which is the same error I got with python 3.6.
>>
>> I've tried removing ~/.cache/pre-commit a couple of times, but that didn't help either.
>>
>> So, atm I can no longer rebase. I'll try to workaround this by adding a local commit that reverts this change, or something similar, but if anybody has another idea I'd be happy to hear it.
>
> Hunch: have you installed pre-commit in this virtual environment, or are
> you using a pre-commit that comes from "outside", e.g. your distro, or
> 'pip install --user' before activating the venv? FWIW this might yield
> clues:
>
> $ head -1 $(which pre-commit)
>
Hi Kevin,
thanks for the reaction.
The command you mention showed the correct pre-commit version.
But when running git commit, the wrong one was used. I just needed to
rerun "pre-commit install" to re-install the hooks, which fixes this.
I'll update the wiki entry to clarify this.
Thanks,
- Tom
> Over here this shows a shebang that points to […VENV…]/bin/python3
> (which in turn is a symlink to my system Python).
>
> I would hope that 'pip install pre-commit' within your virtual
> environment would install a pre-commit that will use "the right Python",
> but I could be missing something.
More information about the Gdb-patches
mailing list