Skip to content

Commit c6d1f06

Browse files
authored
Only import future for py2 (#343)
1 parent 816ab26 commit c6d1f06

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

aws_xray_sdk/core/plugins/ec2_plugin.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import json
22
import logging
3-
from future.standard_library import install_aliases
4-
install_aliases()
3+
4+
from aws_xray_sdk.core.utils.compat import PY2
5+
6+
if PY2:
7+
from future.standard_library import install_aliases
8+
install_aliases()
59

610
from urllib.request import urlopen, Request
711

aws_xray_sdk/ext/sqlalchemy/util/decorators.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33

44
from aws_xray_sdk.core import xray_recorder
55
from aws_xray_sdk.ext.util import strip_url
6-
from future.standard_library import install_aliases
7-
install_aliases()
6+
7+
from aws_xray_sdk.core.utils.compat import PY2
8+
9+
if PY2:
10+
from future.standard_library import install_aliases
11+
install_aliases()
12+
813
from urllib.parse import urlparse, uses_netloc
914
from sqlalchemy.engine.base import Connection
1015

setup.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
from setuptools import setup, find_packages
24
from os import path
35
from aws_xray_sdk.version import VERSION
@@ -12,6 +14,15 @@
1214

1315
long_description = read_md(path.join(CURRENT_DIR, 'README.md'))
1416

17+
INSTALL_REQUIRED_DEPS = [
18+
'enum34;python_version<"3.4"',
19+
'wrapt',
20+
'botocore>=1.11.3',
21+
]
22+
23+
if sys.version_info[0] == 2:
24+
INSTALL_REQUIRED_DEPS.append("future")
25+
1526
setup(
1627
name='aws-xray-sdk',
1728
version=VERSION,
@@ -44,12 +55,7 @@
4455
'Programming Language :: Python :: 3.9',
4556
],
4657

47-
install_requires=[
48-
'enum34;python_version<"3.4"',
49-
'wrapt',
50-
'future',
51-
'botocore>=1.11.3',
52-
],
58+
install_requires=INSTALL_REQUIRED_DEPS,
5359

5460
keywords='aws xray sdk',
5561

0 commit comments

Comments
 (0)