diff --git a/Makefile b/Makefile index 6564c4247b4..40c80431875 100644 --- a/Makefile +++ b/Makefile @@ -74,34 +74,37 @@ prerequisite: # Install the package in editable mode. dependencies: - python -m pip install -e . + python -m pip install --no-cache-dir -e . lightgbm: - python -m pip install lightgbm --prefer-binary + python -m pip install --no-cache-dir lightgbm --prefer-binary rl: - python -m pip install -e .[rl] + python -m pip install --no-cache-dir -e .[rl] develop: - python -m pip install -e .[dev] + python -m pip install --no-cache-dir -e .[dev] lint: - python -m pip install -e .[lint] + python -m pip install --no-cache-dir -e .[lint] docs: - python -m pip install -e .[docs] + python -m pip install --no-cache-dir -e .[docs] package: - python -m pip install -e .[package] + python -m pip install --no-cache-dir -e .[package] test: - python -m pip install -e .[test] + python -m pip install --no-cache-dir -e .[test] analysis: - python -m pip install -e .[analysis] + python -m pip install --no-cache-dir -e .[analysis] + +client: + python -m pip install --no-cache-dir -e .[client] all: - python -m pip install -e .[pywinpty,dev,lint,docs,package,test,analysis,rl] + python -m pip install --no-cache-dir -e .[pywinpty,dev,lint,docs,package,test,analysis,rl] install: prerequisite dependencies diff --git a/pyproject.toml b/pyproject.toml index d8d8c833b81..d89edab66da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -101,6 +101,10 @@ analysis = [ "plotly", "statsmodels", ] +client = [ + "python-socketio<6", + "tables", +] # In the process of releasing a new version, when checking the manylinux package with twine, an error is reported: # InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field 'license-file' diff --git a/qlib/data/client.py b/qlib/data/client.py index a9b4b2edf70..d9af2456d3e 100644 --- a/qlib/data/client.py +++ b/qlib/data/client.py @@ -2,15 +2,15 @@ # Licensed under the MIT License. -from __future__ import division -from __future__ import print_function +from __future__ import division, print_function + +import json import socketio import qlib -from ..config import C + from ..log import get_module_logger -import pickle class Client: @@ -96,7 +96,7 @@ def request_callback(*args): self.logger.debug("connected") # The pickle is for passing some parameters with special type(such as # pd.Timestamp) - request_content = {"head": head_info, "body": pickle.dumps(request_content, protocol=C.dump_protocol_version)} + request_content = {"head": head_info, "body": json.dumps(request_content, default=str)} self.sio.on(request_type + "_response", request_callback) self.logger.debug("try sending") self.sio.emit(request_type + "_request", request_content)