classification
Title: setup parameter 'distclass' ignored for configuration files
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: acue, dstufft, eric.araujo, steve.dower
Priority: normal Keywords:

Created on 2019-11-06 05:02 by acue, last changed 2021-02-03 18:07 by steve.dower. This issue is now closed.

Messages (3)
msg356090 - (view) Author: Arno-Can Uestuensoez (acue) Date: 2019-11-06 05:02
Even though this involves 'setuptools', I write this issue here because of the tight coupling of 'distutils' and 'setuptools' e.g. by the passed 'self' parameter.

The central API 'setup()' - 'setuptools.init.setup()' - provides the parameter 'distclass=<distribution-class>'. This allows to define a custom 'Distribution' class to be used as a replacement of the 'Distribution' class.

First of all for an ordinary user it is not clear whether 'distutils.dist.Distribution', and/or 'setuptools.dist.Distribution' is replaced. Even more confusing, the 'self' parameter is cross-passed between the classes by using a derived instance provided by:

   _Distribution = get_unpatched(distutils.core.Distribution)

The second is the integration of the initialization bootstrap, which completely ignores the user defined custom class. The main API 'setup()' defined in 'setuptools.init.setup()' calls first the local private function '_install_setup_requires' - 'setuptools.init._install_setup_requires()', which calls the instanciates the hardcoded 'distutils.core.Distribution()', and therein calls the methods 'dist.parse_config_files()', and 'dist.fetch_build_eggs()', which - as far as I can see - finally prohibits the use of a custom version of these, or easily add another one.

The consequence is that the configuration file parameters could basically not be fully customized by the custom class.

The association with the parameter 'distclass' for me - and I guess for others too - is that the 'complete' 'Distribution' class could be customized by this API. But this is currently not possible. So, even though I see the problems that can arise from the use of the modified 'self' parameter - I would propose the application of the 'distclass' for the initial bootstrap by the read of the configuration file too. In case this prooves too risky - due to 'distutils' coupling with 'setuptools', at least a parameter for the initial read of the configuration files should be offered.


The best of course would be the fusion of both parts, probably in a future release.

I have tested 3.8.0, but as far as I can see this is the case for all releases.

PS: I am writing now another issue for the 'alias' command and going add the number as an possible example for the required custom class.
msg356096 - (view) Author: Arno-Can Uestuensoez (acue) Date: 2019-11-06 05:38
Current related issues are:

issue 38714
issue 38711
issue 38709
msg386253 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:07
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2021-02-03 18:07:49steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386253

resolution: out of date
stage: resolved
2019-11-06 05:38:31acuesetmessages: + msg356096
2019-11-06 05:02:37acuecreate