-
Notifications
You must be signed in to change notification settings - Fork 55
Description
As of Confuse 2.2.0 both basedpyright and astral's ty typechecker see all Confuse config AttrDict values as the 'object' type, creating an enormous amount of typechecking warnings.
In this real example from my comicbox repo self.config.verbose is declared in the MappingTemplate as an Integer().
The class Printer() takes an int argument. Which typechecks fine in Confuse v2.1.0.
self._printer: Printer = Printer(self.config.verbose) However in Confuse 2.2.0 my typechecker shows:
ty: Argument to bound method `__init__` is incorrect: Expected `int`, found `object`
invalid-argument-type: Argument to bound method `__init__` is incorrect: Expected `int`, found `object`Naturally as I use Confuse config values everywhere I see many of these type checking warnings.
The good news is this isn't a functional bug and everything still works, but it makes typing of the config object useless.
Workaround
Reverting to Confuse 2.1.0 fixes this.
Reproduction
My nudebomb repo is a reasonably small codebase that shows this.
https://github.com/ajslater/nudebomb/tree/v0.4.7
- Checkout tag v0.4.7 onto a machine with python, uv and make.
make updatewill install the latest packages including Confuse 2.2.0make typecheckwill show basedpyright warnings.make tywill show warnings from ty.
Identical issue also seen in my picopt and comicbox repos.