🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #683

Bug#1150761: python3-pytoolconfig: universal configuration takes precedence over command line arguments

#683
From: Nico Della Torre
Date: Tue, 13 Oct 2026 10:30
61 lines
3503 bytes
Package: python3-pytoolconfig
Version: 1.3.1-5
Severity: minor
Tags: upstream

The documentation ("Configuration Load Order" in `docs/index.rst`) lists
the command line first, as the highest priority source. However,
`PyToolConfig.parse()` applies the universal configuration values after
the command line arguments, so a value set in `[tool.pytoolconfig]` (or
derived from `[project]`) overrides an option passed explicitly on the
command line.

pyproject.toml:

    [tool.pytoolconfig]
    max_line_length = 100

test.py:

    from argparse import ArgumentParser
    from dataclasses import dataclass
    from pathlib import Path

    from pytoolconfig import PyToolConfig, UniversalKey, field

    @dataclass
    class Config:
        line: int = field(
            80,
            command_line=("--line",),
            universal_config=UniversalKey.max_line_length,
        )

    config = PyToolConfig("t", Path("."), Config, arg_parser=ArgumentParser())
    print(config.parse(["--line", "120"]).line)

Actual: `100`

Expected: `120`, as per the documented load order.

Applying the universal values before the command line arguments in
`parse()` would fix it.

Reproduced with python3-pytoolconfig 1.3.1-5 (code unchanged in 1.3.1-6)
on Python 3.13 and 3.14, and with upstream main (bee6db4).

This is an upstream bug, it will be forwarded.


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 7.2.9+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE=it
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Technical Details
Message-ID: <NNHVD-5frH-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.szaf.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.szaf.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Nico Della Torre <nicoz91@ubuntu.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1150761: python3-pytoolconfig: universal configuration takes precedence over command line arguments
Date: Tue, 13 Oct 2026 12:30:01 +0200
Message-ID: <NNHVD-5frH-5@gated-at.bofh.it>
X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Tue Oct 13 10:29:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.651
Reply-To: Nico Della Torre <nicoz91@ubuntu.com>, 1150761@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: team+python@tracker.debian.org
X-Debian-Pr-Message: report 1150761
X-Debian-Pr-Package: python3-pytoolconfig
X-Debian-Pr-Keywords: upstream
X-Debian-Pr-Source: pytoolconfig
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Mailer: reportbug 13.2.0+nmu1
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1996537
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 61
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Tue, 13 Oct 2026 12:27:12 +0200
X-Original-Message-ID: <179188723246.276686.8450333329705412367.reportbug@ryzendeb.linuxlab>