[Distutils] complicated setup

Ethan Furman ethan at stoneleaf.us
Sat Jun 29 21:08:23 CEST 2013


On 06/29/2013 02:07 AM, Nick Coghlan wrote:
> On 29 June 2013 10:09, Ethan Furman <ethan at stoneleaf.us> wrote:
>> Am I making this too complicated?  Can I just do my renaming in the setup.py
>> script before calling the setup function?
>
> You can't easily create a wheel that way.
>
> What would actually be better is if you could avoid the need for any
> Python 3 specific syntax in the first place. Are you sure you can't
> tweak the code to use types.new_class or an inner function call to
> avoid the syntax problems?
>
> For example, Python 2 can do keyword only arguments like this:
>
>      def _unpack_args(module=None, type=None):
>          return module, type
>
>      class CallableWithKeywordOnlyArgs
>          def  __call__(cls, value, names=None, **kwargs):
>              module, type = _unpack_kwargs(**kwargs)
>
> The introspection support and error messages aren't as good as those
> for true Python 3 keyword-only arguments, but they're not *that* bad.
>
> There's a reason shared syntax compatible 2/3 source has become the
> most popular approach for straddling the 2/3 boundary - the
> alternatives are all lousy by comparison. Conditional distribution of
> version specific source files is far more painful than jumping through
> a few syntactic hoops to stay within the common 2/3 subset of the
> language.

I was hoping to provide good examples of Python 3 code (as opposed to good examples of 2/3 boundary straddling), but 
yeah, it's danged difficult!

Is there a way to have both a Py2 distribution and a Py3 distribution available on PyPI?

--
~Ethan~


More information about the Distutils-SIG mailing list