From: Tom de Vries <tdevries@suse.de>
To: Stephan Rohr <stephan.rohr@intel.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [pre-commit] : add 'tomli' dependency for codespell pre-commit hook
Date: Mon, 13 Jul 2026 12:35:47 +0200 [thread overview]
Message-ID: <e39bff4c-76bf-4da9-a961-43d9d04c2650@suse.de> (raw)
In-Reply-To: <f6b0ac89-13c9-48ba-a9d9-af99e2386c05@suse.de>
On 7/13/26 11:42 AM, Tom de Vries wrote:
> On 6/30/26 10:20 AM, Stephan Rohr wrote:
>> From: "Rohr, Stephan" <stephan.rohr@intel.com>
>>
>> The codespell pre-commit hook imports the 'tomllib' module to parse
>> 'pyproject.toml'. 'tomllib' is not available for Python versions 3.10
>> and older. Add a dependency on 'tomli' so the hook also works on these
>> Python versions.
>>
>
> Hi,
>
> this LGTM.
>
> Approved-By: Tom de Vries <tdevries@suse.de>
>
Also, consider removing duplication using an anchor:
...
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f96959d79fc..70c3033a9fe 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -80,12 +80,12 @@ repos:
files: '^(gdb|gdbserver|gdbsupport)/'
args: [--toml, gdb/pyproject.toml]
# 'tomllib' library is not available on Python < 3.11.
- additional_dependencies: ['tomli']
+ additional_dependencies: &codespell_deps ['tomli']
- id: codespell
name: codespell-log
entry: gdb/contrib/codespell-log.sh
args: [--toml, gdb/pyproject.toml]
- additional_dependencies: ['tomli']
+ additional_dependencies: *codespell_deps
verbose: true
stages: [commit-msg]
...
Thanks,
- Tom
> FWIW, I had some trouble reproducing this. I tried to reproduce this in
> a python virtual environment (3.10) on a system with system python 3.14.
> As it turns out, pre-commit creates a python 3.14 environment, so
> tomli is found.
>
> After setting language_version to 3.10 in the yaml file, I managed to
> reproduce it, and indeed your patch fixes it.
>
> Thanks,
> - Tom
>
>> ---
>> .pre-commit-config.yaml | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
>> index 9910bbb82f2..1c6b018d7ac 100644
>> --- a/.pre-commit-config.yaml
>> +++ b/.pre-commit-config.yaml
>> @@ -79,10 +79,13 @@ repos:
>> - id: codespell
>> files: '^(gdb|gdbserver|gdbsupport)/'
>> args: [--toml, gdb/pyproject.toml]
>> + # 'tomllib' library is not available on Python < 3.11.
>> + additional_dependencies: ['tomli']
>> - id: codespell
>> name: codespell-log
>> entry: gdb/contrib/codespell-log.sh
>> args: [--toml, gdb/pyproject.toml]
>> + additional_dependencies: ['tomli']
>> verbose: true
>> stages: [commit-msg]
>
next prev parent reply other threads:[~2026-07-13 10:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 8:20 Stephan Rohr
2026-07-13 9:42 ` Tom de Vries
2026-07-13 10:35 ` Tom de Vries [this message]
2026-07-28 8:01 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e39bff4c-76bf-4da9-a961-43d9d04c2650@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=stephan.rohr@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox