GrahamDumpleton / wrapt

A Python module for decorators, wrappers and monkey patching.
BSD 2-Clause "Simplified" License
2.04k stars 230 forks source link

Using setuptools to replace distutils #169

Closed tklltkioc closed 3 years ago

tklltkioc commented 3 years ago

os:centos 7.9 python:3.7.4

pip list:
pip        20.2.2
setuptools 40.4.3
wheel      0.35.1

When i run command python setup.py bdist_wheel,i get error: invalid command 'bdist_wheel' and after modify setup.py one line, wheel is build success. As follows:

#from distutils.core import setup                                                                                                                                                                      
from setuptools import setup                                                                                                                                                                         
from distutils.core import Extension                                                                                                                                                                  
from distutils.command.build_ext import build_ext

so have you ever considered using setuptools to replace distutils.In particular, setuptools is an enhanced alternative to distutils.

GrahamDumpleton commented 3 years ago

Once upon a time you could not rely on setuptools being present and trying to hardwire a dependency on specific versions could cause lots of problems.

From what I remember, if you install the wheel package you should then be able to do bdist_wheel even when distutils is used.

Try that for now and when next working on wrapt will look into how safe it is now to depend on setuptools explicitly.

tklltkioc commented 3 years ago

ok. Thank you for your reply

henryiii commented 3 years ago

This is considered very safe now, in fact pip injects setuptools for you, using distutils can generate a warning, and there’s even a PEP to remove distutils. Ideally, you could add a pyproject.toml that includes the setuptools requirement.

Note that this is the third highest library on https://pythonwheels.com/ without wheels available. :(

GrahamDumpleton commented 3 years ago

Switch to setuptools is done in 1.13.0 and PyPi from that version will also host wheels.