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

Created on 2019-11-06 05:02 by acue, last changed 2019-11-06 05:38 by acue.

Messages (2)
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
History
Date User Action Args
2019-11-06 05:38:31acuesetmessages: + msg356096
2019-11-06 05:02:37acuecreate