How to determine if a library (for example on pypi.org) is good for Python 3

Viewed 63

This is a generic question, but for example, I found pyxser and I want to know if it's going to work with Python 3 or not. I wasted 15-20 minutes earlier today finding out the 'Gnosis' was not.

I see the date on this particular package is March 2011, so I'm guessing it's not.

Is everything on pypi.org ancient? Is there a better site to use?

Basically, we all do a Google search for something like "xml serializer for Python" and we get a mix of Python 2 and 3 libraries.

Here is a similar question with no answer: Determining for which python version a library is designed

But the point is we need have a technique to find out for any library what releases it is compatible with.

2 Answers

Is everything on pypi.org ancient?

No.

Is there a better site to use?

No.

But the point is we need have a technique to find out for any library what releases it is compatible with.

There’s no such technique for any library, but many libraries will have:

  • language classifiers on PyPI – specifically, the ones that start with “Programming Language :: Python ::” are helpful here, with “Programming Language :: Python :: 3” indicating Python 3 support and “Programming Language :: Python :: 2 :: Only” indicating a lack of it. (See the sidebar of https://pypi.org/project/lxml/ for an example.)

  • python_requires, which PyPI also displays

  • wheels with an indication of Python versions in the “Download files” page. cp3x is a wheel for CPython 3.x, again indicating Python 3 support. (Example for this at https://pypi.org/project/lxml/#files.)

pypi.org has a small section on the left called requirements. Check that and It should show which version of python you need.

When your searching for a package you can also filter by ones that will only run on Python 3.

Related