class_docstr: Context manager for wrapped code and subprocesses to use pip package.
class_docstr_tok: ["Context","manager","for","wrapped","code","and","subprocesses","to","use","pip","package","."]
code: def __enter__(self) -> "TempPipInstallContext":
      if self.pip_dependencies:
          self.temp_directory = tempfile.mkdtemp()
          for dependency in self.pip_dependencies:
              install_to_temp_directory(
                  dependency, temp_dir=self.temp_directory
              )
          self.orig_syspath = sys.path
          sys.path = sys.path + [self.temp_directory]
          if "PYTHONPATH" in os.environ:
              self.orig_pypath = os.environ["PYTHONPATH"]
              os.environ["PYTHONPATH"] = (
                  self.orig_pypath + os.pathsep + self.temp_directory
              )
          else:
              os.environ["PYTHONPATH"] = self.temp_directory
      return self
  
imports: import hashlib
  import os
  import re
  import shutil
  import struct
  import subprocess
  import sys
  import tempfile
  from typing import Any, Callable, Dict, List, Optional, Tuple
  from absl import logging
  from tfx.dsl.components.base import base_component
  from tfx.dsl.io import fileio
  from tfx.utils import import_utils
  from tfx.utils import io_utils
label_desc: Use image node_id 2 for calling the TempPipInstallContext obj's underlying member method code with example usage: obj.__enter__() and returns: self