Skip to content

build(deps): bump typeguard from 2.13.3 to 4.6.0 - #23

Merged
galacto-last9 merged 4 commits into
mainfrom
dependabot/pip/typeguard-4.6.0
Sep 18, 2026
Merged

galacto-last9 merged 4 commits into
mainfrom
dependabot/pip/typeguard-4.6.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Bumps typeguard from 2.13.3 to 4.6.0.

Release notes

Sourced from typeguard's releases.

4.6.0

  • Added support for type checking against the PEP 661 sentinel type (built-in on Python 3.15 and available on typing_extensions for earlier Pythons)
  • Added the typeguard-packages-ignore option (--typeguard-packages-ignore on the command line) to the pytest plugin to exclude specific packages from type checking (#523)
  • Added recognition of wildcard imports from typing and typing_extensions in the import hook/instrumenter (#489; PR by @​ShipitAndPray)
  • Fixed compatibility with Python 3.15 (#554; PR by @​hrnciar)
  • Fixed an assignment expression against an annotated name (x: int, then if (x := ...)) being instrumented as an unpacking target, which raised TypeError for a non-iterable value and silently replaced an iterable value with list(value) (#557)
  • Fixed false positive when checking a class against type[SomeProtocol] where the protocol declares non-ClassVar (instance) attributes; only ClassVar members are now required on the class itself (#499)
  • Fixed Literal checks depending on the order of the arguments, where a bool would not match if an == equal int came first (Literal[1, True] rejected True, but Literal[True, 1] accepted it) (#566; PR by @​uttam12331)
  • Fixed the import hook/instrumenter erasing the subscript of an empty tuple annotation (tuple[()]) down to a bare tuple, causing any tuple (including non-empty ones) to pass the check (#565; PR by @​chuenchen309)
  • Dropped support for Python 3.9

4.5.2

  • Fixed IndexError raised from check_signature_compatible when the subject method has no positional parameters (#550; PR by @​HackedRico)

4.5.1

  • Fixed iterable unpacking incorrectly calculating the cut-off offset of the item list when assigning remaining values to the star variable (#546)

4.5.0

  • Restored the check_argument_types() and check_return_type() functions that were dropped in v3.0.0, for users who want more fine-grained control over run-time type checking (#437)
  • Added support for extra_items in TypedDict, allowing users to specify the types for the values of "leftover" keys in a typed dict (keys that weren't explicitly defined in the TypedDict subclass) (#538)
  • Fixed NameError when evaluating forward references on Python 3.14 (#536; PR by @​dionhaefner)
  • Fixed protocol check incorrectly rejecting inherited classmethods and staticmethods (#539)
  • Fixed missing TypeCheckError when checking TypedDict with Required[...] annotations (#533; PR by @​dionhaefner)
  • Fixed type aliases (e.g. type Foo = list[int]) not being resolved during type checking (#526)
  • Fixed type-checked assignments to a single tuple target (e.g. x, = ("foo",)) falsely raising TypeCheckedError (#535)

4.4.4

  • Fixed IndexError when using @typechecked on more than one function with the same name under certain circumstances (#527)
  • Fixed TypeError during type checking when the value to check is a parametrized generic class (#526)

4.4.3

  • Fixed @typechecked unable to find the target function or method if it or the containing class had PEP 695 type parameters on them (#500)
  • Fixed handling of union types on Python 3.14 (#522)
  • Fixed __type_params__ getting lost when a function is instrumented

4.4.2

  • Fixed TypeCheckError in unpacking assignment involving properties of a parameter of the function (#506; regression introduced in v4.4.1)
  • Fixed display of module name for forward references (#492; PR by @​JelleZijlstra)
  • Fixed TypeError when using an assignment expression (#510; PR by @​JohannesK71083)
  • Fixed ValueError: no signature found for builtin when checking against a protocol and a matching attribute in the subject is a built-in function (#504)

4.4.1

  • Dropped Python 3.8 support
  • Changed the signature of typeguard_ignore() to be compatible with typing.no_type_check() (PR by @​jolaf)
  • Avoid creating reference cycles when type checking uniontypes and classes
  • Fixed checking of variable assignments involving tuple unpacking (#486)
  • Fixed TypeError when checking a class against type[Self] (#481)
  • Fixed checking of protocols on the class level (against type[SomeProtocol]) (#498)
  • Fixed Self checks in instance/class methods that have positional-only arguments
  • Fixed explicit checks of PEP 604 unions against types.UnionType (#467)

... (truncated)

Commits
  • 9f289c7 Added release date
  • f7784d6 Removed leftover compatibility code for Python 3.9 and earlier
  • f971baa Added support for the sentinel type
  • abf8f43 Added the typeguard-packages-ignore option
  • 7e5102e Fixed a typo
  • a319de1 Do not erase a meaningful empty tuple[()] subscript in the transformer (#565)
  • dd7fa67 Fixed Literal check depending on argument order for bools (#566)
  • a42dc4d Recognize wildcard-imported Literal annotations (#549)
  • f1007ef Fixed false positive checking a class against type[Protocol] with instance at...
  • 32e7c85 Fixed annotated assignment expressions being treated as unpacking targets (#563)
  • Additional commits viewable in compare view

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Bumps [typeguard](https://github.com/agronholm/typeguard) from 2.13.3 to 4.6.0.
- [Release notes](https://github.com/agronholm/typeguard/releases)
- [Commits](agronholm/typeguard@2.13.3...4.6.0)

---
updated-dependencies:
- dependency-name: typeguard
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update python code labels Aug 2, 2026

@nishantmodak nishantmodak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed a195845b8c708b44eb5876d1911ec06f074a9908: both changed dependency files, Python support/setup and CI contracts, typeguard usage across the package, subprocess/health-check paths and representative CLI, parsing and metric consumers. One P1 blocks approval: the major upgrade rejects actual subprocess results and breaks DCGM diagnostics. The inline thread includes three executed, copyable base-versus-head regression cases.

Validation: the declared dev/runtime dependency install succeeded on Python 3.12.9; 134 focused existing tests pass. The broader local suite, excluding two modules that fail collection on an unchanged macOS timezone assumption, reports 726 passed / 64 failed / 1 skipped on head versus 766 passed / 24 failed / 1 skipped on base. Forty additional failing test cases need migration; some concern test-double protocol signatures, so I am not claiming forty distinct production bugs. A separate 15-case exploratory harness passes 12 cases on both heads (including 100 seeded parser examples); its three device/job attribution failures are identical on base and are not reported as introduced defects.

GitHub's Python 3.10/3.11/3.12 jobs are failed; the other ten checks are successful. Their job steps/log cause was not available, so this review relies on local evidence rather than attributing remote failures. Limits: the local install resolved the declared dependency groups rather than installing the entire hashed dev lockfile; base used that same environment with only typeguard changed. The complete suite is not green; no Linux runtime, GPU hardware, live exporter, infrastructure service or container was exercised. These limits do not affect the reproduced subprocess contract regression. No source changes were pushed.

Comment thread pyproject.toml
"typing_extensions",
"click==8.0.4",
"typeguard==2.13.3",
"typeguard==4.6.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Migrate subprocess result contracts before enabling typeguard 4

This upgrade instruments annotated local assignments and validates protocol attributes. The real DCGMImpl returns shell_command() results whose CompletedProcess.args is a string and stderr is None (shell=True, stderr=STDOUT), but ShellCommandOut requires List[str] and str. At check_dcgmi.py:461, a normal command result now raises TypeCheckError; the exception recovery result then fails the same protocol's stderr check. The timeout path fails as well.

I reproduced this through the actual CLI, DCGMImpl, shell wrapper and output contexts with only the subprocess boundary replaced. A passing GPU diagnostic, a failing diagnostic, and a timeout all end with WARNING - check did not exit normally and TypeCheckError, instead of their expected OK/CRITICAL/WARN result and diagnostic message. This breaks the health-check path even for valid command output and can turn a critical result into an unexplained warning.

Update the subprocess protocol and recovery values to reflect the real producer contract, and audit the newly enforced annotated assignments and protocol consumers before taking the major upgrade. Keep this dependency at its compatible version until those migrations and the affected tests pass. Do not solve this only by changing test fakes: the production CompletedProcess shape triggers the failure.

Executed regression at a195845b8c708b44eb5876d1911ec06f074a9908: save the following as l9gpu/tests/test_typeguard_subprocess_review.py. With Python 3.12 and the PR's declared dependencies installed (python -m pip install -e '.[dev,k8s]'), run:

python -m pytest -q l9gpu/tests/test_typeguard_subprocess_review.py
import json
import subprocess
from unittest.mock import patch

import pytest
from click.testing import CliRunner
from l9gpu.health_checks.checks.check_dcgmi import DCGMImpl, check_dcgmi


@pytest.mark.parametrize("status,code,message", [
    ("Pass", 0, "All checks passed"),
    ("Fail", 2, "software failed"),
    ("timeout", 1, "Error command timeout because of timeout setting"),
])
def test_real_subprocess_contract(tmp_path, status, code, message):
    def fake_run(cmd, **kwargs):
        # Same CompletedProcess shape as the production shell=True /
        # stderr=STDOUT / text-mode subprocess.run invocation.
        assert kwargs["shell"] is True
        assert kwargs["stderr"] is subprocess.STDOUT
        if status == "timeout":
            raise subprocess.TimeoutExpired(cmd, kwargs["timeout"])
        body = {"DCGM Diagnostic": {"test_categories": [
            {"tests": [{"name": "software", "test_summary": {"status": status}}]}
        ]}}
        return subprocess.CompletedProcess(cmd, 0, json.dumps(body), None)

    obj = DCGMImpl("synthetic", "nagios", "INFO", str(tmp_path), "localhost")
    with patch("l9gpu.health_checks.subprocess.subprocess.run", side_effect=fake_run):
        result = CliRunner().invoke(check_dcgmi, [
            "diag", "synthetic", "nagios", "--log-folder", str(tmp_path),
            "--sink", "do_nothing", "--verbose-out",
        ], obj=obj)
    assert result.exit_code == code, (result.output, repr(result.exception))
    assert message in result.output, (result.output, repr(result.exception))

Executed on Python 3.12.9: all three cases fail on this head. The identical test passes all three at base 215314527174c7e59743f21fde067be26db5fff1 with typeguard 2.13.3 and otherwise identical resolved dependencies. The failure assertions show TypeCheckError on the ShellCommandOut attributes. No GPU, subprocess command, service, or external telemetry endpoint is used by this test.

@galacto-last9
galacto-last9 merged commit 25fb9f4 into main Sep 18, 2026
13 checks passed
@dependabot
dependabot Bot deleted the dependabot/pip/typeguard-4.6.0 branch September 18, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants