• This repository has been archived on 02/Jan/2021
  • Stars
    star
    414
  • Rank 104,550 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Can I Use Python 3?

** NOTE ** This project is no longer actively developed!

Can I Use Python 3?

Build Status

You can read the documentation on how to use caniusepython3 from its PyPI page. A web interface is also available.

How do you tell if a project has been ported to Python 3?

On PyPI each project can specify various trove classifiers (typically in a project's setup.py through a classifier argument to setup()). There are various classifiers related to what version of Python a project can run on. E.g.:

Programming Language :: Python :: 3
Programming Language :: Python :: 3.0
Programming Language :: Python :: 3.1
Programming Language :: Python :: 3.2
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7

As long as a trove classifier for some version of Python 3 is specified then the project is considered to support Python 3 (project owners: it is preferred you at least specify Programming Language :: Python :: 3 as that is how you end up listed on the Python 3 Packages list on PyPI; you can represent Python 2 support with Programming Language :: Python). Note that Python 3.0 through 3.4 have reached their End Of Life.

The other way is through a manual override in caniusepython3 itself. Projects ends up on this list because:

  • They are now part of Python's standard library in some release of Python 3
  • Their Python 3 port is under a different name
  • They are missing a Python 3 trove classifier but have actually been ported

If any of these various requirements are met, then a project is considered to support Python 3 and thus will be added to the manual overrides list. You can see the list of overrides when you use caniusepython3's CLI with verbose output turned on.

What if I know of a project that should be added to the overrides file?

If a project has Python 3 support in a release on PyPI but they have not added the proper trove classifier, then either submit a pull request or file an issue with the name of the project and a link to some proof that a release available on PyPI has indeed been ported (e.g. PyPI page stating the support, tox.ini file showing tests being run against Python 3, etc.). Projects that have Python 3 support in their version control system but not yet available on PyPI will not be considered for inclusion in the overrides file.

How can I get a project ported to Python 3?

Typically projects which have not switched to Python 3 yet are waiting for:

  • A dependency to be ported to Python 3
  • Someone to volunteer to put in the time and effort to do the port

Since caniusepython3 will tell you what dependencies are blocking a project that you depend on from being ported, you can try to port a project farther down your dependency graph to help a more direct dependency make the transition.

Which brings up the second point: volunteering to do a port. Most projects happily accept help, they just have not done the port yet because they have not had the time ("volunteering" can also take the form of paying someone to do the port on your behalf). Some projects are simply waiting for people to ask for it, so even speaking up politely and requesting a port can get the process started.

If you are looking for help to port a project, you can always search online for various sources of help. If you want a specific starting point there are HOWTOs in the Python documentation on porting pure Python modules and extension modules.

Can I use it as a pre-commit hook?

Yes! Begin by installing pre-commit:

pip install pre-commit
pre-commit install

You can add the following hook in your .pre-commit-config.yaml file.

    - repo: https://github.com/brettcannon/caniusepython3
      rev: v7.1.0  # Update as desired to new releases/tags
      hooks:
          - id: caniusepython3
            files: requirements\.txt$  # Update to match your requirements files accordingly.
            args: [
                -r  # Causes caniusepython3 to treat the `files` argument as a requirements file.
          ]
            stages: [commit]  # Change it to `manual`, if `caniusepython3` takes too long between commits, so as to only run them manually in build jobs.

If you are running manually somewhere, we can run the following command:

pre-commit run --hook-stage manual caniusepython3 --files  requirements.txt

Change Log

7.3.0

  • Usual overrides updates
  • Removed argparse as a requirement
  • Added Python 3.9 support
  • Silenced a warning from setuptools about importing distutils (via distlib) before setuptools itself
  • Made it a bit more clear that false-negatives are possible (by design)
  • Marked the project as retired

7.2.0

7.1.0

  • Remove unused imports from Pylint checker
  • Usual overrides updates
  • Introduce the --exclude flag (thanks Milind Shakya)

7.0.0

  • Drop Python 3.3 support
  • Usual overrides updates

6.0.0

  • Refactor some code to avoid a warning in Python 3.6
  • Stop calling pip's internals (pip 10 would break everything)
  • Fix "No handler found" output under Python 2.7 (patch by arnuschky)
  • Usual overrides updates

5.0.0

  • Return a 3 error code when a command completes successfully but there are found blockers (patch by pcattori; accidentally left out of the 4.0.0 release)
  • Officially support Python 3.6
  • Usual overrides updates

4.0.0

  • Stop using PyPI's XML-RPC API and move to its JSON one for better performance (and switch to https://pypi.org)
  • Load the overrides data from GitHub when possible, falling back to the data included with the package when necessary (thanks to shafrom for adding local, one-day caching)

3.4.1

3.4.0

  • Fix a dict comprehension failure with the pylint checker (patch by Jeroen Oldenburger)
  • Usual override updates
  • Python 3.5 support
  • Tests have been made less flaky
  • Use pypi.io instead of pypi.python.org
  • Normalize project names to help guarantee lookup success

3.3.0

  • Made tests more robust in the face of PyPI timing out
  • Added Python 3.5 support
  • Dropped Python 2.6 and 3.2 support
  • Updated tests to not use Twisted as a Python 2-only project
  • Fixed a bug where the pylint checker was incorrectly missing from __future__ import unicode_literals (issue #103; reported by David Euresti)
  • Usual overrides updates

3.2.0

  • Fix a failing test due to the assumed unported project being ported =)
  • Work around distlib 0.2.0 bug (patch by @rawrgulmuffins)
  • Usual override updates

3.1.0

  • Log more details when running under -v (patch by @msabramo)
  • Print a 🎉 -- it's a party popper in case you have mojibake for it -- when the terminal supports it and there are no blocking dependencies (patch by @msabramo)
  • Fix compatibility with pip 6.1.0 (patch by @msabramo)
  • Fix warning of missing logger when using setup.py integration (issue #80; patch by @msabramo)
  • Remove checkers for filter, map, range, and zip as they have been improved upon and merged upstream in Pylint
  • Updated outdated documentation
  • Usual override updates

3.0.0

  • Introduce caniusepython3.pylint_checker which extends pylint --py3k with very strict porting checks
  • Work around a bug in distlib
  • Compatibility fix for pip 6.0 (issue #72)
  • Usual override updates

2.2.0

  • Suppress an xmlrpclib.Fault exception under Python 2.6 when trying to close an XML-RPC connection (can't close a connection under Python 2.6 anyway and the exception has only been seen on Travis)
  • Move to unittest2 as a developer dependency
  • Move mock to a developer dependency
  • Usual override tweaks

2.1.2

  • Avoid infinite recursion when there is a circular dependency (issue #60)
  • Usual overrides tweaks

2.1.1

  • Normalize the names of direct dependencies for proper Python 3 compatibility checking (issue #55)
  • Properly set the logging details when executed from the entry point
  • Usual overrides tweaks

2.1.0

  • Verbose output will print what manual overrides are used and why (when available)
  • Fix logging to only be configured when running as a script as well as fix a format bug
  • Usual override updates

2.0.3

  • Fixed setup.py caniusepython3 to work with extras_require properly
  • Fix various errors triggered from the moving of the just_name() function to a new module in 2.0.0 (patch by Vaibhav Sagar w/ input from Jannis Leidel)
  • Usual overrides tweaks (thanks to CyrilRoelandteNovance for contributing)

2.0.2

  • Fix lack of unicode usage in a test
  • Make Python 2.6 happy again due to its distate of empty XML-RPC results

2.0.1

  • Fix syntax error

2.0.0

  • Tweak overrides
  • -r, -m, and -p now take 1+ arguments instead of a single comma-separated list
  • Unrecognized projects are considered ported to prevent the lack of info on the unrecognized project perpetually suggesting that it's never been ported
  • Introduced icanusepython3.check()

1.2.1

  • Fix -v to actually do something again
  • Tweaked overrides

1.2.0

  • -r accepts a comma-separated list of file paths

1.1.0

  • Setuptools command support
  • Various fixes

1.0

Initial release.

More Repositories

1

python-launcher

Python launcher for Unix
Rust
503
star
2

gidgethub

An async GitHub API library for Python
Python
314
star
3

desugar

Unravelling Python source code
Python
134
star
4

sans-io

Network protocol implementations in Python, sans I/O
Python
120
star
5

mousebender

Create reproducible installations for a virtual environment from a lock file
HTML
83
star
6

oplop

Generate account passwords based on a nickname and a master password
JavaScript
33
star
7

mnfy

Minify Python code
Python
28
star
8

pip-secure-install

Action to have pip install from a requirements file as securely as possible
27
star
9

stdlib-stats

Various statistics on Python's standard library
Jupyter Notebook
21
star
10

modutil

A library for working with Python modules
Python
19
star
11

free-labour

Calculate your open source contributions
Python
18
star
12

WWBD

The "What Would Brett Do?" VS Code extension
TypeScript
16
star
13

brettcannon

Python
13
star
14

find-duplicate-files

Find duplicate files recursively in one or more directories
Go
12
star
15

riscv-harmony

A RISC-V ISA simulator written in Rust
Rust
12
star
16

basicenum

Simple(r) enums
Python
12
star
17

dotfiles

Vim Script
8
star
18

check-for-changed-files

Action to check that PRs have changed certain files
TypeScript
8
star
19

release-often

GitHub Action for releasing a Python project to PyPI after every relevant, merged PR
Python
8
star
20

python-azure-web-app-cookiecutter

Cookiecutter template for a Python site on Azure Web Apps
Python
6
star
21

time-clock

A simple, one-page time/punch clock web app
Elm
4
star
22

vscode-zephyr-asdl

VS Code extension for the Zephyr Abstract Syntax Description Language
2
star
23

trips-history

Convert from a trip-oriented JSON format for easy inputting to GeoJSON for easy mapping
Dart
1
star
24

microvenv

A minimal re-implementation of Python's `venv` module
Python
1
star
25

travelbrag

Travelogue for Andrea & Brett
Jupyter Notebook
1
star
26

dotconfig

My collection of configuration files
Vim Script
1
star
27

nowhere-on-the-web

uBlock Origin filter list for "around the web"-style advertisers
1
star