1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-06 05:51:17 +08:00

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

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

* ci: exclude client extra from default install to avoid macOS CI failures

* fix: CI error

* ci: install dependencies with --no-cache-dir to avoid disk space issues
This commit is contained in:
Linlang
2025-12-18 15:29:48 +08:00
committed by GitHub
parent 2e9a00a9f7
commit cb285bccac
3 changed files with 22 additions and 15 deletions

View File

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

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,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 @@ 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)