From 82f2af60dfc9eec42323bdf166ccc758f289a560 Mon Sep 17 00:00:00 2001 From: hiranya911 Date: Tue, 7 Jan 2020 14:15:03 -0800 Subject: [PATCH] Removing Python 2 support --- .travis.yml | 2 +- CONTRIBUTING.md | 49 +------------------------------------- README.md | 6 ++--- requirements.txt | 1 - scripts/prepare_release.sh | 2 +- setup.py | 8 +++---- tox.ini | 33 ------------------------- 7 files changed, 8 insertions(+), 93 deletions(-) delete mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml index 4db3c3708..0c00ccc23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: python python: - - "2.7" - "3.4" - "3.5" - "3.6" + - "3.7" - "pypy3.5" jobs: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b4a0ea84..7b521ec99 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,7 +85,7 @@ information on using pull requests. ### Initial Setup -You need Python 2.7 or Python 3.4+ to build and test the code in this repo. +You need Python 3.4+ to build and test the code in this repo. We recommend using [pip](https://pypi.python.org/pypi/pip) for installing the necessary tools and project dependencies. Most recent versions of Python ship with pip. If your development environment @@ -227,53 +227,6 @@ pytest --cov --cov-report html and point your browser to `file:////htmlcov/index.html` (where `dir` is the location from which the report was created). - -### Testing in Different Environments - -Sometimes we want to run unit tests in multiple environments (e.g. different Python versions), and -ensure that the SDK works as expected in each of them. We use -[tox](https://tox.readthedocs.io/en/latest/) for this purpose. - -But before you can invoke tox, you must set up all the necessary target environments on your -workstation. The easiest and cleanest way to achieve this is by using a tool like -[pyenv](https://github.com/pyenv/pyenv). Refer to the -[pyenv documentation](https://github.com/pyenv/pyenv#installation) for instructions on how to -install it. This generally involves installing some binaries as well as modifying a system level -configuration file such as `.bash_profile`. Once pyenv is installed, you can install multiple -versions of Python as follows: - -``` -pyenv install 2.7.6 # install Python 2.7.6 -pyenv install 3.3.0 # install Python 3.3.0 -pyenv install pypy2-5.6.0 # install pypy2 -``` - -Refer to the [`tox.ini`](tox.ini) file for a list of target environments that we usually test. -Use pyenv to install all the required Python versions on your workstation. Verify that they are -installed by running the following command: - -``` -pyenv versions -``` - -To make all the required Python versions available to tox for testing, run the `pyenv local` command -with all the Python versions as arguments. The following example shows how to make Python versions -2.7.6, 3.3.0 and pypy2 available to tox. - -``` -pyenv local 2.7.6 3.3.0 pypy2-5.6.0 -``` - -Once your system is fully set up, you can execute the following command from the root of the -repository to launch tox: - -``` -tox -``` - -This command will read the list of target environments from `tox.ini`, and execute tests in each of -those environments. It will also generate a code coverage report at the end of the execution. - ### Repo Organization Here are some highlights of the directory structure and notable source files diff --git a/README.md b/README.md index 757a3f8cd..8e9efd0ee 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,8 @@ requests, code review feedback, and also pull requests. ## Supported Python Versions -We currently support Python 2.7 and Python 3.4+. However, Python 2.7 support is -being phased out, and the developers are advised to use latest Python 3. -Firebase Admin Python SDK is also tested on PyPy and -[Google App Engine](https://cloud.google.com/appengine/) environments. +We currently support Python 3.4+. Firebase Admin Python SDK is also tested on +PyPy and [Google App Engine](https://cloud.google.com/appengine/) environments. ## Documentation diff --git a/requirements.txt b/requirements.txt index cc4534b03..2f1a09a5b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ pylint == 1.6.4 pytest >= 3.6.0 pytest-cov >= 2.4.0 pytest-localserver >= 0.4.1 -tox >= 3.6.0 cachecontrol >= 0.12.6 google-api-core[grpc] >= 1.14.0, < 2.0.0dev; platform.python_implementation != 'PyPy' diff --git a/scripts/prepare_release.sh b/scripts/prepare_release.sh index ca30d9043..aa55dae92 100755 --- a/scripts/prepare_release.sh +++ b/scripts/prepare_release.sh @@ -132,7 +132,7 @@ fi ################## echo "[INFO] Running unit tests" -tox +pytest ../tests echo "[INFO] Running integration tests" pytest ../integration --cert cert.json --apikey apikey.txt diff --git a/setup.py b/setup.py index cb698f774..b492ec922 100644 --- a/setup.py +++ b/setup.py @@ -22,8 +22,8 @@ (major, minor) = (sys.version_info.major, sys.version_info.minor) -if (major == 2 and minor < 7) or (major == 3 and minor < 4): - print('firebase_admin requires python2 >= 2.7 or python3 >= 3.4', file=sys.stderr) +if major != 3 or minor < 4: + print('firebase_admin requires python >= 3.4', file=sys.stderr) sys.exit(1) # Read in the package metadata per recommendations from: @@ -56,13 +56,11 @@ keywords='firebase cloud development', install_requires=install_requires, packages=['firebase_admin'], - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=3.4', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Topic :: Software Development :: Build Tools', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', diff --git a/tox.ini b/tox.ini deleted file mode 100644 index dec7b618f..000000000 --- a/tox.ini +++ /dev/null @@ -1,33 +0,0 @@ -# Tox (https://tox.readthedocs.io/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - -[tox] -envlist = py2,py3,pypy,cover - -[testenv] -passenv = - FIREBASE_DATABASE_EMULATOR_HOST -commands = pytest {posargs} -deps = - pytest - pytest-localserver - -[coverbase] -basepython = python2.7 -commands = - pytest \ - --cov=firebase_admin \ - --cov=tests -deps = {[testenv]deps} - coverage - pytest-cov - -[testenv:cover] -basepython = {[coverbase]basepython} -commands = - {[coverbase]commands} - coverage report --show-missing -deps = - {[coverbase]deps}