Skip to content

Commit cb285bc

Browse files
authored
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
1 parent 2e9a00a commit cb285bc

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,34 +74,37 @@ prerequisite:
7474

7575
# Install the package in editable mode.
7676
dependencies:
77-
python -m pip install -e .
77+
python -m pip install --no-cache-dir -e .
7878

7979
lightgbm:
80-
python -m pip install lightgbm --prefer-binary
80+
python -m pip install --no-cache-dir lightgbm --prefer-binary
8181

8282
rl:
83-
python -m pip install -e .[rl]
83+
python -m pip install --no-cache-dir -e .[rl]
8484

8585
develop:
86-
python -m pip install -e .[dev]
86+
python -m pip install --no-cache-dir -e .[dev]
8787

8888
lint:
89-
python -m pip install -e .[lint]
89+
python -m pip install --no-cache-dir -e .[lint]
9090

9191
docs:
92-
python -m pip install -e .[docs]
92+
python -m pip install --no-cache-dir -e .[docs]
9393

9494
package:
95-
python -m pip install -e .[package]
95+
python -m pip install --no-cache-dir -e .[package]
9696

9797
test:
98-
python -m pip install -e .[test]
98+
python -m pip install --no-cache-dir -e .[test]
9999

100100
analysis:
101-
python -m pip install -e .[analysis]
101+
python -m pip install --no-cache-dir -e .[analysis]
102+
103+
client:
104+
python -m pip install --no-cache-dir -e .[client]
102105

103106
all:
104-
python -m pip install -e .[pywinpty,dev,lint,docs,package,test,analysis,rl]
107+
python -m pip install --no-cache-dir -e .[pywinpty,dev,lint,docs,package,test,analysis,rl]
105108

106109
install: prerequisite dependencies
107110

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ analysis = [
101101
"plotly",
102102
"statsmodels",
103103
]
104+
client = [
105+
"python-socketio<6",
106+
"tables",
107+
]
104108

105109
# In the process of releasing a new version, when checking the manylinux package with twine, an error is reported:
106110
# InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field 'license-file'

qlib/data/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# Licensed under the MIT License.
33

44

5-
from __future__ import division
6-
from __future__ import print_function
5+
from __future__ import division, print_function
6+
7+
import json
78

89
import socketio
910

1011
import qlib
11-
from ..config import C
12+
1213
from ..log import get_module_logger
13-
import pickle
1414

1515

1616
class Client:
@@ -96,7 +96,7 @@ def request_callback(*args):
9696
self.logger.debug("connected")
9797
# The pickle is for passing some parameters with special type(such as
9898
# pd.Timestamp)
99-
request_content = {"head": head_info, "body": pickle.dumps(request_content, protocol=C.dump_protocol_version)}
99+
request_content = {"head": head_info, "body": json.dumps(request_content, default=str)}
100100
self.sio.on(request_type + "_response", request_callback)
101101
self.logger.debug("try sending")
102102
self.sio.emit(request_type + "_request", request_content)

0 commit comments

Comments
 (0)