1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-07 13:00:58 +08:00

fix(client): fix missing dependencies and unsafe pickle usage

This commit is contained in:
SunsetWolf
2025-12-17 14:44:07 +00:00
parent 2e9a00a9f7
commit 819372f001
3 changed files with 13 additions and 5 deletions

View File

@@ -100,8 +100,11 @@ test:
analysis:
python -m pip install -e .[analysis]
client:
python -m pip install -e .[client]
all:
python -m pip install -e .[pywinpty,dev,lint,docs,package,test,analysis,rl]
python -m pip install -e .[pywinpty,dev,lint,docs,package,test,analysis,rl,client]
install: prerequisite dependencies

View File

@@ -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'

View File

@@ -2,15 +2,16 @@
# 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 +97,7 @@ class Client:
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)