Skip to content Skip to sidebar Skip to footer

How Do I Add A Python Tag To The Bdist_wheel Command Using Setuptools?

Let's say I have a simple library which uses setuptools for packaging and distributing. The library in this case also requires a minimum version of Python 3.6, meaning my setup.py

Solution 1:

Every command line argument for every distutils command can be persisted in setup config file. Create a file named setup.cfg in the same directory your setup.py resides in and store the custom bdist_wheel configuration in there:

# setup.cfg[bdist_wheel]python-tag=py36

Now running python setup.py bdist_wheel will be essentially the same as running python setup.py bdist_wheel --python-tag py36.

Relevant article in the distutils docs: Writing the Setup Configuration File.

Solution 2:

You could hack in something like

if'bdist_wheel'in sys.argv:
    ifnot any(arg.startswith('--python-tag') forargin sys.argv):
        sys.argv.extend(['--python-tag', 'py36'])

but it's arguably just as brittle...

Post a Comment for "How Do I Add A Python Tag To The Bdist_wheel Command Using Setuptools?"