Skip to content

change: Drop Python 3.5 support #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.5, 3.6, 3.7, 3.9, pypy3]
python: [3.6, 3.7, 3.8, 3.9, pypy3]

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ information on using pull requests.

### Initial Setup

You need Python 3.4+ to build and test the code in this repo.
You need Python 3.6+ 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
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ requests, code review feedback, and also pull requests.

## Supported Python Versions

We currently support Python 3.5+. However, Python 3.5 support is deprecated,
and the developers are strongly advised to use Python 3.6 or higher. Firebase
We currently support Python 3.6+. Firebase
Admin Python SDK is also tested on PyPy and
[Google App Engine](https://cloud.google.com/appengine/) environments.

Expand Down
16 changes: 3 additions & 13 deletions integration/test_project_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
TEST_APP_PACKAGE_NAME = 'com.firebase.adminsdk_python_integration_test'
TEST_APP_DISPLAY_NAME_PREFIX = 'Created By Firebase AdminSDK Python Integration Testing'

SHA_1_HASH_1 = '123456789a123456789a123456789a123456789a'
SHA_1_HASH_2 = 'aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbb'
SHA_256_HASH_1 = '123456789a123456789a123456789a123456789a123456789a123456789a1234'
SHA_256_HASH_2 = 'cafef00dba5eba11b01dfaceacc01adeda7aba5eca55e77e0b57ac1e5ca1ab1e'
SHA_1 = project_management.SHACertificate.SHA_1
Expand Down Expand Up @@ -119,17 +117,13 @@ def test_android_sha_certificates(android_app):
for cert in android_app.get_sha_certificates():
android_app.delete_sha_certificate(cert)

# Add four different certs and assert that they have all been added successfully.
android_app.add_sha_certificate(project_management.SHACertificate(SHA_1_HASH_1))
android_app.add_sha_certificate(project_management.SHACertificate(SHA_1_HASH_2))
# Add two different certs and assert that they have all been added successfully.
android_app.add_sha_certificate(project_management.SHACertificate(SHA_256_HASH_1))
android_app.add_sha_certificate(project_management.SHACertificate(SHA_256_HASH_2))

cert_list = android_app.get_sha_certificates()

sha_1_hashes = set(cert.sha_hash for cert in cert_list if cert.cert_type == SHA_1)
sha_256_hashes = set(cert.sha_hash for cert in cert_list if cert.cert_type == SHA_256)
assert sha_1_hashes == set([SHA_1_HASH_1, SHA_1_HASH_2])
assert sha_256_hashes == set([SHA_256_HASH_1, SHA_256_HASH_2])
for cert in cert_list:
assert cert.name
Expand Down Expand Up @@ -195,12 +189,8 @@ def test_list_ios_apps(ios_app):
def test_get_ios_app_config(ios_app, project_id):
config = ios_app.get_config()

# In Python 2.7, the plistlib module works with strings, while in Python 3, it is significantly
# redesigned and works with bytes objects instead.
try:
plist = plistlib.loads(config.encode('utf-8'))
except AttributeError: # Python 2.7 plistlib does not have the loads attribute.
plist = plistlib.readPlistFromString(config) # pylint: disable=no-member
plist = plistlib.loads(config.encode('utf-8'))

assert plist['BUNDLE_ID'] == TEST_APP_BUNDLE_ID
assert plist['PROJECT_ID'] == project_id
assert plist['GOOGLE_APP_ID'] == ios_app.app_id
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@


(major, minor) = (sys.version_info.major, sys.version_info.minor)
if major != 3 or minor < 5:
print('firebase_admin requires python >= 3.5', file=sys.stderr)
if major != 3 or minor < 6:
print('firebase_admin requires python >= 3.6', file=sys.stderr)
sys.exit(1)

# Read in the package metadata per recommendations from:
Expand Down Expand Up @@ -55,15 +55,15 @@
keywords='firebase cloud development',
install_requires=install_requires,
packages=['firebase_admin'],
python_requires='>=3.5',
python_requires='>=3.6',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'License :: OSI Approved :: Apache Software License',
],
Expand Down
9 changes: 2 additions & 7 deletions tests/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io
import os

import pytest
from _pytest.monkeypatch import MonkeyPatch

from google.auth import credentials
from google.auth import transport
Expand Down Expand Up @@ -61,12 +61,7 @@ def run_without_project_id(func):


def new_monkeypatch():
try:
return pytest.MonkeyPatch()
except AttributeError:
# Fallback for Python 3.5
from _pytest.monkeypatch import MonkeyPatch
return MonkeyPatch()
return MonkeyPatch()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just return pytest.MonkeyPatch()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like pytest.MonkeyPatch() works for pytest 6.2 and up. Our CIs use the latest version so I think it would be safe to update this code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just set pytest version to 6.2 and up in requirements.txt file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Updated.



class MockResponse(transport.Response):
Expand Down