Remove python method in favor of step method in various places, per recommendation given when running tests

Message when executing tests:

Description:
  `api.python(...)` is deprecated in favor of `api.step`.

  Please update your api.python(name, ...) calls to one of:
    api.step(name, ['vpython3', ...])
    api.step(name, ['python3', ...])
    api.step(name, ['vpython', ...])
    api.step(name, ['python', ...])

Bug Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1271425

Change-Id: I83d97f1cb139a88ec987411decf1400140c7bf2c
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/29921
Reviewed-by: Godofredo Contreras <godofredoc@google.com>
Reviewed-by: Casey Hillers <chillers@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipe_modules/android_virtual_device/__init__.py b/recipe_modules/android_virtual_device/__init__.py
index 2b26da4..318dbc5 100644
--- a/recipe_modules/android_virtual_device/__init__.py
+++ b/recipe_modules/android_virtual_device/__init__.py
@@ -7,7 +7,6 @@
     'recipe_engine/context',
     'recipe_engine/file',
     'recipe_engine/platform',
-    'recipe_engine/python',
     'recipe_engine/raw_io',
     'recipe_engine/step',
 ]
diff --git a/recipe_modules/android_virtual_device/api.py b/recipe_modules/android_virtual_device/api.py
index 84872c2..049ca06 100644
--- a/recipe_modules/android_virtual_device/api.py
+++ b/recipe_modules/android_virtual_device/api.py
@@ -61,14 +61,13 @@
         avd_config = self.avd_root.join(
             'src', 'tools', 'android', 'avd', 'proto', 'generic_android%s.textpb' % self.version
         )
-        self.m.python(
-            'Install Android emulator (API level %s)' % self.version, avd_script_path,
-            ['install', '--avd-config', avd_config]
+        self.m.step(
+            'Install Android emulator (API level %s)' % self.version,
+            ['python', avd_script_path, 'install', '--avd-config', avd_config]
         )
-        output = self.m.python(
+        output = self.m.step(
             'Start Android emulator (API level %s)' % self.version,
-            avd_script_path,
-            ['start', '--no-read-only', '--writable-system', '--avd-config', avd_config],
+            ['python', avd_script_path, 'start', '--no-read-only', '--writable-system', '--avd-config', avd_config],
             stdout=self.m.raw_io.output_text()
         ).stdout
         m = re.match('.*pid: (\d+)\)', output)
diff --git a/recipe_modules/yaml/__init__.py b/recipe_modules/yaml/__init__.py
index b93b227..57fca6c 100644
--- a/recipe_modules/yaml/__init__.py
+++ b/recipe_modules/yaml/__init__.py
@@ -3,6 +3,5 @@
 DEPS = [
     'recipe_engine/file',
     'recipe_engine/json',
-    'recipe_engine/python',
     'recipe_engine/step',
 ]
diff --git a/recipe_modules/yaml/api.py b/recipe_modules/yaml/api.py
index cb94a01..f676aa3 100644
--- a/recipe_modules/yaml/api.py
+++ b/recipe_modules/yaml/api.py
@@ -27,11 +27,12 @@
     with self.m.step.nest(step_name) as presentation:
       content = self.m.file.read_text('read', file_path)
       presentation.logs['yaml'] = content
-      return self.m.python(
+      return self.m.step(
           'parse',
-          self.resource('parse_yaml.py'),
-          args=['--yaml_file', file_path, '--json_file',
-                self.m.json.output()],
-          venv=True,
-          infra_step=True,
-      )
+          [
+              'vpython', self.resource('parse_yaml.py'),
+              '--yaml_file', file_path,
+              '--json_file', self.m.json.output()
+          ],
+          infra_step=True
+      )
\ No newline at end of file
diff --git a/recipe_modules/zip/__init__.py b/recipe_modules/zip/__init__.py
index d0321b8..a5e83f3 100644
--- a/recipe_modules/zip/__init__.py
+++ b/recipe_modules/zip/__init__.py
@@ -7,5 +7,5 @@
 DEPS = [
   'recipe_engine/json',
   'recipe_engine/path',
-  'recipe_engine/python',
+  'recipe_engine/step',
 ]
diff --git a/recipe_modules/zip/api.py b/recipe_modules/zip/api.py
index 28f7131..c76fb53 100644
--- a/recipe_modules/zip/api.py
+++ b/recipe_modules/zip/api.py
@@ -62,10 +62,11 @@
       'zip_file': str(zip_file),
       'quiet': quiet,
     }
-    self.m.python(
-        name=step_name,
-        script=self.resource('unzip.py'),
-        stdin=self.m.json.input(script_input))
+    self.m.step(
+      step_name,
+      [ 'python', self.resource('unzip.py') ],
+      stdin=self.m.json.input(script_input)
+    )
 
 
 class ZipPackage(object):
@@ -119,9 +120,9 @@
       'output': str(self._output),
       'root': str(self._root),
     }
-    step_result = self._api.python(
-        name=step_name,
-        script=self._api.zip.resource('zip.py'),
+    step_result = self._api.step(
+        step_name,
+        [ 'python', self._api.zip.resource('zip.py') ],
         stdin=self._api.json.input(script_input))
     self._api.path.mock_add_paths(self._output)
     return step_result
diff --git a/recipes/engine/engine.py b/recipes/engine/engine.py
index 4c5b597..6326542 100644
--- a/recipes/engine/engine.py
+++ b/recipes/engine/engine.py
@@ -38,7 +38,6 @@
     'recipe_engine/path',
     'recipe_engine/platform',
     'recipe_engine/properties',
-    'recipe_engine/python',
     'recipe_engine/raw_io',
     'recipe_engine/runtime',
     'recipe_engine/step',
@@ -124,19 +123,20 @@
   script_path = GetCheckoutPath(api).join('flutter', 'testing', 'run_tests.py')
   # TODO(godofredoc): use .vpython from engine when file are available.
   venv_path = api.depot_tools.root.join('.vpython')
-  args = ['--variant', out_dir, '--type', types, '--engine-capture-core-dump']
+  args = [
+      'vpython', '-vpython-spec', venv_path,
+      script_path,
+      '--variant', out_dir,
+      '--type', types,
+      '--engine-capture-core-dump'
+  ]
   if android_out_dir:
     args.extend(['--android-variant', android_out_dir])
 
   step_name = api.test_utils.test_step_name('Host Tests for %s' % out_dir)
 
   def run_test():
-    return api.python(
-        step_name,
-        script_path,
-        args,
-        venv=venv_path
-    )
+    return api.step(step_name, args)
 
   # Rerun test step 3 times by default if failing.
   # TODO(keyonghan): notify tree gardener for test failures/flakes:
@@ -549,6 +549,7 @@
 
   with api.context(cwd=checkout):
     args = [
+        'python', './flutter/ci/firebase_testlab.py',
         '--variant', build_output_dir,
         '--build-id', swarming_task_id,
     ]
@@ -556,7 +557,7 @@
     step_name = api.test_utils.test_step_name('Android Firebase Test')
 
     def firebase_func():
-      api.python(step_name, './flutter/ci/firebase_testlab.py', args)
+      api.step(step_name, args)
 
     api.retry.wrap(
         firebase_func, step_name=step_name, retriable_codes=(1, 15, 20)
diff --git a/recipes/engine/engine_lint.py b/recipes/engine/engine_lint.py
index a21f318..0a7009f 100644
--- a/recipes/engine/engine_lint.py
+++ b/recipes/engine/engine_lint.py
@@ -27,7 +27,6 @@
     'recipe_engine/path',
     'recipe_engine/platform',
     'recipe_engine/properties',
-    'recipe_engine/python',
     'recipe_engine/runtime',
     'recipe_engine/step',
 ]
diff --git a/recipes/engine/engine_unopt.py b/recipes/engine/engine_unopt.py
index 1d4ce83..475ba5f 100644
--- a/recipes/engine/engine_unopt.py
+++ b/recipes/engine/engine_unopt.py
@@ -27,7 +27,6 @@
     'recipe_engine/path',
     'recipe_engine/platform',
     'recipe_engine/properties',
-    'recipe_engine/python',
     'recipe_engine/runtime',
     'recipe_engine/step',
 ]
@@ -56,7 +55,17 @@
   script_path = GetCheckoutPath(api).join('flutter', 'testing', 'run_tests.py')
   # TODO(godofredoc): use .vpython from engine when file are available.
   venv_path = api.depot_tools.root.join('.vpython')
-  args = ['--variant', out_dir, '--type', types, '--engine-capture-core-dump']
+  args = [
+      'vpython',
+      '-vpython-spec',
+      venv_path,
+      script_path,
+      '--variant',
+      out_dir,
+      '--type',
+      types,
+      '--engine-capture-core-dump'
+  ]
   if android_out_dir:
     args.extend(['--android-variant', android_out_dir])
   if ios_out_dir:
@@ -67,7 +76,7 @@
   step_name = api.test_utils.test_step_name('Host Tests for %s' % out_dir)
 
   def run_test():
-    return api.python(step_name, script_path, args, venv=venv_path)
+    return api.step(step_name, args)
 
   # Rerun test step 3 times by default if failing.
   api.retry.wrap(run_test, step_name=step_name)