def METHOD_NAME(self) -> None:
    source_requirements = [packaging.requirements.Requirement(re.sub(' #.*$', '', line)) for line in self.source_path.read_text().splitlines()]
    install_packages = {requirement.name for requirement in source_requirements}
    exclude_packages = {'distribute', 'pip', 'setuptools', 'wheel'} - install_packages
    with tempfile.TemporaryDirectory() as venv_dir:
        venv.create(venv_dir, with_pip=True)
        python = pathlib.Path(venv_dir, 'bin', 'python')
        pip = [python, '-m', 'pip', '--disable-pip-version-check']
        env = dict()
        pip_freeze = subprocess.run(pip + ['freeze'], env=env, check=True, capture_output=True, text=True)
        if pip_freeze.stdout:
            raise Exception(f'Initial virtual environment is not empty:\n{pip_freeze.stdout}')
        subprocess.run(pip + ['install', 'wheel'], env=env, check=True)  # make bdist_wheel available during pip install
        subprocess.run(pip + ['install', '-r', self.source_path], env=env, check=True)
        freeze_options = ['--all']
        for exclude_package in exclude_packages:
            freeze_options.extend(('--exclude', exclude_package))
        pip_freeze = subprocess.run(pip + ['freeze'] + freeze_options, env=env, check=True, capture_output=True, text=True)
    self.write_requirements(pip_freeze.stdout)