Always use subprocess.run instead of subprocess.check_call or subprocess.call

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • 4.14
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      The standard library subprocess module recommends always using subprocess.run() when possible instead of the older subprocess.check_call() or subprocess.call(). For consistency and to align with best practices, we should audit our codebase to ensure we follow this recommendation.

      Definition of done

      All existing uses of subprocess.check_call() and subprocess.call() should be replaced with subprocess.run(), passing check=True or check=False as appropriate.

      If possible, we should also add a custom lint rule to error on any uses of these older methods. ruff unfortunately does not support plugins or custom rules at this time, so we will have to investigate other options for custom linting rules, if possible.

      Pitfalls

      N/A.

              Assignee:
              Iris Ho
              Reporter:
              Noah Stapp
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: