Remove six and cloudpickle from setup.py. (#7694)

This commit is contained in:
Robert Nishihara
2020-03-23 11:42:05 -07:00
committed by GitHub
parent 1a0c9228d0
commit ee8c9ff732
15 changed files with 20 additions and 67 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
import copy
import inspect
import logging
import six
import weakref
from abc import ABCMeta, abstractmethod
@@ -963,7 +962,7 @@ Checkpoint = namedtuple(
"""A namedtuple that represents a checkpoint."""
class Checkpointable(six.with_metaclass(ABCMeta, object)):
class Checkpointable(metaclass=ABCMeta):
"""An interface that indicates an actor can be checkpointed."""
@abstractmethod
-5
View File
@@ -3,7 +3,6 @@ from concurrent.futures import ThreadPoolExecutor
import json
import logging
import random
import six
import sys
import threading
import time
@@ -365,10 +364,6 @@ def test_illegal_api_calls(ray_start_regular):
ray.get(3)
# TODO(hchen): This test currently doesn't work in Python 2. This is likely
# because plasma client isn't thread-safe. This needs to be fixed from the
# Arrow side. See #4107 for relevant discussions.
@pytest.mark.skipif(six.PY2, reason="Doesn't work in Python 2.")
def test_multithreading(ray_start_2_cpus):
# This test requires at least 2 CPUs to finish since the worker does not
# release resources when joining the threads.
@@ -8,7 +8,7 @@ from ray import tune
from ray.tune import DurableTrainable
from ray.tune.sync_client import get_sync_client
import cloudpickle
from ray import cloudpickle
logger = logging.getLogger(__name__)
+1 -2
View File
@@ -1,7 +1,6 @@
import copy
import logging
import os
import six
from ray.tune.error import TuneError
from ray.tune.registry import register_trainable, get_trainable_cls
@@ -189,7 +188,7 @@ class Experiment:
A string representing the trainable identifier.
"""
if isinstance(run_object, six.string_types):
if isinstance(run_object, str):
return run_object
elif isinstance(run_object, sample_from):
logger.warning("Not registering trainable. Resolving as variant.")
+1 -2
View File
@@ -1,5 +1,4 @@
import logging
import six
from ray.tune.error import TuneError
from ray.tune.experiment import convert_to_experiment_list, Experiment
@@ -41,7 +40,7 @@ def _make_scheduler(args):
def _check_default_resources_override(run_identifier):
if not isinstance(run_identifier, six.string_types):
if not isinstance(run_identifier, str):
# If obscure dtype, assume it is overriden.
return True
trainable_cls = get_trainable_cls(run_identifier)
+4 -23
View File
@@ -5,7 +5,6 @@ import inspect
import logging
import numpy as np
import os
import six
import subprocess
import sys
import tempfile
@@ -223,32 +222,14 @@ def decode(byte_str, allow_none=False):
def ensure_str(s, encoding="utf-8", errors="strict"):
"""Coerce *s* to `str`.
To keep six with lower version, see Issue 4169, we copy this function
from six == 1.12.0.
TODO(yuhguo): remove this function when six >= 1.12.0.
For Python 2:
- `unicode` -> encoded to `str`
- `str` -> `str`
For Python 3:
- `str` -> `str`
- `bytes` -> decoded to `str`
"""
if six.PY3:
text_type = str
binary_type = bytes
if isinstance(s, str):
return s
else:
text_type = unicode # noqa: F821
binary_type = str
if not isinstance(s, (text_type, binary_type)):
raise TypeError("not expecting type '%s'" % type(s))
if six.PY2 and isinstance(s, text_type):
s = s.encode(encoding, errors)
elif six.PY3 and isinstance(s, binary_type):
s = s.decode(encoding, errors)
return s
assert isinstance(s, bytes)
return s.decode(encoding, errors)
def binary_to_object_id(binary_object_id):
+3 -18
View File
@@ -171,24 +171,9 @@ def find_version(*filepath):
requires = [
"numpy >= 1.16",
"filelock",
"jsonschema",
"click",
"colorama",
"packaging",
"pyyaml",
"redis>=3.3.2",
# NOTE: Don't upgrade the version of six! Doing so causes installation
# problems. See https://github.com/ray-project/ray/issues/4169.
"six >= 1.0.0",
"faulthandler;python_version<'3.3'",
"protobuf >= 3.8.0",
"cloudpickle",
"py-spy >= 0.2.0",
"aiohttp",
"google",
"grpcio"
"numpy >= 1.16", "filelock", "jsonschema", "click", "colorama",
"packaging", "pyyaml", "redis >= 3.3.2", "protobuf >= 3.8.0",
"py-spy >= 0.2.0", "aiohttp", "google", "grpcio"
]
setup(