Search code examples
pythonpypi

How do I check the version of python a module supports?


I was wondering if there is a generic way to find out if your version of python is supported by a specific module?

For example, let us say that I have python 3.11 installed on my computer and I want to install the modules biopython and lru-dict. Going to their respective pypi entries biopython shows this in their Project description:

Python Requirements

We currently recommend using Python 3.10 from http://www.python.org

Biopython is currently supported and tested on the following Python implementations:

Python 3.7, 3.8, 3.9, 3.10 and 3.11 – see http://www.python.org

PyPy3.7 v7.3.5 – or later, see http://www.pypy.org

However, if we check the lru-dict entry, their Project description does not mention Python requirements. I did eventually find out that python 3.11 is not supported by finding a issue on their github page.

Is there a simpler way of finding this information out?


Solution

  • No, there is no generic way.

    If the library has tests you can run them and check, but it might give you false positives as well as false negatives :shrug:

    The lru-dict has this fragment in their setup.py, which is one of the places you can check for supported versions:

            'Programming Language :: C',
            'Programming Language :: Python :: 3',
            'Programming Language :: Python :: 3.7',
            'Programming Language :: Python :: 3.8',
            'Programming Language :: Python :: 3.9',
            'Programming Language :: Python :: 3.10',
            'Programming Language :: Python :: 3.11',
            'Programming Language :: Python :: Implementation :: CPython',
    

    So as you can see, I don't think they knew about the issue.