xoscar 0.7.5__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.7.6__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.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.

@@ -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__)
@@ -70,9 +71,17 @@ class UVVirtualEnvManager(VirtualEnvManager):
70
71
  # extend the ability of pip
71
72
  # maybe replace #system_torch# to the real version
72
73
  packages = self.process_packages(packages)
74
+ log = kwargs.pop("log", False)
73
75
 
74
76
  uv_path = UV_PATH or "uv"
75
- cmd = [uv_path, "pip", "install", "-p", str(self.env_path)] + packages
77
+ cmd = [
78
+ uv_path,
79
+ "pip",
80
+ "install",
81
+ "-p",
82
+ str(self.env_path),
83
+ "--color=always",
84
+ ] + packages
76
85
 
77
86
  # Handle known pip-related kwargs
78
87
  if "index_url" in kwargs and kwargs["index_url"]:
@@ -92,8 +101,13 @@ class UVVirtualEnvManager(VirtualEnvManager):
92
101
  cmd += [option, param_value]
93
102
 
94
103
  logger.info("Installing packages via command: %s", cmd)
95
- self._install_process = process = subprocess.Popen(cmd)
96
- returncode = process.wait()
104
+ if not log:
105
+ self._install_process = process = subprocess.Popen(cmd)
106
+ returncode = process.wait()
107
+ else:
108
+ with run_subprocess_with_logger(cmd) as process:
109
+ self._install_process = process
110
+ returncode = process.returncode
97
111
 
98
112
  self._install_process = None # install finished, clear reference
99
113
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xoscar
3
- Version: 0.7.5
3
+ Version: 0.7.6
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -82,8 +82,9 @@ xoscar/serialization/pyfury.py,sha256=sifOnVMYoS82PzZEkzkfxesmMHei23k5UAUUKUyoOY
82
82
  xoscar/serialization/scipy.py,sha256=yOEi0NB8cqQ6e2UnCZ1w006RsB7T725tIL-DM_hNcsU,2482
83
83
  xoscar/virtualenv/__init__.py,sha256=65t9_X1DvbanNjFy366SiiWZrRTpa9SXWMXPmqayE-4,1117
84
84
  xoscar/virtualenv/core.py,sha256=dZqwg2IzHsLEERvohZx0rvBINopMRUImqxG3HHGO0q4,2744
85
- xoscar/virtualenv/uv.py,sha256=mR4gevfB8eFMmSLfvOYM-QhyqWyDsqO-V4bkRuhOOWA,4145
86
- xoscar-0.7.5.dist-info/METADATA,sha256=1azJ-zoI5CWOZ4swmrpna12HGQUVTbpv41HsN1PsS9I,9189
87
- xoscar-0.7.5.dist-info/WHEEL,sha256=29GglsfgOKni3MnvXwDNoeBjBZY4LOjl_HH3QTWETk4,153
88
- xoscar-0.7.5.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
89
- xoscar-0.7.5.dist-info/RECORD,,
85
+ xoscar/virtualenv/utils.py,sha256=mL_uATHhj82xec0-0IZ6N8yI-laPAB4t8G3alPUGtPA,2439
86
+ xoscar/virtualenv/uv.py,sha256=pwjOlvwz_ZlO1GQg_yqca-G6Ro_0L7H1Uf5dJPB6lQQ,4526
87
+ xoscar-0.7.6.dist-info/METADATA,sha256=xp7ww__iDtQ5jUUW4gWu1AbFSHNUEf-rbvdC9s7i7Vg,9189
88
+ xoscar-0.7.6.dist-info/WHEEL,sha256=29GglsfgOKni3MnvXwDNoeBjBZY4LOjl_HH3QTWETk4,153
89
+ xoscar-0.7.6.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
90
+ xoscar-0.7.6.dist-info/RECORD,,
File without changes