You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by jo...@apache.org on 2020/07/20 03:21:36 UTC

[incubator-heron] branch master updated: Strip old python requirements (#3569)

This is an automated email from the ASF dual-hosted git repository.

joshfischer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/master by this push:
     new cd42fa8  Strip old python requirements (#3569)
cd42fa8 is described below

commit cd42fa8573f8ff6d739f16a2bb7a4ee6637b64d8
Author: Oliver Bristow <ev...@gmail.com>
AuthorDate: Mon Jul 20 04:21:26 2020 +0100

    Strip old python requirements (#3569)
    
    * Remove enum34+future+argparse
    
    * Remove six
    
    * DRY up zkstatemanager.py
    
    * Remove pycrypto
    
    * Remove external dependancies for unittest2+mock+py
---
 heron/common/tests/python/pex_loader/BUILD         |   2 -
 heron/executor/tests/python/BUILD                  |   2 -
 .../tests/python/heron_executor_unittest.py        |   2 +-
 heron/instance/src/python/BUILD                    |   1 -
 heron/instance/tests/python/BUILD                  |   4 -
 heron/instance/tests/python/network/BUILD          |  17 ---
 .../tests/python/network/event_looper_unittest.py  |   2 +-
 .../python/network/gateway_looper_unittest.py      |   2 +-
 .../tests/python/network/heron_client_unittest.py  |   2 +-
 .../tests/python/network/mock_generator.py         |   4 +-
 .../tests/python/network/protocol_unittest.py      |   2 +-
 heron/instance/tests/python/utils/BUILD            |  20 ----
 heron/instance/tests/python/utils/log_unittest.py  |   2 +-
 .../instance/tests/python/utils/mock_generator.py  |   2 +-
 .../tests/python/utils/py_metrics_unittest.py      |   2 +-
 heron/shell/src/python/BUILD                       |   1 -
 .../src/python/handlers/killexecutorhandler.py     |   4 -
 heron/statemgrs/src/python/statemanager.py         |   3 +-
 heron/statemgrs/src/python/zkstatemanager.py       | 118 +++++++--------------
 heron/statemgrs/tests/python/BUILD                 |   6 --
 .../tests/python/configloader_unittest.py          |   2 +-
 .../tests/python/statemanagerfactory_unittest.py   |   2 +-
 .../tests/python/zkstatemanager_unittest.py        |   2 +-
 heron/tools/admin/src/python/BUILD                 |   1 -
 heron/tools/admin/src/python/standalone.py         |   1 -
 heron/tools/cli/src/python/BUILD                   |   2 -
 heron/tools/cli/src/python/result.py               |   1 -
 heron/tools/cli/src/python/submit.py               |   4 -
 heron/tools/cli/tests/python/BUILD                 |   5 -
 .../cli/tests/python/client_command_unittest.py    |   5 +-
 heron/tools/cli/tests/python/opts_unittest.py      |   2 +-
 heron/tools/explorer/tests/python/BUILD            |   3 -
 .../explorer/tests/python/explorer_unittest.py     |   4 +-
 heron/tools/tracker/src/python/BUILD               |   1 -
 heron/tools/tracker/src/python/main.py             |   2 -
 heron/tools/tracker/tests/python/BUILD             |  12 ---
 .../tests/python/query_operator_unittest.py        |   2 +-
 heron/tools/tracker/tests/python/query_unittest.py |   4 +-
 .../tracker/tests/python/topology_unittest.py      |   2 +-
 .../tools/tracker/tests/python/tracker_unittest.py |  22 ++--
 heron/tools/ui/src/python/BUILD                    |   1 -
 heron/tools/ui/src/python/main.py                  |   1 -
 heronpy/api/tests/python/BUILD                     |  10 --
 heronpy/api/tests/python/serializer_unittest.py    |   3 +-
 heronpy/api/topology.py                            |   4 +-
 .../src/python/integration_test/core/BUILD         |   2 +-
 .../integration_test/core/aggregator_bolt.py       |   3 -
 .../src/python/local_test_runner/BUILD             |   2 -
 .../src/python/local_test_runner/test_template.py  |   3 -
 integration_test/src/python/test_runner/BUILD      |   2 -
 .../src/python/topology_test_runner/BUILD          |   2 -
 scripts/packages/heronpy/requirements.txt          |   1 -
 scripts/resources/idea/libraries/hp_dep.xml        |   3 -
 53 files changed, 78 insertions(+), 236 deletions(-)

diff --git a/heron/common/tests/python/pex_loader/BUILD b/heron/common/tests/python/pex_loader/BUILD
index 636b110..fe07190 100644
--- a/heron/common/tests/python/pex_loader/BUILD
+++ b/heron/common/tests/python/pex_loader/BUILD
@@ -8,9 +8,7 @@ pex_pytest(
         "pex_loader_unittest.py",
     ],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/common/src/python:common-py",
diff --git a/heron/executor/tests/python/BUILD b/heron/executor/tests/python/BUILD
index 688bc76..480ece6 100644
--- a/heron/executor/tests/python/BUILD
+++ b/heron/executor/tests/python/BUILD
@@ -5,9 +5,7 @@ pex_pytest(
     size = "small",
     srcs = ["heron_executor_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/executor/src/python:executor-py",
diff --git a/heron/executor/tests/python/heron_executor_unittest.py b/heron/executor/tests/python/heron_executor_unittest.py
index 823898c..f097999 100644
--- a/heron/executor/tests/python/heron_executor_unittest.py
+++ b/heron/executor/tests/python/heron_executor_unittest.py
@@ -21,7 +21,7 @@
 '''heron executor unittest'''
 import os
 import socket
-import unittest2 as unittest
+import unittest
 import json
 
 from pprint import pprint
diff --git a/heron/instance/src/python/BUILD b/heron/instance/src/python/BUILD
index d9860334..8619c67 100644
--- a/heron/instance/src/python/BUILD
+++ b/heron/instance/src/python/BUILD
@@ -18,7 +18,6 @@ pex_binary(
     srcs = ["instance/st_heron_instance.py"],
     reqs = [
         "colorlog==2.6.1",
-        "future==0.18.2",
         "PyYAML==3.13",
     ],
     deps = [":instance-py"],
diff --git a/heron/instance/tests/python/BUILD b/heron/instance/tests/python/BUILD
index dd0cc3c..f01bee9 100644
--- a/heron/instance/tests/python/BUILD
+++ b/heron/instance/tests/python/BUILD
@@ -4,11 +4,7 @@ pex_library(
     name = "instance-tests-py",
     srcs = ["mock_protobuf.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
-        "mock==1.0.1",
-        "future==0.18.2",
     ],
     deps = [
         "//heron/proto:proto-py",
diff --git a/heron/instance/tests/python/network/BUILD b/heron/instance/tests/python/network/BUILD
index 5d6c604..7cbb6e6 100644
--- a/heron/instance/tests/python/network/BUILD
+++ b/heron/instance/tests/python/network/BUILD
@@ -4,7 +4,6 @@ pex_library(
     name = "instance-network-mock",
     srcs = ["mock_generator.py"],
     reqs = [
-        "mock==1.0.1",
     ],
     deps = [
         "//heron/instance/tests/python:instance-tests-py",
@@ -15,7 +14,6 @@ pex_library(
     name = "instance-network-mock-client",
     srcs = ["mock_generator_client.py"],
     reqs = [
-        "mock==1.0.1",
     ],
     deps = [
         "//heron/instance/tests/python:instance-tests-py",
@@ -27,9 +25,7 @@ pex_pytest(
     size = "small",
     srcs = ["st_stmgr_client_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         ":instance-network-mock",
@@ -43,9 +39,7 @@ pex_pytest(
     size = "small",
     srcs = ["metricsmgr_client_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         ":pytest-network-py",
@@ -58,9 +52,7 @@ pex_library(
     name = "pytest-network-py",
     srcs = ["mock_generator.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         ":instance-network-mock-client",
@@ -72,9 +64,7 @@ pex_pytest(
     size = "small",
     srcs = ["protocol_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         ":pytest-network-py",
@@ -88,10 +78,7 @@ pex_pytest(
     size = "small",
     srcs = ["heron_client_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
-        "mock==1.0.1",
     ],
     deps = [
         ":pytest-network-py",
@@ -105,9 +92,7 @@ pex_pytest(
     size = "small",
     srcs = ["gateway_looper_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/src/python:instance-py",
@@ -119,9 +104,7 @@ pex_pytest(
     size = "small",
     srcs = ["event_looper_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/src/python:instance-py",
diff --git a/heron/instance/tests/python/network/event_looper_unittest.py b/heron/instance/tests/python/network/event_looper_unittest.py
index 0fe3411..386fc35 100644
--- a/heron/instance/tests/python/network/event_looper_unittest.py
+++ b/heron/instance/tests/python/network/event_looper_unittest.py
@@ -20,7 +20,7 @@
 
 '''Unittest for EventLooper'''
 import time
-import unittest2 as unittest
+import unittest
 
 from heron.instance.src.python.network import EventLooper
 
diff --git a/heron/instance/tests/python/network/gateway_looper_unittest.py b/heron/instance/tests/python/network/gateway_looper_unittest.py
index de8ecc7..ed32772 100644
--- a/heron/instance/tests/python/network/gateway_looper_unittest.py
+++ b/heron/instance/tests/python/network/gateway_looper_unittest.py
@@ -21,7 +21,7 @@
 '''Unittest for GatewayLooper'''
 import threading
 import time
-import unittest2 as unittest
+import unittest
 
 from heron.instance.src.python.network.gateway_looper import GatewayLooper
 
diff --git a/heron/instance/tests/python/network/heron_client_unittest.py b/heron/instance/tests/python/network/heron_client_unittest.py
index 68e4711..cd0a89f 100644
--- a/heron/instance/tests/python/network/heron_client_unittest.py
+++ b/heron/instance/tests/python/network/heron_client_unittest.py
@@ -22,7 +22,7 @@
 # pylint: disable=missing-docstring
 # pylint: disable=protected-access
 
-import unittest2 as unittest
+import unittest
 from heron.instance.src.python.network import StatusCode
 import heron.instance.tests.python.network.mock_generator_client as mock_generator
 import heron.instance.tests.python.mock_protobuf as mock_protobuf
diff --git a/heron/instance/tests/python/network/mock_generator.py b/heron/instance/tests/python/network/mock_generator.py
index e589328..272d0d6 100644
--- a/heron/instance/tests/python/network/mock_generator.py
+++ b/heron/instance/tests/python/network/mock_generator.py
@@ -26,9 +26,9 @@ from heron.instance.src.python.utils.misc import HeronCommunicator
 from heron.instance.src.python.network import SingleThreadStmgrClient, MetricsManagerClient
 from heron.instance.src.python.network import SocketOptions
 import heron.instance.tests.python.mock_protobuf as mock_protobuf
-from mock import Mock
+from unittest.mock import Mock
 
-from mock import patch
+from unittest.mock import patch
 
 class MockSTStmgrClient(SingleThreadStmgrClient):
   HOST = '127.0.0.1'
diff --git a/heron/instance/tests/python/network/protocol_unittest.py b/heron/instance/tests/python/network/protocol_unittest.py
index d42ddb8..0b5fa61 100644
--- a/heron/instance/tests/python/network/protocol_unittest.py
+++ b/heron/instance/tests/python/network/protocol_unittest.py
@@ -20,7 +20,7 @@
 
 
 # pylint: disable=missing-docstring
-import unittest2 as unittest
+import unittest
 from heron.instance.src.python.network import REQID, HeronProtocol, IncomingPacket
 import heron.instance.tests.python.network.mock_generator_client as mock_generator
 
diff --git a/heron/instance/tests/python/utils/BUILD b/heron/instance/tests/python/utils/BUILD
index e1c71a1..c24cb90 100644
--- a/heron/instance/tests/python/utils/BUILD
+++ b/heron/instance/tests/python/utils/BUILD
@@ -4,7 +4,6 @@ pex_library(
     name = "common-utils-mock",
     srcs = ["mock_generator.py"],
     reqs = [
-        "mock==1.0.1",
     ],
     deps = [
         "//heron/instance/src/python:instance-py",
@@ -17,9 +16,7 @@ pex_pytest(
     size = "small",
     srcs = ["communicator_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -31,9 +28,7 @@ pex_pytest(
     size = "small",
     srcs = ["custom_grouping_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -45,9 +40,7 @@ pex_pytest(
     size = "small",
     srcs = ["metrics_helper_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -59,9 +52,7 @@ pex_pytest(
     size = "small",
     srcs = ["outgoing_tuple_helper_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -73,9 +64,7 @@ pex_pytest(
     size = "small",
     srcs = ["pplan_helper_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -87,9 +76,7 @@ pex_pytest(
     size = "small",
     srcs = ["topology_context_impl_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -101,9 +88,7 @@ pex_pytest(
     size = "small",
     srcs = ["tuple_helper_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -115,9 +100,7 @@ pex_pytest(
     size = "small",
     srcs = ["global_metrics_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         ":common-utils-mock",
@@ -130,9 +113,7 @@ pex_pytest(
     size = "small",
     srcs = ["py_metrics_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
@@ -145,7 +126,6 @@ pex_pytest(
     srcs = ["log_unittest.py"],
     reqs = [
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/instance/tests/python/utils:common-utils-mock",
diff --git a/heron/instance/tests/python/utils/log_unittest.py b/heron/instance/tests/python/utils/log_unittest.py
index 2fde7dd..6497109 100644
--- a/heron/instance/tests/python/utils/log_unittest.py
+++ b/heron/instance/tests/python/utils/log_unittest.py
@@ -22,7 +22,7 @@
 # pylint: disable=missing-docstring
 
 import unittest
-from mock import patch, Mock, call
+from unittest.mock import patch, Mock, call
 from io import StringIO
 
 from heron.common.src.python.utils import proc
diff --git a/heron/instance/tests/python/utils/mock_generator.py b/heron/instance/tests/python/utils/mock_generator.py
index 79c9a5e..a6439ad 100644
--- a/heron/instance/tests/python/utils/mock_generator.py
+++ b/heron/instance/tests/python/utils/mock_generator.py
@@ -24,7 +24,7 @@
 # pylint: disable=unused-argument
 # pylint: disable=missing-docstring
 import random
-from mock import patch
+from unittest.mock import patch
 
 from heronpy.api.task_hook import ITaskHook
 from heronpy.api.custom_grouping import ICustomGrouping
diff --git a/heron/instance/tests/python/utils/py_metrics_unittest.py b/heron/instance/tests/python/utils/py_metrics_unittest.py
index 11bc4ae..33b2d57 100644
--- a/heron/instance/tests/python/utils/py_metrics_unittest.py
+++ b/heron/instance/tests/python/utils/py_metrics_unittest.py
@@ -21,7 +21,7 @@
 
 # pylint: disable=missing-docstring
 from collections import namedtuple
-from mock import Mock, patch
+from unittest.mock import Mock, patch
 import unittest
 import threading
 
diff --git a/heron/shell/src/python/BUILD b/heron/shell/src/python/BUILD
index 8ac5076..0ff887c 100644
--- a/heron/shell/src/python/BUILD
+++ b/heron/shell/src/python/BUILD
@@ -8,7 +8,6 @@ pex_library(
     reqs = [
         "requests==2.12.3",
         "tornado==4.0.2",
-        "future==0.18.2",
     ],
     deps = [
         "//heron/common/src/python:common-py",
diff --git a/heron/shell/src/python/handlers/killexecutorhandler.py b/heron/shell/src/python/handlers/killexecutorhandler.py
index 1dadff0..372770e 100644
--- a/heron/shell/src/python/handlers/killexecutorhandler.py
+++ b/heron/shell/src/python/handlers/killexecutorhandler.py
@@ -20,10 +20,6 @@
 
 
 ''' killexecutorhandler.py '''
-# pylint: disable=wrong-import-order
-from future.standard_library import install_aliases
-install_aliases()
-
 import logging
 import os
 import signal
diff --git a/heron/statemgrs/src/python/statemanager.py b/heron/statemgrs/src/python/statemanager.py
index 655cf25..1992a5a 100644
--- a/heron/statemgrs/src/python/statemanager.py
+++ b/heron/statemgrs/src/python/statemanager.py
@@ -23,7 +23,6 @@ import abc
 
 import socket
 import subprocess
-import six
 
 from heron.statemgrs.src.python.log import Log as LOG
 
@@ -35,7 +34,7 @@ HERON_TMASTER_PREFIX = "{0}/tmasters/"
 HERON_TOPOLOGIES_KEY = "{0}/topologies"
 
 # pylint: disable=too-many-public-methods, attribute-defined-outside-init
-class StateManager(six.with_metaclass(abc.ABCMeta)):
+class StateManager(metaclass=abc.ABCMeta):
   """
   This is the abstract base class for state manager. It provides methods to get/set/delete various
   state from the state store. The getters accept an optional callback, which will watch for state
diff --git a/heron/statemgrs/src/python/zkstatemanager.py b/heron/statemgrs/src/python/zkstatemanager.py
index 9f29390..415d58b 100644
--- a/heron/statemgrs/src/python/zkstatemanager.py
+++ b/heron/statemgrs/src/python/zkstatemanager.py
@@ -19,8 +19,7 @@
 #  under the License.
 
 ''' zkstatemanager.py '''
-import sys
-from six import reraise as raise_
+import contextlib
 
 from heron.proto.execution_state_pb2 import ExecutionState
 from heron.proto.packing_plan_pb2 import PackingPlan
@@ -42,6 +41,25 @@ from kazoo.exceptions import ZookeeperError
 def _makehostportlist(hostportlist):
   return ','.join(["%s:%i" % hp for hp in hostportlist])
 
+@contextlib.contextmanager
+def reraise_from_zk_exceptions(action):
+  """Raise StateException from ZookeeperError if raised."""
+  try:
+    yield
+  except NoNodeError as e:
+    raise StateException(f"NoNodeError while {action}",
+                         StateException.EX_TYPE_NO_NODE_ERROR) from e
+  except NodeExistsError as e:
+    raise StateException(f"NodeExistsError while {action}",
+                         StateException.EX_TYPE_NODE_EXISTS_ERROR) from e
+  except NotEmptyError as e:
+    raise StateException(f"NotEmptyError while {action}",
+                         StateException.EX_TYPE_NOT_EMPTY_ERROR) from e
+  except ZookeeperError as e:
+    raise StateException(f"Zookeeper while {action}",
+                         StateException.EX_TYPE_ZOOKEEPER_ERROR) from e
+
+
 # pylint: disable=attribute-defined-outside-init
 class ZkStateManager(StateManager):
   """
@@ -107,11 +125,11 @@ class ZkStateManager(StateManager):
       self.client.ensure_path(self.get_topologies_path())
 
       self._get_topologies_with_watch(callback, isWatching)
-    except NoNodeError:
+    except NoNodeError as e:
       self.client.stop()
       path = self.get_topologies_path()
-      raise_(StateException("Error required topology path '%s' not found" % (path),
-                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])
+      raise StateException(f"Error required topology path {path!r} not found",
+                           StateException.EX_TYPE_NO_NODE_ERROR) from e
 
     # The topologies are now populated with the data.
     return ret["result"]
@@ -187,43 +205,25 @@ class ZkStateManager(StateManager):
   def create_topology(self, topologyName, topology):
     """ crate topology """
     if not topology or not topology.IsInitialized():
-      raise_(StateException("Topology protobuf not init properly",
-                            StateException.EX_TYPE_PROTOBUF_ERROR), sys.exc_info()[2])
+      raise StateException("Topology protobuf not init properly",
+                           StateException.EX_TYPE_PROTOBUF_ERROR)
 
     path = self.get_topology_path(topologyName)
     LOG.info("Adding topology: {0} to path: {1}".format(
         topologyName, path))
     topologyString = topology.SerializeToString()
-    try:
+    with reraise_from_zk_exceptions("creating topology"):
       self.client.create(path, value=topologyString, makepath=True)
-      return True
-    except NoNodeError:
-      raise_(StateException("NoNodeError while creating topology",
-                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])
-    except NodeExistsError:
-      raise_(StateException("NodeExistsError while creating topology",
-                            StateException.EX_TYPE_NODE_EXISTS_ERROR), sys.exc_info()[2])
-    except ZookeeperError:
-      raise_(StateException("Zookeeper while creating topology",
-                            StateException.EX_TYPE_ZOOKEEPER_ERROR), sys.exc_info()[2])
+    return True
 
   def delete_topology(self, topologyName):
     """ delete topology """
     path = self.get_topology_path(topologyName)
     LOG.info("Removing topology: {0} from path: {1}".format(
         topologyName, path))
-    try:
+    with reraise_from_zk_exceptions("deleting topology"):
       self.client.delete(path)
-      return True
-    except NoNodeError:
-      raise_(StateException("NoNodeError while deteling topology",
-                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])
-    except NotEmptyError:
-      raise_(StateException("NotEmptyError while deleting topology",
-                            StateException.EX_TYPE_NOT_EMPTY_ERROR), sys.exc_info()[2])
-    except ZookeeperError:
-      raise_(StateException("Zookeeper while deleting topology",
-                            StateException.EX_TYPE_ZOOKEEPER_ERROR), sys.exc_info()[2])
+    return True
 
   def get_packing_plan(self, topologyName, callback=None):
     """ get packing plan """
@@ -324,43 +324,25 @@ class ZkStateManager(StateManager):
   def create_pplan(self, topologyName, pplan):
     """ create physical plan """
     if not pplan or not pplan.IsInitialized():
-      raise_(StateException("Physical Plan protobuf not init properly",
-                            StateException.EX_TYPE_PROTOBUF_ERROR), sys.exc_info()[2])
+      raise StateException("Physical Plan protobuf not init properly",
+                           StateException.EX_TYPE_PROTOBUF_ERROR)
 
     path = self.get_pplan_path(topologyName)
     LOG.info("Adding topology: {0} to path: {1}".format(
         topologyName, path))
     pplanString = pplan.SerializeToString()
-    try:
+    with reraise_from_zk_exceptions("creating pplan"):
       self.client.create(path, value=pplanString, makepath=True)
-      return True
-    except NoNodeError:
-      raise_(StateException("NoNodeError while creating pplan",
-                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])
-    except NodeExistsError:
-      raise_(StateException("NodeExistsError while creating pplan",
-                            StateException.EX_TYPE_NODE_EXISTS_ERROR), sys.exc_info()[2])
-    except ZookeeperError:
-      raise_(StateException("Zookeeper while creating pplan",
-                            StateException.EX_TYPE_ZOOKEEPER_ERROR), sys.exc_info()[2])
+    return True
 
   def delete_pplan(self, topologyName):
     """ delete physical plan info """
     path = self.get_pplan_path(topologyName)
     LOG.info("Removing topology: {0} from path: {1}".format(
         topologyName, path))
-    try:
+    with reraise_from_zk_exceptions("deleting pplan"):
       self.client.delete(path)
-      return True
-    except NoNodeError:
-      raise_(StateException("NoNodeError while deleting pplan",
-                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])
-    except NotEmptyError:
-      raise_(StateException("NotEmptyError while deleting pplan",
-                            StateException.EX_TYPE_NOT_EMPTY_ERROR), sys.exc_info()[2])
-    except ZookeeperError:
-      raise_(StateException("Zookeeper while deleting pplan",
-                            StateException.EX_TYPE_ZOOKEEPER_ERROR), sys.exc_info()[2])
+    return True
 
   def get_execution_state(self, topologyName, callback=None):
     """ get execution state """
@@ -414,43 +396,25 @@ class ZkStateManager(StateManager):
   def create_execution_state(self, topologyName, executionState):
     """ create execution state """
     if not executionState or not executionState.IsInitialized():
-      raise_(StateException("Execution State protobuf not init properly",
-                            StateException.EX_TYPE_PROTOBUF_ERROR), sys.exc_info()[2])
+      raise StateException("Execution State protobuf not init properly",
+                           StateException.EX_TYPE_PROTOBUF_ERROR)
 
     path = self.get_execution_state_path(topologyName)
     LOG.info("Adding topology: {0} to path: {1}".format(
         topologyName, path))
     executionStateString = executionState.SerializeToString()
-    try:
+    with reraise_from_zk_exceptions("creating execution state"):
       self.client.create(path, value=executionStateString, makepath=True)
-      return True
-    except NoNodeError:
-      raise_(StateException("NoNodeError while creating execution state",
-                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])
-    except NodeExistsError:
-      raise_(StateException("NodeExistsError while creating execution state",
-                            StateException.EX_TYPE_NODE_EXISTS_ERROR), sys.exc_info()[2])
-    except ZookeeperError:
-      raise_(StateException("Zookeeper while creating execution state",
-                            StateException.EX_TYPE_ZOOKEEPER_ERROR), sys.exc_info()[2])
+    return True
 
   def delete_execution_state(self, topologyName):
     """ delete execution state """
     path = self.get_execution_state_path(topologyName)
     LOG.info("Removing topology: {0} from path: {1}".format(
         topologyName, path))
-    try:
+    with reraise_from_zk_exceptions("deleting execution state"):
       self.client.delete(path)
-      return True
-    except NoNodeError:
-      raise_(StateException("NoNodeError while deleting execution state",
-                            StateException.EX_TYPE_NO_NODE_ERROR), sys.exc_info()[2])
-    except NotEmptyError:
-      raise_(StateException("NotEmptyError while deleting execution state",
-                            StateException.EX_TYPE_NOT_EMPTY_ERROR), sys.exc_info()[2])
-    except ZookeeperError:
-      raise_(StateException("Zookeeper while deleting execution state",
-                            StateException.EX_TYPE_ZOOKEEPER_ERROR), sys.exc_info()[2])
+    return True
 
   def get_tmaster(self, topologyName, callback=None):
     """ get tmaster """
diff --git a/heron/statemgrs/tests/python/BUILD b/heron/statemgrs/tests/python/BUILD
index 8b66850..d28568a 100644
--- a/heron/statemgrs/tests/python/BUILD
+++ b/heron/statemgrs/tests/python/BUILD
@@ -10,9 +10,7 @@ pex_pytest(
         "//heron/config/src/yaml:conf-yaml",
     ],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/statemgrs/src/python:statemgr-py",
@@ -26,9 +24,7 @@ pex_pytest(
         "zkstatemanager_unittest.py",
     ],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/statemgrs/src/python:statemgr-py",
@@ -42,9 +38,7 @@ pex_pytest(
         "statemanagerfactory_unittest.py",
     ],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/statemgrs/src/python:statemgr-py",
diff --git a/heron/statemgrs/tests/python/configloader_unittest.py b/heron/statemgrs/tests/python/configloader_unittest.py
index 7018cad..757da7d 100644
--- a/heron/statemgrs/tests/python/configloader_unittest.py
+++ b/heron/statemgrs/tests/python/configloader_unittest.py
@@ -20,7 +20,7 @@
 
 '''heron executor unittest'''
 import os
-import unittest2 as unittest
+import unittest
 
 from heron.statemgrs.src.python import configloader
 
diff --git a/heron/statemgrs/tests/python/statemanagerfactory_unittest.py b/heron/statemgrs/tests/python/statemanagerfactory_unittest.py
index 0dcfcda..ad43e48 100644
--- a/heron/statemgrs/tests/python/statemanagerfactory_unittest.py
+++ b/heron/statemgrs/tests/python/statemanagerfactory_unittest.py
@@ -19,7 +19,7 @@
 #  under the License.
 
 '''state manager factory unittest'''
-import unittest2 as unittest
+import unittest
 
 from heron.statemgrs.src.python.config import Config
 from heron.statemgrs.src.python import statemanagerfactory
diff --git a/heron/statemgrs/tests/python/zkstatemanager_unittest.py b/heron/statemgrs/tests/python/zkstatemanager_unittest.py
index ee6da0e..a9f09fa 100644
--- a/heron/statemgrs/tests/python/zkstatemanager_unittest.py
+++ b/heron/statemgrs/tests/python/zkstatemanager_unittest.py
@@ -19,7 +19,7 @@
 #  under the License.
 
 '''ZkStateManager unittest'''
-import unittest2 as unittest
+import unittest
 
 from heron.statemgrs.src.python.zkstatemanager import ZkStateManager
 
diff --git a/heron/tools/admin/src/python/BUILD b/heron/tools/admin/src/python/BUILD
index 3ab511c..b61c347 100644
--- a/heron/tools/admin/src/python/BUILD
+++ b/heron/tools/admin/src/python/BUILD
@@ -7,7 +7,6 @@ pex_library(
     ),
     reqs = [
         "PyYAML==3.13",
-        "enum34==1.1.6",
         "requests==2.12.3",
         "netifaces==0.10.6",
     ],
diff --git a/heron/tools/admin/src/python/standalone.py b/heron/tools/admin/src/python/standalone.py
index 656f720..ec0d270 100644
--- a/heron/tools/admin/src/python/standalone.py
+++ b/heron/tools/admin/src/python/standalone.py
@@ -16,7 +16,6 @@
 #  under the License.
 
 ''' standalone.py '''
-from __future__ import print_function
 from collections import OrderedDict
 from subprocess import call
 import subprocess
diff --git a/heron/tools/cli/src/python/BUILD b/heron/tools/cli/src/python/BUILD
index a3e3a15..e1c4594 100644
--- a/heron/tools/cli/src/python/BUILD
+++ b/heron/tools/cli/src/python/BUILD
@@ -7,10 +7,8 @@ pex_library(
     ),
     reqs = [
         "PyYAML==3.13",
-        "enum34==1.1.6",
         "requests==2.12.3",
         "netifaces==0.10.6",
-        "future==0.18.2",
     ],
     deps = [
         "//heron/common/src/python:common-py",
diff --git a/heron/tools/cli/src/python/result.py b/heron/tools/cli/src/python/result.py
index df65293..f37d5d0 100644
--- a/heron/tools/cli/src/python/result.py
+++ b/heron/tools/cli/src/python/result.py
@@ -19,7 +19,6 @@
 #  under the License.
 
 '''result.py'''
-from __future__ import print_function
 import abc
 import sys
 from enum import Enum
diff --git a/heron/tools/cli/src/python/submit.py b/heron/tools/cli/src/python/submit.py
index 5e6be8d..8c7afce 100644
--- a/heron/tools/cli/src/python/submit.py
+++ b/heron/tools/cli/src/python/submit.py
@@ -19,10 +19,6 @@
 #  under the License.
 
 ''' submit.py '''
-# pylint: disable=wrong-import-order
-from future.standard_library import install_aliases
-install_aliases()
-
 import glob
 import logging
 import os
diff --git a/heron/tools/cli/tests/python/BUILD b/heron/tools/cli/tests/python/BUILD
index 234157b..5e763d9 100644
--- a/heron/tools/cli/tests/python/BUILD
+++ b/heron/tools/cli/tests/python/BUILD
@@ -5,9 +5,7 @@ pex_pytest(
     size = "small",
     srcs = ["opts_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/tools/cli/src/python:cli-py",
@@ -19,10 +17,7 @@ pex_pytest(
     size = "small",
     srcs = ["client_command_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
-        "mock==1.0.1",
     ],
     deps = [
         "//heron/tools/cli/src/python:cli-py",
diff --git a/heron/tools/cli/tests/python/client_command_unittest.py b/heron/tools/cli/tests/python/client_command_unittest.py
index 891f31a..789560c 100644
--- a/heron/tools/cli/tests/python/client_command_unittest.py
+++ b/heron/tools/cli/tests/python/client_command_unittest.py
@@ -19,9 +19,8 @@
 #  under the License.
 
 ''' opts_unittest.py '''
-import unittest2 as unittest
-import mock
-from mock import call, patch, Mock, MagicMock
+import unittest
+from unittest.mock import call, patch, Mock, MagicMock
 import os
 import getpass
 import subprocess
diff --git a/heron/tools/cli/tests/python/opts_unittest.py b/heron/tools/cli/tests/python/opts_unittest.py
index 49e128b..9ca7954 100644
--- a/heron/tools/cli/tests/python/opts_unittest.py
+++ b/heron/tools/cli/tests/python/opts_unittest.py
@@ -19,7 +19,7 @@
 #  under the License.
 
 ''' opts_unittest.py '''
-import unittest2 as unittest
+import unittest
 import heron.tools.cli.src.python.opts as opts
 
 #pylint: disable=missing-docstring, no-self-use
diff --git a/heron/tools/explorer/tests/python/BUILD b/heron/tools/explorer/tests/python/BUILD
index 55b32ca..313b785 100644
--- a/heron/tools/explorer/tests/python/BUILD
+++ b/heron/tools/explorer/tests/python/BUILD
@@ -5,10 +5,7 @@ pex_pytest(
     size = "small",
     srcs = ["explorer_unittest.py"],
     reqs = [
-        "mock==1.0.1",
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/common/src/python:common-py",
diff --git a/heron/tools/explorer/tests/python/explorer_unittest.py b/heron/tools/explorer/tests/python/explorer_unittest.py
index ab942fa..72e8b5e 100644
--- a/heron/tools/explorer/tests/python/explorer_unittest.py
+++ b/heron/tools/explorer/tests/python/explorer_unittest.py
@@ -21,8 +21,8 @@
 ''' explorer_unittest.py '''
 import json
 import os
-import unittest2 as unittest
-from mock import Mock
+import unittest
+from unittest.mock import Mock
 
 import heron.tools.common.src.python.access.tracker_access as tracker_access
 import heron.tools.explorer.src.python.topologies as topologies
diff --git a/heron/tools/tracker/src/python/BUILD b/heron/tools/tracker/src/python/BUILD
index 197a4a9..545582d 100644
--- a/heron/tools/tracker/src/python/BUILD
+++ b/heron/tools/tracker/src/python/BUILD
@@ -9,7 +9,6 @@ pex_library(
     reqs = [
         "protobuf==3.8.0",
         "tornado==4.0.2",
-        "future==0.18.2",
     ],
     deps = [
         "//heron/common/src/python:common-py",
diff --git a/heron/tools/tracker/src/python/main.py b/heron/tools/tracker/src/python/main.py
index 689d032..70fa9da 100644
--- a/heron/tools/tracker/src/python/main.py
+++ b/heron/tools/tracker/src/python/main.py
@@ -19,8 +19,6 @@
 #  under the License.
 
 ''' main.py '''
-from __future__ import print_function
-
 import argparse
 import os
 import signal
diff --git a/heron/tools/tracker/tests/python/BUILD b/heron/tools/tracker/tests/python/BUILD
index cca9d72..d411458 100644
--- a/heron/tools/tracker/tests/python/BUILD
+++ b/heron/tools/tracker/tests/python/BUILD
@@ -17,10 +17,7 @@ pex_pytest(
         "topology_unittest.py",
     ],
     reqs = [
-        "mock==1.0.1",
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/proto:proto-py",
@@ -34,10 +31,7 @@ pex_pytest(
     size = "small",
     srcs = ["query_operator_unittest.py"],
     reqs = [
-        "mock==1.0.1",
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/tools/tracker/src/python:tracker-py",
@@ -49,10 +43,7 @@ pex_pytest(
     size = "small",
     srcs = ["query_unittest.py"],
     reqs = [
-        "mock==1.0.1",
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/tools/tracker/src/python:tracker-py",
@@ -67,10 +58,7 @@ pex_pytest(
         "tracker_unittest.py",
     ],
     reqs = [
-        "mock==1.0.1",
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heron/proto:proto-py",
diff --git a/heron/tools/tracker/tests/python/query_operator_unittest.py b/heron/tools/tracker/tests/python/query_operator_unittest.py
index c880dd3..f55dc8f 100644
--- a/heron/tools/tracker/tests/python/query_operator_unittest.py
+++ b/heron/tools/tracker/tests/python/query_operator_unittest.py
@@ -23,7 +23,7 @@ import tornado.concurrent
 import tornado.gen
 import tornado.testing
 
-from mock import patch, Mock
+from unittest.mock import patch, Mock
 
 from heron.tools.tracker.src.python.query_operators import *
 
diff --git a/heron/tools/tracker/tests/python/query_unittest.py b/heron/tools/tracker/tests/python/query_unittest.py
index 56c5e3b..1892f23 100644
--- a/heron/tools/tracker/tests/python/query_unittest.py
+++ b/heron/tools/tracker/tests/python/query_unittest.py
@@ -16,8 +16,8 @@
 # under the License.
 ''' query_unittest.py '''
 # pylint: disable=missing-docstring, undefined-variable
-import unittest2 as unittest
-from mock import Mock
+import unittest
+from unittest.mock import Mock
 
 from heron.tools.tracker.src.python.query import *
 
diff --git a/heron/tools/tracker/tests/python/topology_unittest.py b/heron/tools/tracker/tests/python/topology_unittest.py
index 3f6202f..8ac8bdd 100644
--- a/heron/tools/tracker/tests/python/topology_unittest.py
+++ b/heron/tools/tracker/tests/python/topology_unittest.py
@@ -16,7 +16,7 @@
 # under the License.
 ''' topology_unittest.py '''
 # pylint: disable=missing-docstring
-import unittest2 as unittest
+import unittest
 
 from heron.tools.tracker.src.python.topology import Topology
 from mock_proto import MockProto
diff --git a/heron/tools/tracker/tests/python/tracker_unittest.py b/heron/tools/tracker/tests/python/tracker_unittest.py
index fcb4810..767d93f 100644
--- a/heron/tools/tracker/tests/python/tracker_unittest.py
+++ b/heron/tools/tracker/tests/python/tracker_unittest.py
@@ -17,8 +17,8 @@
 ''' tracker_unittest.py '''
 
 # pylint: disable=missing-docstring, attribute-defined-outside-init
-import unittest2 as unittest
-from mock import call, patch, Mock
+import unittest
+from unittest.mock import call, patch, Mock
 
 import heron.proto.execution_state_pb2 as protoEState
 from heron.statemgrs.src.python import statemanagerfactory
@@ -191,25 +191,25 @@ class TrackerTest(unittest.TestCase):
 
   def test_get_topolies_for_state_location(self):
     self.fill_tracker_topologies()
-    self.assertItemsEqual(
+    self.assertCountEqual(
         [self.topology1, self.topology2, self.topology3],
         self.tracker.getTopologiesForStateLocation('mock_name1'))
-    self.assertItemsEqual(
+    self.assertCountEqual(
         [self.topology4, self.topology5],
         self.tracker.getTopologiesForStateLocation('mock_name2'))
 
   def test_add_new_topology(self):
-    self.assertItemsEqual([], self.tracker.topologies)
+    self.assertCountEqual([], self.tracker.topologies)
     mock_state_manager_1 = Mock()
     mock_state_manager_1.name = 'mock_name1'
 
     self.tracker.addNewTopology(mock_state_manager_1, 'top_name1')
-    self.assertItemsEqual(
+    self.assertCountEqual(
         ['top_name1'],
         [t.name for t in self.tracker.topologies])
 
     self.tracker.addNewTopology(mock_state_manager_1, 'top_name2')
-    self.assertItemsEqual(
+    self.assertCountEqual(
         ['top_name1', 'top_name2'],
         [t.name for t in self.tracker.topologies])
 
@@ -220,17 +220,17 @@ class TrackerTest(unittest.TestCase):
   def test_remove_topology(self):
     self.fill_tracker_topologies()
     self.tracker.removeTopology('top_name1', 'mock_name1')
-    self.assertItemsEqual([self.topology2, self.topology3, self.topology4, self.topology5],
+    self.assertCountEqual([self.topology2, self.topology3, self.topology4, self.topology5],
                           self.tracker.topologies)
     self.tracker.removeTopology('top_name2', 'mock_name1')
-    self.assertItemsEqual([self.topology3, self.topology4, self.topology5],
+    self.assertCountEqual([self.topology3, self.topology4, self.topology5],
                           self.tracker.topologies)
     # Removing one that is not there should not have any affect
     self.tracker.removeTopology('top_name8', 'mock_name1')
-    self.assertItemsEqual([self.topology3, self.topology4, self.topology5],
+    self.assertCountEqual([self.topology3, self.topology4, self.topology5],
                           self.tracker.topologies)
     self.tracker.removeTopology('top_name4', 'mock_name2')
-    self.assertItemsEqual([self.topology3, self.topology5],
+    self.assertCountEqual([self.topology3, self.topology5],
                           self.tracker.topologies)
 
   def test_extract_physical_plan(self):
diff --git a/heron/tools/ui/src/python/BUILD b/heron/tools/ui/src/python/BUILD
index 58ee209..100d9a5 100644
--- a/heron/tools/ui/src/python/BUILD
+++ b/heron/tools/ui/src/python/BUILD
@@ -7,7 +7,6 @@ pex_library(
         exclude = ["main.py"],
     ),
     reqs = [
-        "pycrypto==2.6.1",
         "requests==2.12.3",
         "tornado==4.0.2",
     ],
diff --git a/heron/tools/ui/src/python/main.py b/heron/tools/ui/src/python/main.py
index 224937a..98f1e8e 100644
--- a/heron/tools/ui/src/python/main.py
+++ b/heron/tools/ui/src/python/main.py
@@ -19,7 +19,6 @@
 #  under the License.
 
 ''' main.py '''
-from __future__ import print_function
 import logging
 import os
 import signal
diff --git a/heronpy/api/tests/python/BUILD b/heronpy/api/tests/python/BUILD
index 44fa11b..7049c09 100644
--- a/heronpy/api/tests/python/BUILD
+++ b/heronpy/api/tests/python/BUILD
@@ -5,9 +5,7 @@ pex_pytest(
     size = "small",
     srcs = ["component_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heronpy/api:heron-python-py",
@@ -19,9 +17,7 @@ pex_pytest(
     size = "small",
     srcs = ["stream_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heronpy/api:heron-python-py",
@@ -33,9 +29,7 @@ pex_pytest(
     size = "small",
     srcs = ["topology_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heronpy/api:heron-python-py",
@@ -47,9 +41,7 @@ pex_pytest(
     size = "small",
     srcs = ["serializer_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heronpy/api:heron-python-py",
@@ -61,9 +53,7 @@ pex_pytest(
     size = "small",
     srcs = ["metrics_unittest.py"],
     reqs = [
-        "py==1.4.34",
         "pytest==3.2.2",
-        "unittest2==1.1.0",
     ],
     deps = [
         "//heronpy/api:heron-python-py",
diff --git a/heronpy/api/tests/python/serializer_unittest.py b/heronpy/api/tests/python/serializer_unittest.py
index 8b8bf8b..17b659d 100644
--- a/heronpy/api/tests/python/serializer_unittest.py
+++ b/heronpy/api/tests/python/serializer_unittest.py
@@ -23,7 +23,6 @@
 
 import unittest
 
-import six
 from heronpy.api.serializer import PythonSerializer
 
 prim_list = [1000, -234, 0.00023, "string",
@@ -40,6 +39,6 @@ class SerializerTest(unittest.TestCase):
     # Test with a list of primitive types
     for obj in prim_list:
       serialized = serializer.serialize(obj)
-      self.assertIsInstance(serialized, six.binary_type)
+      self.assertIsInstance(serialized, bytes)
       deserialized = serializer.deserialize(serialized)
       self.assertEqual(deserialized, obj)
diff --git a/heronpy/api/topology.py b/heronpy/api/topology.py
index a628224..7e8a412 100644
--- a/heronpy/api/topology.py
+++ b/heronpy/api/topology.py
@@ -26,7 +26,6 @@ import os
 import uuid
 
 import heronpy.api.api_constants as api_constants
-import six
 from heronpy.api.component.component_spec import HeronComponentSpec
 from heronpy.api.serializer import default_serializer
 from heronpy.proto import topology_pb2
@@ -256,8 +255,7 @@ class TopologyType(type):
 
     return sanitized
 
-@six.add_metaclass(TopologyType)
-class Topology:
+class Topology(metaclass=TopologyType):
   """Topology is an abstract class for defining a topology
 
   Topology writers can define their custom topology by inheriting this class.
diff --git a/integration_test/src/python/integration_test/core/BUILD b/integration_test/src/python/integration_test/core/BUILD
index 5e84576..884f032 100644
--- a/integration_test/src/python/integration_test/core/BUILD
+++ b/integration_test/src/python/integration_test/core/BUILD
@@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"])
 pex_library(
     name = "heron-integration-core-py",
     srcs = glob(["**/*.py"]),
-    reqs = ["future==0.18.2"],
+    reqs = [],
     deps = [
         "//heron/common/src/python:common-py",
         "//heronpy/api:heron-python-py",
diff --git a/integration_test/src/python/integration_test/core/aggregator_bolt.py b/integration_test/src/python/integration_test/core/aggregator_bolt.py
index d2047c5..3e61154 100644
--- a/integration_test/src/python/integration_test/core/aggregator_bolt.py
+++ b/integration_test/src/python/integration_test/core/aggregator_bolt.py
@@ -19,9 +19,6 @@
 #  under the License.
 
 '''aggregator_bolt.py'''
-from future.standard_library import install_aliases
-install_aliases()
-
 import http.client
 import json
 from urllib.parse import urlparse
diff --git a/integration_test/src/python/local_test_runner/BUILD b/integration_test/src/python/local_test_runner/BUILD
index fe5c6be..0b30425 100644
--- a/integration_test/src/python/local_test_runner/BUILD
+++ b/integration_test/src/python/local_test_runner/BUILD
@@ -5,8 +5,6 @@ pex_binary(
     srcs = glob(["*.py"]),
     main = "main.py",
     reqs = [
-        "argparse==1.4.0",
-        "future==0.18.2",
     ],
     resources = [
         "resources/test.conf",
diff --git a/integration_test/src/python/local_test_runner/test_template.py b/integration_test/src/python/local_test_runner/test_template.py
index 33219de..fd6ccf8 100644
--- a/integration_test/src/python/local_test_runner/test_template.py
+++ b/integration_test/src/python/local_test_runner/test_template.py
@@ -19,9 +19,6 @@
 #  under the License.
 
 """ test_template.py """
-from future.standard_library import install_aliases
-install_aliases()
-
 import json
 import logging
 import os
diff --git a/integration_test/src/python/test_runner/BUILD b/integration_test/src/python/test_runner/BUILD
index b98e764..1201ced 100644
--- a/integration_test/src/python/test_runner/BUILD
+++ b/integration_test/src/python/test_runner/BUILD
@@ -7,8 +7,6 @@ pex_binary(
     ],
     main = "main.py",
     reqs = [
-        "argparse==1.4.0",
-        "future==0.18.2",
     ],
     resources = [
         "resources/test.json",
diff --git a/integration_test/src/python/topology_test_runner/BUILD b/integration_test/src/python/topology_test_runner/BUILD
index 4c8a990..2e640ff 100644
--- a/integration_test/src/python/topology_test_runner/BUILD
+++ b/integration_test/src/python/topology_test_runner/BUILD
@@ -7,8 +7,6 @@ pex_binary(
     ],
     main = "main.py",
     reqs = [
-        "argparse==1.4.0",
-        "future==0.18.2",
     ],
     resources = [
         "resources/test.json",
diff --git a/scripts/packages/heronpy/requirements.txt b/scripts/packages/heronpy/requirements.txt
index 323fb1e..82c7699 100644
--- a/scripts/packages/heronpy/requirements.txt
+++ b/scripts/packages/heronpy/requirements.txt
@@ -1,2 +1 @@
 protobuf==3.8.0
-six
diff --git a/scripts/resources/idea/libraries/hp_dep.xml b/scripts/resources/idea/libraries/hp_dep.xml
index ca8414f..e2045e5 100644
--- a/scripts/resources/idea/libraries/hp_dep.xml
+++ b/scripts/resources/idea/libraries/hp_dep.xml
@@ -21,14 +21,12 @@ under the License.
 <component name="libraryTable">
   <library name="hp-dep">
     <CLASSES>
-      <root url="jar://$PROJECT_DIR$/third_party/eggs/argparse-1.2.1-py2.7.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/async-0.6.1-py2.7-linux-x86_64.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/async-0.6.1-py2.7-macosx-10.4-x86_64.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/backports.ssl_match_hostname-3.4.0.2-py2.7.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/certifi-14.5.14-py2.7.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/gitdb-0.5.4-py2.7-linux-x86_64.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/gitdb-0.5.4-py2.7-macosx-10.4-x86_64.egg!/" />
-      <root url="jar://$PROJECT_DIR$/third_party/eggs/mock-1.0.1-py2.7.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/pycrypto-2.6.1_tw1-py2.7-linux-x86_64.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/pycrypto-2.6.1_tw1-py2.7-macosx-10.4-x86_64.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/PyYAML-3.10-py2.7-linux-x86_64.egg!/" />
@@ -37,7 +35,6 @@ under the License.
       <root url="jar://$PROJECT_DIR$/third_party/eggs/thrift-0.9.1-py2.7-macosx-10.4-x86_64.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/tornado-4.0.2-py2.7-linux-x86_64.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/tornado-4.0.2-py2.7-macosx-10.9-x86_64.egg!/" />
-      <root url="jar://$PROJECT_DIR$/third_party/eggs/unittest2-0.5.1-py2.7.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/wheel-0.23.0-py2.7.egg!/" />
       <root url="jar://$PROJECT_DIR$/third_party/eggs/zope.interface-4.0.5-py2.7.egg!/" />
     </CLASSES>