Description
What's the problem this feature will solve?
I'm the developer of a package whose current version requires at least Python 3.8. This is reflected in python_requires
in setup.py
. The last version to support 3.7 is rather old and broken in many ways. When people run into issues with it, the advice is naturally to upgrade to the latest version.
The problem here is that if you run pip install --upgrade $PACKAGE
under Python 3.7 (tested with Python 3.7.9, pip 21.3.1, setuptools 60.5.0), it will simply report that everything's fine ('Requirement already satisfied'). Most importantly, it does not indicate at all that there is a newer version of the package which is incompatible with the Python version. pip index versions $PACKAGE
, pip install ${PACKAGE}==
, and friends also only list the compatible versions. There are very good reasons for this, of course. However, in particular for people unfamiliar with python_requires
, this results in them thinking they already have the current version of a package when they don't.
Describe the solution you'd like
I would like to see a warning on at least pip install --upgrade
and pip index versions
if higher version numbers get ignored, e.g.
WARNING: Ignoring newer versions of $PACKAGE (1.2.3, 1.2.4, ...) which are not compatible with your version of Python.
I'm not all that familiar with the intricacies, so please excuse my ignorance about other reasons why package versions might get pruned from the installation candidates. A more generic warning than just the Python version might be needed instead. However, from a user perspective, ideally it would tell all the relevant details, e.g. also 'requires at least Python 3.8' in this particular case.
Alternative Solutions
Other than checking from within the package what the current version is and printing a warning at execution time (as PRAW is doing with update_checker, for example), which has always annoyed me as a user and is definitely not a route I want to take, I cannot think of other approaches since the package code is not involved at all in this step of the installation process to my knowledge.
Additional context
The specific package, if relevant, is snscrape. Version 0.3.4 is the last to support Python 3.7.
Code of Conduct
- I agree to follow the PSF Code of Conduct.