How do I build a universal wheel from setup.py
? I would prefer not to pass in the --universal
option each time or to create a setup.cfg
file just for this option.
I am aware of the workaround in https://stackoverflow.com/a/35112241/6947337, but is there a clean way of doing this without creating a setup.cfg
file temporarily?
setup.py's setup()
supports an options
argument to pass options to any command. It is a dictionary of command names and command options. You can instruct it to build a universal wheel by providing any truthy value accepted by strtobool e.g.
setup(options={'bdist_wheel':{'universal':'1'}})
or
setup(options={'bdist_wheel':{'universal':True}})
See also https://github.com/python/cpython/blob/master/Lib/distutils/dist.py#L247
If you only want to make a Python 3 compatible wheel, you don't have to pass any argument. The wheel will automatically be tagged as py3 if it it is built in a Python 3 interpreter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With