Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [pre-commit] : add 'tomli' dependency for codespell pre-commit hook
@ 2026-06-30  8:20 Stephan Rohr
  2026-07-13  9:42 ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Stephan Rohr @ 2026-06-30  8:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: tdevries

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.

---
 .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]
 
-- 
2.43.0

Intel Deutschland GmbH

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [pre-commit] : add 'tomli' dependency for codespell pre-commit hook
  2026-06-30  8:20 [PATCH] [pre-commit] : add 'tomli' dependency for codespell pre-commit hook Stephan Rohr
@ 2026-07-13  9:42 ` Tom de Vries
  2026-07-13 10:35   ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2026-07-13  9:42 UTC (permalink / raw)
  To: Stephan Rohr, gdb-patches

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>

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]
>   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [pre-commit] : add 'tomli' dependency for codespell pre-commit hook
  2026-07-13  9:42 ` Tom de Vries
@ 2026-07-13 10:35   ` Tom de Vries
  2026-07-28  8:01     ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2026-07-13 10:35 UTC (permalink / raw)
  To: Stephan Rohr, gdb-patches

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]
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [pre-commit] : add 'tomli' dependency for codespell pre-commit hook
  2026-07-13 10:35   ` Tom de Vries
@ 2026-07-28  8:01     ` Tom de Vries
  0 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-07-28  8:01 UTC (permalink / raw)
  To: Stephan Rohr, gdb-patches

On 7/13/26 12:35 PM, Tom de Vries wrote:
> 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>
>>

It's been two weeks since approval, so to prevent this from falling 
through the cracks I've pushed this, after rebasing and applying the 
anchor change I suggested below.

Thanks,
- Tom

> 
> 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]
>>
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-28  8:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-30  8:20 [PATCH] [pre-commit] : add 'tomli' dependency for codespell pre-commit hook Stephan Rohr
2026-07-13  9:42 ` Tom de Vries
2026-07-13 10:35   ` Tom de Vries
2026-07-28  8:01     ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox