code: def parse_setup() -> Tuple[PackagesType, PackagesType, Set[str], Set[str]]:
      
      essential_packages: PackagesType = {}
      test_packages: PackagesType = {}
      essential_duplicates: Set[str] = set()
      test_duplicates: Set[str] = set()
  
      with open('setup.py') as setup_file:
          contents = setup_file.read()
  
      # Parse out essential packages.
      package_string = re.search(r"""install_requires=\[[\s\n]*['"](.*?)['"],?[\s\n]*\]""",
                                 contents, re.DOTALL).groups()[0].strip()
      for package in re.split(r"""['"],[\s\n]+['"]""", package_string):
          module, version = parse_package(package)
          if module in essential_packages:
              essential_duplicates.add(module)
          else:
              essential_packages[module] = version
  
      # Parse packages only needed for testing.
      package_string = re.search(r"""tests_require=\[[\s\n]*['"](.*?)['"],?[\s\n]*\]""",
                                 contents, re.DOTALL).groups()[0].strip()
      for package in re.split(r"""['"],[\s\n]+['"]""", package_string):
          module, version = parse_package(package)
          if module in test_packages:
              test_duplicates.add(module)
          else:
              test_packages[module] = version
  
      return essential_packages, test_packages, essential_duplicates, test_duplicates
docs: Parse all dependencies out of the setup.py script.