xoscar 0.7.5__cp312-cp312-win_amd64.whl → 0.7.7__cp312-cp312-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.4
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.cp312-win_amd64.pyd,sha256=uQ5TXH_mp5MEtiAvyTst8SJCnPgdfJZQ2wf598qlnX0,108032
2
+ xoscar/_utils.cp312-win_amd64.pyd,sha256=fTm4v7_2D5kuHRs3THi64n5-X8eEZ6uxyr8y8c-yT2w,108032
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.cp312-win_amd64.pyd,sha256=KdhTbZflbVGEml2Wm6L1l0-ZsEyymy3zJ9bTYZgdP9I,154112
10
+ xoscar/context.cp312-win_amd64.pyd,sha256=J_VQotR5RPdUqfn2-nOqmiifXLVEOvmTgFR2fPJYbqQ,154112
11
11
  xoscar/context.pxd,sha256=6n6IAbmArSRq8EjcsbS6npW8xP1jI0qOoS1fF0oyj-o,746
12
12
  xoscar/context.pyx,sha256=FOJVerGOvxe2USryXEQA0rpaFX_ScxISH6QWKUcahY8,11310
13
- xoscar/core.cp312-win_amd64.pyd,sha256=Ya_fTgNDUZB4WRplV9sSEsXdg_4b63KuayTepnvqK3A,313344
13
+ xoscar/core.cp312-win_amd64.pyd,sha256=ikmyNU4Ii4K3NbLBmggfqOGkfRx0PfIjcaGJJ4hxQlo,313344
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.cp312-win_amd64.pyd,sha256=008EZ889W4q5j1SpUHHRoQVCWSs-doQEt8lJ-cR-Hqk,253952
33
+ xoscar/backends/message.cp312-win_amd64.pyd,sha256=2cFh2Nv8vXfTvu8dhcoLQdoYlSe97D3XXOL6LAYBHnA,253952
34
34
  xoscar/backends/message.pyi,sha256=m1PrSLvj-IbrHuVfQGoPDs6prI-GJV1vQJqZ5WdQcY4,6798
35
35
  xoscar/backends/message.pyx,sha256=lBEjMJv4VyxmeO9lHXJJazOajbFnTLak4PSBcLoPZvU,20331
36
36
  xoscar/backends/pool.py,sha256=bS_m8XBkfQQsCOaLEzM6HkV5e78dPPp1bCH6yjvPEss,62153
@@ -58,8 +58,8 @@ xoscar/collective/common.py,sha256=9c7xq3IOUvfA0I9GnpalUqXZOzmF6IEILv4zL64BYVE,3
58
58
  xoscar/collective/core.py,sha256=191aPxbUgWpjzrqyozndImDAQhZFmqoQdBkHFLDfXN0,24239
59
59
  xoscar/collective/process_group.py,sha256=kTPbrLMJSGhqbiWvTIiz-X3W0rZWd_CFn_zUIlXbOlM,23286
60
60
  xoscar/collective/utils.py,sha256=p3WEVtXvnVhkuO5mRgQBhBRFr1dKHcDKMjrbMyuiyfg,1219
61
- xoscar/collective/uv.dll,sha256=H0B187s2-79fz-7g0ZZZWR3Zny1rYC3F_JUrE27HSlY,620544
62
- xoscar/collective/xoscar_pygloo.cp312-win_amd64.pyd,sha256=oA2U23B0WWCU2LrT9PzF29Hn6kIdhkm06od89BcUngE,838656
61
+ xoscar/collective/uv.dll,sha256=LCQwCIOnTYhvoNLwK3UiP4JYBJEzQWHp9WlEZ7BklgY,620544
62
+ xoscar/collective/xoscar_pygloo.cp312-win_amd64.pyd,sha256=DRkU8g0ZzehLcaSeTzg2R62VIYBXnDGLQRrnTumSB3U,838656
63
63
  xoscar/collective/xoscar_pygloo.pyi,sha256=6KRzElgNBBKWh-VivUw1b5Dolp17MgwA91hQo33EysU,7616
64
64
  xoscar/metrics/__init__.py,sha256=RjXuuYw4I2YYgD8UY2Z5yCZk0Z56xMJ1n40O80Dtxf8,726
65
65
  xoscar/metrics/api.py,sha256=dtJ4QrIqQNXhJedeqOPs4TXKgrRGZFFN50xAd9SCfec,9144
@@ -71,7 +71,7 @@ xoscar/metrics/backends/prometheus/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS
71
71
  xoscar/metrics/backends/prometheus/prometheus_metric.py,sha256=65hb8O3tmsEJ7jgOrIwl_suj9SE5Tmqcfjuk0urkLvE,2120
72
72
  xoscar/serialization/__init__.py,sha256=tS8C49yrW_geWNEsbgW3phK1q4YN1ojI6CN-vroIFYM,876
73
73
  xoscar/serialization/aio.py,sha256=7YLXgkWpQ3ANy-TZ1qO8Mt4_J3cZFhFh2FEgUgxMT60,4873
74
- xoscar/serialization/core.cp312-win_amd64.pyd,sha256=uYxnMja1_2zqDaho4X7uObf-Mlaa6WcL9lviU0SuQxg,271360
74
+ xoscar/serialization/core.cp312-win_amd64.pyd,sha256=ydSOlNWdUPRL0qzHKrUR7DJ1OOhuqxVabWM3aq6EBaw,271360
75
75
  xoscar/serialization/core.pxd,sha256=X-47bqBM2Kzw5SkLqICdKD0gU6CpmLsBxC3kfW--wVk,1013
76
76
  xoscar/serialization/core.pyi,sha256=Zof9373qy2lmjenSuMznEiTSCNW6WQB7rmSXrRbjUo0,1931
77
77
  xoscar/serialization/core.pyx,sha256=ZKexLRnRwZXXn2045kR7xfM_szcoPNrDuouQCWtpFp8,30570
@@ -83,8 +83,9 @@ xoscar/serialization/pyfury.py,sha256=3ucal29Hr7PX9_1SfB2x43FE2xw_C0rLkVv3foL7qw
83
83
  xoscar/serialization/scipy.py,sha256=9ph-yoRoNiwUZTwQrn35U60VPirWlncXNAg6EXvqMR4,2554
84
84
  xoscar/virtualenv/__init__.py,sha256=rhJ7I6x7aXjKOCzSqsKLwqFJMh4YC2sqchEIJNEfI58,1151
85
85
  xoscar/virtualenv/core.py,sha256=ygnDO6QA3gXoT-uiME8Cn-ET_PtwCUxy1i8uCOd9J7Q,2834
86
- xoscar/virtualenv/uv.py,sha256=hv5lOyBqeeqIKBlBSCgT9Njlf9pH3X42IWa47gmlrwM,4263
87
- xoscar-0.7.5.dist-info/METADATA,sha256=VE6KAHQNwZfFnTWXnZ6pKg-F58lW_s0XUXNC3PXZHSI,9417
88
- xoscar-0.7.5.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
89
- xoscar-0.7.5.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
90
- xoscar-0.7.5.dist-info/RECORD,,
86
+ xoscar/virtualenv/utils.py,sha256=tZYB1kAEym5e8WK9SxhW7VgZzXk6fJMm6MoBA7pY4gM,2523
87
+ xoscar/virtualenv/uv.py,sha256=BltNzYn07WvviQFq0Hmi2AB8XEqKlR7HYThuKXn3TRk,4927
88
+ xoscar-0.7.7.dist-info/METADATA,sha256=hwHj3iUTNIl68U9ZNz_5j0SsoAB2mpbe0vYCFZJNu9M,9417
89
+ xoscar-0.7.7.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101
90
+ xoscar-0.7.7.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
91
+ xoscar-0.7.7.dist-info/RECORD,,
File without changes