My setup.py looks something like this:
from distutils.core import setup
setup(
[...]
install_requires=['gevent', 'ssl', 'configobj', 'simplejson', 'mechanize'],
[...]
)
Under Python 2.6 (or higher) the installation of the ssl module fails with:
ValueError: This extension should not be used with Python 2.6 or later (already built in), and has not been tested with Python 2.3.4 or earlier.
Is there a standard way to define dependencies only for specific python versions? Of course I could do it with if float(sys.version[:3]) < 2.6:
but maybe there is a better way to do it.
setup(name="my_package_name", python_requires='>3.5. 2', [...] Save this answer.
py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. I found a very detailed write-up explaining this issue: "Why you shouldn't invoke setup.py directly" (October 2021).
The setup.py file may be the most significant file that should be placed at the root of the Python project directory. It primarily serves two purposes: It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on.
It's just a list, so somewhere above you have to conditionally build a list. Something like to following is commonly done.
import sys
if sys.version_info < (2 , 6):
REQUIRES = ['gevent', 'ssl', 'configobj', 'simplejson', 'mechanize'],
else:
REQUIRES = ['gevent', 'configobj', 'simplejson', 'mechanize'],
setup(
# [...]
install_requires=REQUIRES,
# [...]
)
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