diff --git a/aws_xray_sdk/core/plugins/ec2_plugin.py b/aws_xray_sdk/core/plugins/ec2_plugin.py index 763be1fc..5b8d3d2f 100644 --- a/aws_xray_sdk/core/plugins/ec2_plugin.py +++ b/aws_xray_sdk/core/plugins/ec2_plugin.py @@ -1,7 +1,11 @@ import json import logging -from future.standard_library import install_aliases -install_aliases() + +from aws_xray_sdk.core.utils.compat import PY2 + +if PY2: + from future.standard_library import install_aliases + install_aliases() from urllib.request import urlopen, Request diff --git a/aws_xray_sdk/ext/sqlalchemy/util/decorators.py b/aws_xray_sdk/ext/sqlalchemy/util/decorators.py index d82ef32d..fa67befc 100644 --- a/aws_xray_sdk/ext/sqlalchemy/util/decorators.py +++ b/aws_xray_sdk/ext/sqlalchemy/util/decorators.py @@ -3,8 +3,13 @@ from aws_xray_sdk.core import xray_recorder from aws_xray_sdk.ext.util import strip_url -from future.standard_library import install_aliases -install_aliases() + +from aws_xray_sdk.core.utils.compat import PY2 + +if PY2: + from future.standard_library import install_aliases + install_aliases() + from urllib.parse import urlparse, uses_netloc from sqlalchemy.engine.base import Connection diff --git a/setup.py b/setup.py index 019550d7..5384ea0a 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +import sys + from setuptools import setup, find_packages from os import path from aws_xray_sdk.version import VERSION @@ -12,6 +14,15 @@ long_description = read_md(path.join(CURRENT_DIR, 'README.md')) +INSTALL_REQUIRED_DEPS = [ + 'enum34;python_version<"3.4"', + 'wrapt', + 'botocore>=1.11.3', +] + +if sys.version_info[0] == 2: + INSTALL_REQUIRED_DEPS.append("future") + setup( name='aws-xray-sdk', version=VERSION, @@ -44,12 +55,7 @@ 'Programming Language :: Python :: 3.9', ], - install_requires=[ - 'enum34;python_version<"3.4"', - 'wrapt', - 'future', - 'botocore>=1.11.3', - ], + install_requires=INSTALL_REQUIRED_DEPS, keywords='aws xray sdk',