Skip to main content

Determine what projects are blocking you from porting to Python 3

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

This script takes in a set of dependencies and then figures out which of them are holding you up from porting to Python 3.

Command-line/Web Usage

You can specify your dependencies in multiple ways:

caniusepython3 -r requirements.txt test-requirement.txt
caniusepython3 -m PKG-INFO
caniusepython3 -p numpy scipy ipython
# If your project's setup.py uses setuptools
# (note that setup_requires can't be checked) ...
python setup.py caniusepython3

The output of the script will tell you how many (implicit) dependencies you need to transition to Python 3 in order to allow you to make the same transition. It will also list what projects have no dependencies blocking their transition so you can ask them to start a port to Python 3.

If you prefer a web interface you can use https://caniusepython3.com by Jannis Leidel.

Integrating With Your Tests

If you want to check for Python 3 availability as part of your tests, you can use icanusepython3.check():

def check(requirements_paths=[], metadata=[], projects=[]):
    """Return True if all of the specified dependencies have been ported to Python 3.

    The requirements_paths argument takes a sequence of file paths to
    requirements files. The 'metadata' argument takes a sequence of strings
    representing metadata. The 'projects' argument takes a sequence of project
    names.

    Any project that is not listed on PyPI will be considered ported.
    """

You can then integrate it into your tests like so:

import unittest
import caniusepython3

class DependenciesOnPython3(unittest.TestCase):
  def test_dependencies(self):
    # Will begin to fail when dependencies are no longer blocking you
    # from using Python 3.
    self.assertFalse(caniusepython3.check(projects=['ipython']))

For the change log, how to tell if a project has been ported, as well as help on how to port a project, please see the project website.

Secret, bonus feature

If you would like to use a different name for the script and setuptools command then set the environment variable CIU_ALT_NAME to what you would like the alternative name to be. Reddit suggests icanhazpython3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caniusepython3-2.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

caniusepython3-2.1.0-py2.py3-none-any.whl (25.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file caniusepython3-2.1.0.tar.gz.

File metadata

File hashes

Hashes for caniusepython3-2.1.0.tar.gz
Algorithm Hash digest
SHA256 46766c1b9d6dd9f6e4761822b9f21b510eb5d3eddf6ba4e9c07549ac738c8cf2
MD5 008240b1b3d529130ce4e0c652a76541
BLAKE2b-256 c1467b902d0a578fedede2cc20d5bba14a7e9ef1937137942adb805d466ece9b

See more details on using hashes here.

File details

Details for the file caniusepython3-2.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for caniusepython3-2.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8e04435c4e4ecabbd930f2e9ee05d65659069ea300abee676c4280d015773517
MD5 bbf8fa830ac1eaeed37a0b9359b2a9f2
BLAKE2b-256 20166373fc0e1a5dde093c6e7c10492d2e95954aaa2515ac2493c1bdf0fa75ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page