xoscar 0.7.5__cp310-cp310-win_amd64.whl → 0.7.7__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of xoscar might be problematic. Click here for more details.

Binary file
Binary file
xoscar/collective/uv.dll CHANGED
Binary file
Binary file
Binary file
@@ -0,0 +1,84 @@
1
+ # Copyright 2022-2025 XProbe Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import logging
16
+ import re
17
+ import subprocess
18
+ import sys
19
+ import threading
20
+ from contextlib import contextmanager
21
+ from typing import BinaryIO, Callable, Iterator, List, Optional, TextIO, Union
22
+
23
+ logger = logging.getLogger(__name__)
24
+
25
+ ansi_escape = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
26
+
27
+
28
+ def clean_ansi(text: str) -> str:
29
+ """Remove ANSI escape sequences from text."""
30
+ return ansi_escape.sub("", text)
31
+
32
+
33
+ def stream_reader(
34
+ stream: BinaryIO, log_func: Callable[[str], None], output_stream: TextIO
35
+ ) -> None:
36
+ """
37
+ Read from the stream, write to logger, and also write to the terminal.
38
+ """
39
+ for line in iter(stream.readline, b""):
40
+ decoded = line.decode(errors="replace")
41
+ output_stream.write(decoded)
42
+ output_stream.flush()
43
+ log_func(clean_ansi(decoded.rstrip("\n")))
44
+
45
+
46
+ @contextmanager
47
+ def run_subprocess_with_logger(
48
+ cmd: Union[str, List[str]], cwd: Optional[str] = None, env: Optional[dict] = None
49
+ ) -> Iterator[subprocess.Popen]:
50
+ """
51
+ Run a subprocess, redirect stdout to logger.info and stderr to logger.error.
52
+ Returns the Popen object as a context manager.
53
+
54
+ :param cmd: Command to execute
55
+ :param kwargs: Additional arguments passed to subprocess.Popen
56
+ :yield: The subprocess.Popen object
57
+ """
58
+
59
+ process = subprocess.Popen(
60
+ cmd,
61
+ stdout=subprocess.PIPE,
62
+ stderr=subprocess.PIPE,
63
+ cwd=cwd,
64
+ env=env,
65
+ bufsize=1,
66
+ )
67
+
68
+ threads = [
69
+ threading.Thread(
70
+ target=stream_reader, args=(process.stdout, logger.info, sys.stdout)
71
+ ),
72
+ threading.Thread(
73
+ target=stream_reader, args=(process.stderr, logger.error, sys.stderr)
74
+ ),
75
+ ]
76
+ for t in threads:
77
+ t.start()
78
+
79
+ try:
80
+ yield process
81
+ finally:
82
+ process.wait()
83
+ for t in threads:
84
+ t.join()
xoscar/virtualenv/uv.py CHANGED
@@ -24,6 +24,7 @@ from pathlib import Path
24
24
  from typing import Optional
25
25
 
26
26
  from .core import VirtualEnvManager
27
+ from .utils import run_subprocess_with_logger
27
28
 
28
29
  UV_PATH = os.getenv("XOSCAR_UV_PATH")
29
30
  logger = logging.getLogger(__name__)
@@ -46,7 +47,14 @@ class UVVirtualEnvManager(VirtualEnvManager):
46
47
  return shutil.which("uv") is not None
47
48
 
48
49
  def create_env(self, python_path: Path | None = None) -> None:
49
- uv_path = UV_PATH or "uv"
50
+ if (uv_path := UV_PATH) is None:
51
+ try:
52
+ from uv import find_uv_bin
53
+
54
+ uv_path = find_uv_bin()
55
+ except (ImportError, FileNotFoundError):
56
+ logger.warning("Fail to find uv bin, use system one")
57
+ uv_path = "uv"
50
58
  cmd = [uv_path, "venv", str(self.env_path), "--system-site-packages"]
51
59
  if python_path:
52
60
  cmd += ["--python", str(python_path)]
@@ -70,9 +78,17 @@ class UVVirtualEnvManager(VirtualEnvManager):
70
78
  # extend the ability of pip
71
79
  # maybe replace #system_torch# to the real version
72
80
  packages = self.process_packages(packages)
81
+ log = kwargs.pop("log", False)
73
82
 
74
83
  uv_path = UV_PATH or "uv"
75
- cmd = [uv_path, "pip", "install", "-p", str(self.env_path)] + packages
84
+ cmd = [
85
+ uv_path,
86
+ "pip",
87
+ "install",
88
+ "-p",
89
+ str(self.env_path),
90
+ "--color=always",
91
+ ] + packages
76
92
 
77
93
  # Handle known pip-related kwargs
78
94
  if "index_url" in kwargs and kwargs["index_url"]:
@@ -92,8 +108,13 @@ class UVVirtualEnvManager(VirtualEnvManager):
92
108
  cmd += [option, param_value]
93
109
 
94
110
  logger.info("Installing packages via command: %s", cmd)
95
- self._install_process = process = subprocess.Popen(cmd)
96
- returncode = process.wait()
111
+ if not log:
112
+ self._install_process = process = subprocess.Popen(cmd)
113
+ returncode = process.wait()
114
+ else:
115
+ with run_subprocess_with_logger(cmd) as process:
116
+ self._install_process = process
117
+ returncode = process.returncode
97
118
 
98
119
  self._install_process = None # install finished, clear reference
99
120
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xoscar
3
- Version: 0.7.5
3
+ Version: 0.7.7
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -1,5 +1,5 @@
1
1
  xoscar/__init__.py,sha256=lzCXUmkuIjcjkiNQFekysdJR_ZhlbjcfR5ka1bZZNQg,1683
2
- xoscar/_utils.cp310-win_amd64.pyd,sha256=7l_iFQMucYDpmbEVPpPa4t4ajvZEd3h6T-HMd0eLhZU,110080
2
+ xoscar/_utils.cp310-win_amd64.pyd,sha256=otRg_7-RzOBZIgioKJIfjHwr6f7EQ9Upondaw-Tr5tw,110080
3
3
  xoscar/_utils.pxd,sha256=rlNbTg5lhXA-jCOLksqF4jhUlNn0xw2jx1HxdLa34pc,1193
4
4
  xoscar/_utils.pyx,sha256=TWScgqmJGYzjbWBOShBLkq07ldfYEQ5fw6V4OytX_IA,7626
5
5
  xoscar/_version.py,sha256=bsfCVAo_o9LkiP3AjPsP4SRRqhjuS0t4D1WGJPzbdls,24412
@@ -7,10 +7,10 @@ xoscar/api.py,sha256=QQDHn-_FiDExmOxEk8BUnq4Qrx13VX3shSlEEqPQJo0,15175
7
7
  xoscar/backend.py,sha256=8G5JwjoOT6Q2slb11eXNApxgcmvNQUCdQzkoIMDwLcQ,1917
8
8
  xoscar/batch.py,sha256=Jk5BSpvMFAV9DrRy0a9tgPvIo_dt8cbJReZBL0cnOPc,8128
9
9
  xoscar/constants.py,sha256=GJ1KEOxwnqksc9K_GH42TSWpQECeC6ti3KJmE3PUcTw,810
10
- xoscar/context.cp310-win_amd64.pyd,sha256=neO0yZPxuGNO9LaWSbnl9Q4ypiIYywqVHwKNHg-TFCI,153600
10
+ xoscar/context.cp310-win_amd64.pyd,sha256=IsDIKeUFWCmgarhvxZpmwkzhDKjnm3tb0hzG_bCmZPA,153600
11
11
  xoscar/context.pxd,sha256=6n6IAbmArSRq8EjcsbS6npW8xP1jI0qOoS1fF0oyj-o,746
12
12
  xoscar/context.pyx,sha256=FOJVerGOvxe2USryXEQA0rpaFX_ScxISH6QWKUcahY8,11310
13
- xoscar/core.cp310-win_amd64.pyd,sha256=-hE_1rNvOSEN_QuXmH7SLkkUkp3rS33Maq7tPL8PnXY,304128
13
+ xoscar/core.cp310-win_amd64.pyd,sha256=888cvDmhVCUpKoQ-9Kl0HTOOBnlaX99pCpAURhV7XLA,304128
14
14
  xoscar/core.pxd,sha256=9IZP7dYGfnF1I-obIls8R8b6forxDOPbiM3v5nVslLk,1368
15
15
  xoscar/core.pyx,sha256=U6jCZN74MQHi7HkQRaVGm_w5q-FMsw0nnE3aU6533_Q,22756
16
16
  xoscar/debug.py,sha256=hrmxIH6zvTKasQo6PUUgXu5mgEsR0g87Fvpw7CoHipg,5257
@@ -30,7 +30,7 @@ xoscar/backends/allocate_strategy.py,sha256=DzvTlixwzTANURI2mDLHm3vcaugSPDxU6UQZ
30
30
  xoscar/backends/config.py,sha256=86j0g_Xrl8ENPzBWi296yWg9QEcljvdKK-yJbfYTvQ0,5532
31
31
  xoscar/backends/context.py,sha256=qWwksx8JxYcKR-LQA3PvXh4ReuuTTEyDaLbjpxGXcTA,16766
32
32
  xoscar/backends/core.py,sha256=fbekAxys_t1Dv7if-1R6uVvC_yAxNkXLeQ1V1ZSAfC0,11161
33
- xoscar/backends/message.cp310-win_amd64.pyd,sha256=RiXa26cK44t_Qg4CJ4US5BX7-RF-4D2REiSbnnZqB7A,247808
33
+ xoscar/backends/message.cp310-win_amd64.pyd,sha256=h8VlNmcDiDGEhebkw_m9u2BvnKGpqz_JL7a4uIkr_lQ,247808
34
34
  xoscar/backends/message.pyx,sha256=lBEjMJv4VyxmeO9lHXJJazOajbFnTLak4PSBcLoPZvU,20331
35
35
  xoscar/backends/pool.py,sha256=bS_m8XBkfQQsCOaLEzM6HkV5e78dPPp1bCH6yjvPEss,62153
36
36
  xoscar/backends/router.py,sha256=EjfNpQUrhFU15eYe1kRPueziHgI2gfDViUzm7ruvXDE,10817
@@ -57,8 +57,8 @@ xoscar/collective/common.py,sha256=9c7xq3IOUvfA0I9GnpalUqXZOzmF6IEILv4zL64BYVE,3
57
57
  xoscar/collective/core.py,sha256=191aPxbUgWpjzrqyozndImDAQhZFmqoQdBkHFLDfXN0,24239
58
58
  xoscar/collective/process_group.py,sha256=kTPbrLMJSGhqbiWvTIiz-X3W0rZWd_CFn_zUIlXbOlM,23286
59
59
  xoscar/collective/utils.py,sha256=p3WEVtXvnVhkuO5mRgQBhBRFr1dKHcDKMjrbMyuiyfg,1219
60
- xoscar/collective/uv.dll,sha256=XPTEipuU5N4bmjUFs8621UFQv7R7wU7lbK-Nka5NlN4,620544
61
- xoscar/collective/xoscar_pygloo.cp310-win_amd64.pyd,sha256=B7jfOJFoRqL9MhoO71vbjvrICCa6UgEycTt-SnXrtzI,829952
60
+ xoscar/collective/uv.dll,sha256=yOrXokDO1xCxUDaPdNpKji5CqeL9BVz4p9KVxty1RMA,620544
61
+ xoscar/collective/xoscar_pygloo.cp310-win_amd64.pyd,sha256=NTOSqlIB1Kz8vhe8T85qlQfMdZsGur-_7m8sgOdUL9w,829952
62
62
  xoscar/metrics/__init__.py,sha256=RjXuuYw4I2YYgD8UY2Z5yCZk0Z56xMJ1n40O80Dtxf8,726
63
63
  xoscar/metrics/api.py,sha256=dtJ4QrIqQNXhJedeqOPs4TXKgrRGZFFN50xAd9SCfec,9144
64
64
  xoscar/metrics/backends/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS3Ijp1YgyynoUFLeuU,594
@@ -69,7 +69,7 @@ xoscar/metrics/backends/prometheus/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS
69
69
  xoscar/metrics/backends/prometheus/prometheus_metric.py,sha256=65hb8O3tmsEJ7jgOrIwl_suj9SE5Tmqcfjuk0urkLvE,2120
70
70
  xoscar/serialization/__init__.py,sha256=tS8C49yrW_geWNEsbgW3phK1q4YN1ojI6CN-vroIFYM,876
71
71
  xoscar/serialization/aio.py,sha256=7YLXgkWpQ3ANy-TZ1qO8Mt4_J3cZFhFh2FEgUgxMT60,4873
72
- xoscar/serialization/core.cp310-win_amd64.pyd,sha256=abK2espIAdNtgtQ0maDRJzKhm7be56MyGaqFncPXtIc,268800
72
+ xoscar/serialization/core.cp310-win_amd64.pyd,sha256=eqFeiCDtXN5r3-Mb_mAXms2zR7GkrEopOmPwf7idMuU,268800
73
73
  xoscar/serialization/core.pxd,sha256=X-47bqBM2Kzw5SkLqICdKD0gU6CpmLsBxC3kfW--wVk,1013
74
74
  xoscar/serialization/core.pyx,sha256=ZKexLRnRwZXXn2045kR7xfM_szcoPNrDuouQCWtpFp8,30570
75
75
  xoscar/serialization/cuda.py,sha256=Fj4Cpr_YmkGceUCo0mQn8fRvmHP_5WcLdRx6epZ3RC0,3869
@@ -80,8 +80,9 @@ xoscar/serialization/pyfury.py,sha256=3ucal29Hr7PX9_1SfB2x43FE2xw_C0rLkVv3foL7qw
80
80
  xoscar/serialization/scipy.py,sha256=9ph-yoRoNiwUZTwQrn35U60VPirWlncXNAg6EXvqMR4,2554
81
81
  xoscar/virtualenv/__init__.py,sha256=rhJ7I6x7aXjKOCzSqsKLwqFJMh4YC2sqchEIJNEfI58,1151
82
82
  xoscar/virtualenv/core.py,sha256=ygnDO6QA3gXoT-uiME8Cn-ET_PtwCUxy1i8uCOd9J7Q,2834
83
- xoscar/virtualenv/uv.py,sha256=hv5lOyBqeeqIKBlBSCgT9Njlf9pH3X42IWa47gmlrwM,4263
84
- xoscar-0.7.5.dist-info/METADATA,sha256=GQmGilqxuO3vz9aBBDg_pPhxOy7Xd4__kMccfyqoYFI,9360
85
- xoscar-0.7.5.dist-info/WHEEL,sha256=NVXpD7b4Gxps0cd2ds5rr5TG8W4ApEwx_i5J99qMZ5E,102
86
- xoscar-0.7.5.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
87
- xoscar-0.7.5.dist-info/RECORD,,
83
+ xoscar/virtualenv/utils.py,sha256=tZYB1kAEym5e8WK9SxhW7VgZzXk6fJMm6MoBA7pY4gM,2523
84
+ xoscar/virtualenv/uv.py,sha256=BltNzYn07WvviQFq0Hmi2AB8XEqKlR7HYThuKXn3TRk,4927
85
+ xoscar-0.7.7.dist-info/METADATA,sha256=jo9lNKQiMc7Xg8cG5MvFoRoPgeVxx8JDRyL9QOVY_qs,9360
86
+ xoscar-0.7.7.dist-info/WHEEL,sha256=NVXpD7b4Gxps0cd2ds5rr5TG8W4ApEwx_i5J99qMZ5E,102
87
+ xoscar-0.7.7.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
88
+ xoscar-0.7.7.dist-info/RECORD,,
File without changes