pypa / pypa/distutils

[Feature Request] Public interface for _msvccompiler._get_vc_env

Open
#340 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
59
Forks
94
PR merge metrics
No merged PRs in 30d

Description

pytorch's repository is using an import of setuptools / distutil.

https://github.com/pytorch/pytorch/blob/main/tools/build_pytorch_libs.py#L17-L25

def _get_vc_env(vc_arch: str) -> dict[str, str]:
    try:
        from setuptools import distutils  # type: ignore[import]

        return distutils._msvccompiler._get_vc_env(vc_arch)  # type: ignore[no-any-return]
    except AttributeError:
        from setuptools._distutils import _msvccompiler  # type: ignore[import]

        return _msvccompiler._get_vc_env(vc_arch)  # type: ignore[no-any-return]

However, its location/implementation is being changed and causing the errors as follows:

AttributeError: module 'distutils._msvccompiler' has no attribute '_get_vc_env'

Example issues:
https://github.com/pypa/setuptools/issues/4874
https://github.com/pytorch/pytorch/issues/148877
https://github.com/pytorch/pytorch/issues/141319


Could you please open a reliable public interface for _get_vc_env , so pytorch 's repository could be updated to use that import for the future versions?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the _get_vc_env call in pytorch's tools/build_pytorch_libs.py and the reported AttributeError cases. Trace where _msvccompiler currently provides this functionality and determine the stable public interface needed for future callers. Done means callers can access the Visual C++ environment without relying on the private attribute.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.