Skip to content

Commit

Permalink
feat: require python >= 3.6 (#674)
Browse files Browse the repository at this point in the history
We are not ready to require >=3.6 in the main branch, so I am opening this PR against a new `2.0.0dev` branch. For googleapis/gapic-generator#3334 (comment)

Use native namespaces (delete `google/__init__.py` and require python>=3.6).

There is more cleanup that needs to happen (example: App Engine credentials) in future PRs.
  • Loading branch information
busunkim96 committed Jan 28, 2021
1 parent 621f54b commit e5cea39
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 295 deletions.
24 changes: 0 additions & 24 deletions google/__init__.py

This file was deleted.

6 changes: 1 addition & 5 deletions google/auth/jwt.py
Expand Up @@ -40,11 +40,7 @@
"""

try:
from collections.abc import Mapping
# Python 2.7 compatibility
except ImportError: # pragma: NO COVER
from collections import Mapping
from collections.abc import Mapping
import copy
import datetime
import json
Expand Down
9 changes: 0 additions & 9 deletions noxfile.py
Expand Up @@ -90,15 +90,6 @@ def unit(session):
)


@nox.session(python=["2.7"])
def unit_prev_versions(session):
session.install(*TEST_DEPENDENCIES)
session.install(".")
session.run(
"pytest", "--cov=google.auth", "--cov=google.oauth2", "--cov=tests", "tests"
)


@nox.session(python="3.7")
def cover(session):
session.install(*TEST_DEPENDENCIES)
Expand Down
24 changes: 12 additions & 12 deletions setup.py
Expand Up @@ -14,27 +14,30 @@

import io

from setuptools import find_packages
from setuptools import PEP420PackageFinder
from setuptools import setup


DEPENDENCIES = (
"cachetools>=2.0.0,<5.0",
"pyasn1-modules>=0.2.1",
# rsa==4.5 is the last version to support 2.7
# https://github.com/sybrenstuvel/python-rsa/issues/152#issuecomment-643470233
'rsa<4.6; python_version < "3.6"',
'rsa>=3.1.4,<5; python_version >= "3.6"',
"rsa>=3.1.4,<5",
"setuptools>=40.3.0",
"six>=1.9.0",
)

extras = {"aiohttp": "aiohttp >= 3.6.2, < 4.0.0dev; python_version>='3.6'"}
extras = {"aiohttp": "aiohttp >= 3.6.2, < 4.0.0dev"}

with io.open("README.rst", "r") as fh:
long_description = fh.read()

version = "1.24.0"
version = "2.0.0dev"

# Only include packages under the 'google' namespace. Do not include tests,
# benchmarks, etc.
packages = [
package for package in PEP420PackageFinder.find() if package.startswith("google")
]

setup(
name="google-auth",
Expand All @@ -44,16 +47,13 @@
description="Google Authentication Library",
long_description=long_description,
url="https://github.com/googleapis/google-auth-library-python",
packages=find_packages(exclude=("tests*", "system_tests*")),
namespace_packages=("google",),
packages=packages,
install_requires=DEPENDENCIES,
extras_require=extras,
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*",
python_requires=">=3.6",
license="Apache 2.0",
keywords="google auth oauth client",
classifiers=[
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
Expand Down
45 changes: 1 addition & 44 deletions system_tests/noxfile.py
Expand Up @@ -171,7 +171,7 @@ def configure_cloud_sdk(session, application_default_credentials, project=False)
TEST_DEPENDENCIES_ASYNC = ["aiohttp", "pytest-asyncio", "nest-asyncio"]
TEST_DEPENDENCIES_SYNC = ["pytest", "requests", "mock"]
PYTHON_VERSIONS_ASYNC = ["3.7"]
PYTHON_VERSIONS_SYNC = ["2.7", "3.7"]
PYTHON_VERSIONS_SYNC = ["3.7"]


@nox.session(python=PYTHON_VERSIONS_SYNC)
Expand Down Expand Up @@ -242,49 +242,6 @@ def compute_engine(session):
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_compute_engine.py")


@nox.session(python=["2.7"])
def app_engine(session):
if SKIP_GAE_TEST_ENV in os.environ:
session.log("Skipping App Engine tests.")
return

session.install(LIBRARY_DIR)
# Unlike the default tests above, the App Engine system test require a
# 'real' gcloud sdk installation that is configured to deploy to an
# app engine project.
# Grab the project ID from the cloud sdk.
project_id = (
subprocess.check_output(
["gcloud", "config", "list", "project", "--format", "value(core.project)"]
)
.decode("utf-8")
.strip()
)

if not project_id:
session.error(
"The Cloud SDK must be installed and configured to deploy to App " "Engine."
)

application_url = GAE_APP_URL_TMPL.format(GAE_TEST_APP_SERVICE, project_id)

# Vendor in the test application's dependencies
session.chdir(os.path.join(HERE, "system_tests_sync/app_engine_test_app"))
session.install(*TEST_DEPENDENCIES_SYNC)
session.run(
"pip", "install", "--target", "lib", "-r", "requirements.txt", silent=True
)

# Deploy the application.
session.run("gcloud", "app", "deploy", "-q", "app.yaml")

# Run the tests
session.env["TEST_APP_URL"] = application_url
session.chdir(HERE)
session.run("pytest", "system_tests_sync/test_app_engine.py")


@nox.session(python=PYTHON_VERSIONS_SYNC)
def grpc(session):
session.install(LIBRARY_DIR)
Expand Down

This file was deleted.

12 changes: 0 additions & 12 deletions system_tests/system_tests_sync/app_engine_test_app/app.yaml

This file was deleted.

This file was deleted.

133 changes: 0 additions & 133 deletions system_tests/system_tests_sync/app_engine_test_app/main.py

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions system_tests/system_tests_sync/test_app_engine.py

This file was deleted.

0 comments on commit e5cea39

Please sign in to comment.