Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-3003

QProcess startDetached static method no longer in .pyi in 6.8.2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • 6.9.0, 6.8.3
    • 6.8.2
    • Type hints
    • None
    • All
    • afc833133 (dev), ca503d98f (6.8)

    Description

      While upgrading from PySide 6.8.1.1 to 6.8.2, mypy started giving errors for the static method of QProcess.startDetached that I had been using.

      I note that this function does continue to exist in Qt itself: https://github.com/qt/qtbase/blob/v6.8.2/src/corelib/io/qprocess.h#L238-L239

      Please find attached a reproducible I made and tested on macOS Sequoia with Python 3.13.1.

      Repro instructions:

      1. create a Python virtual env
      2. pip install -r requirements.txt
      3. tox

      The output I see is

      tox
      compile: commands[0]> python -m py_compile qprocesstest.py
      compile: OK ✔ in 0.1 seconds
      typehintcheck_6811: install_deps> python -I -m pip install -r /Users/mark/dev/tests/pyside682pyi/requirements_6811.txt
      typehintcheck_6811: commands[0]> bash -c 'find /Users/mark/dev/tests/pyside682pyi/.tox/typehintcheck_6811 -name QtCore.pyi | xargs grep startDetached'
          def startDetached(self) -> typing.Tuple[bool, int]: ...
          def startDetached(program: str, arguments: typing.Sequence[str] = ..., workingDirectory: str = ...) -> typing.Tuple[bool, int]: ...
      typehintcheck_6811: commands[1]> mypy qprocesstest.py
      Success: no issues found in 1 source file
      typehintcheck_6811: OK ✔ in 11.86 seconds
      typehintcheck_682: install_deps> python -I -m pip install -r /Users/mark/dev/tests/pyside682pyi/requirements_682.txt
      typehintcheck_682: commands[0]> bash -c 'find /Users/mark/dev/tests/pyside682pyi/.tox/typehintcheck_682 -name QtCore.pyi | xargs grep startDetached'
          def startDetached(self, /) -> typing.Tuple[bool, int]: ...
      typehintcheck_682: commands[1]> mypy qprocesstest.py
      qprocesstest.py:7: error: Too many arguments for "startDetached" of "QProcess"  [call-arg]
      qprocesstest.py:7: error: Unexpected keyword argument "workingDirectory" for "startDetached" of "QProcess"  [call-arg]
      .tox/typehintcheck_682/lib/python3.13/site-packages/PySide6/QtCore.pyi:6491: note: "startDetached" of "QProcess" defined here
      qprocesstest.py:7: error: Too many arguments for "startDetached" of "QProcess"  [call-arg]
      qprocesstest.py:7: error: Unexpected keyword argument "workingDirectory" for "startDetached" of "QProcess"  [call-arg]
      qprocesstest.py:8: error: Argument 1 to "startDetached" of "QProcess" has incompatible type "str"; expected "QProcess"  [arg-type]
      .tox/typehintcheck_682/lib/python3.13/site-packages/PySide6/QtCore.pyi:6491: note: "startDetached" of "QProcess" defined here
      qprocesstest.py:8: error: Argument 1 to "startDetached" of "QProcess" has incompatible type "str"; expected "QProcess"  [arg-type]
      Found 6 errors in 1 file (checked 1 source file)
      typehintcheck_682: exit 1 (8.27 seconds) /Users/mark/dev/tests/pyside682pyi> mypy qprocesstest.py pid=74396
        compile: OK (0.10=setup[0.07]+cmd[0.02] seconds)
        typehintcheck_6811: OK (11.86=setup[2.18]+cmd[0.03,9.64] seconds)
        typehintcheck_682: FAIL code 1 (10.27=setup[1.98]+cmd[0.03,8.27] seconds)
        evaluation failed :( (22.25 seconds)

      which includes grepping the QtCore.pyi for startDetached, that is missing the overload in 6.8.2, and also running mypy over the sample Python script, which also reports errors on 6.8.2.

      I see there were type hint changes in the changelog, https://doc.qt.io/qtforpython-6/release_notes/pyside6_release_notes.html#id1, including using the positional argument syntax, but nothing stood out that would omit an overload.

      Thanks in advance for taking a look at this report.

      Attachments

        For Gerrit Dashboard: PYSIDE-3003
        # Subject Branch Project Status CR V

        Activity

          People

            ctismer Christian Tismer
            mark_final Mark Final
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes