1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-17 01:14:35 +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: analysis:
python -m pip install -e .[analysis] python -m pip install -e .[analysis]
client:
python -m pip install -e .[client]
all: 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 install: prerequisite dependencies

View File

@@ -101,6 +101,10 @@ analysis = [
"plotly", "plotly",
"statsmodels", "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: # 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' # InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field 'license-file'

View File

@@ -2,15 +2,16 @@
# Licensed under the MIT License. # Licensed under the MIT License.
from __future__ import division from __future__ import division, print_function
from __future__ import print_function
import json
import socketio import socketio
import qlib import qlib
from ..config import C from ..config import C
from ..log import get_module_logger from ..log import get_module_logger
import pickle
class Client: class Client:
@@ -96,7 +97,7 @@ class Client:
self.logger.debug("connected") self.logger.debug("connected")
# The pickle is for passing some parameters with special type(such as # The pickle is for passing some parameters with special type(such as
# pd.Timestamp) # 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.sio.on(request_type + "_response", request_callback)
self.logger.debug("try sending") self.logger.debug("try sending")
self.sio.emit(request_type + "_request", request_content) self.sio.emit(request_type + "_request", request_content)