If you have been directed here from a pip warning, you don't need to take any action at this stage. Nothing is currently expected to break until Python 3.12, and a full solution will be implemented well before then.
Note that as of 3.10.2, this issue no longer affects Python 3.10 and later.
Quoting @uranusjr from Homebrew/discussions#1405:
I am one of the maintainers of pip, the Python package installer. We are recently informed that Homebrew is currently using
distutils.cfgto configure package installation schemes, and we believe it is best for Homebrew to remove the usage.Python is currently deprecating distutils, and will remove the module entirely in 3.10 (PEP 632). As a part of the transition, pip is moving all its current
distutilsusages to thesysconfigmodule instead, and a user recently reported pip would no longer work correctly with Homebrew-compiled Python after the transision. This is due to Homebrew’s usage ofdistutils.cfg, which is no longer supported insysconfig.The
distutils.cfgfile (and its various variants) has long been disfavoured by Python core maintainers, and the recommendation, if redistributors wish to provide custom install schemes, has been to directly patchdistutilsandsysconfiginstead. This is the current approach taken by all Linux distributions that we have contact with, and the community is working toward providing better support to the patching process (b.p.o-43976). I’m recommending Homebrew to also migrate away from thedistutils.cfgusage, since it is going to break while the community continuously migrate away fromdistutils, and stop working entirely when Python 3.12 lands, and join the conversation with other Python redistributors to improvesysconfigto support Homebrew’s needs.
Reposting here so it won't get buried in the Discussions page. We probably want to fix python@3.9 so it can be easily re-used for python@3.10.