Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to decide whether to use distutils or sysconfig with sysconfig._PIP_USE_SYSCONFIG #10654

Merged
merged 1 commit into from
Nov 20, 2021

Conversation

hroncok
Copy link
Contributor

@hroncok hroncok commented Nov 12, 2021

(description of the change, taken from 63b5051)

Allow Python distributors to opt-out from or opt-in to the sysconfig installation scheme backend. By default, the installation scheme backend is sysconfig on Python 3.10 or later, but by setting the sysconfig._PIP_USE_SYSCONFIG the distributors can override this default: The boolean value of this private sysconfig attribute will take precedence over the default if set. This can be used for compatibility considerations as well as for opting in for more leading-edge technology if so desired. Distributors who set sysconfig._PIP_USE_SYSCONFIG = False are strongly encouraged to ensure distutils is present, e.g. it is not recommended to set this when distutils was removed from the standard library, as it will result in failures.

Fixes #10647

@pradyunsg
Copy link
Member

pradyunsg commented Nov 12, 2021

One option if you want to fully test this would be to factor this expression out into a function, and the instrument the dependencies of this function.

def _should_use_sysconfig():
    ...

# This is a function for testability, but should be constant during any one run.
_USE_SYSCONFIG = _should_use_sysconfig()

@hroncok
Copy link
Contributor Author

hroncok commented Nov 13, 2021

OK, this works as expected. Will play with the tests next week.

@hroncok hroncok force-pushed the allow-to-force-distutils branch 3 times, most recently from 607a9de to 03f1e5b Compare November 19, 2021 12:01
@hroncok hroncok marked this pull request as ready for review November 19, 2021 13:50
@pradyunsg pradyunsg merged commit 95a1605 into pypa:main Nov 20, 2021
@pradyunsg
Copy link
Member

Thanks @hroncok! :)

@hroncok hroncok deleted the allow-to-force-distutils branch November 20, 2021 16:57
@hroncok
Copy link
Contributor Author

hroncok commented Nov 20, 2021

Thanks for taking this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to force distutils as installation scheme backend even on Python 3.10
3 participants