xoscar 0.5.0__cp312-cp312-macosx_11_0_arm64.whl → 0.6.1__cp312-cp312-macosx_11_0_arm64.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.
Binary file
xoscar/backends/pool.py CHANGED
@@ -22,6 +22,7 @@ import itertools
22
22
  import logging
23
23
  import multiprocessing
24
24
  import os
25
+ import sys
25
26
  import threading
26
27
  import traceback
27
28
  from abc import ABC, ABCMeta, abstractmethod
@@ -824,6 +825,9 @@ class ActorPoolBase(AbstractActorPool, metaclass=ABCMeta):
824
825
  with _disable_log_temporally():
825
826
  TypeDispatcher.reload_all_lazy_handlers()
826
827
 
828
+ if "PYTHONPATH" in os.environ:
829
+ sys.path.insert(0, os.environ["PYTHONPATH"])
830
+
827
831
  def handle_channel(channel):
828
832
  return pool.on_new_channel(channel)
829
833
 
Binary file
Binary file
@@ -0,0 +1,34 @@
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
+ from __future__ import annotations
16
+
17
+ from pathlib import Path
18
+
19
+ from .core import VirtualEnvManager
20
+ from .uv import UVVirtualEnvManager
21
+
22
+ _name_to_managers = {"uv": UVVirtualEnvManager}
23
+
24
+
25
+ def get_virtual_env_manager(env_name: str, env_path: str | Path) -> VirtualEnvManager:
26
+ try:
27
+ manager_cls = _name_to_managers[env_name]
28
+ except KeyError:
29
+ raise ValueError(
30
+ f"Unknown virtualenv manager {env_name}, available: {list(_name_to_managers)}"
31
+ )
32
+
33
+ path = Path(env_path)
34
+ return manager_cls(path)
@@ -0,0 +1,48 @@
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
+ from __future__ import annotations
16
+
17
+ from abc import ABC, abstractmethod
18
+ from pathlib import Path
19
+
20
+
21
+ class VirtualEnvManager(ABC):
22
+ @classmethod
23
+ @abstractmethod
24
+ def is_available(cls):
25
+ pass
26
+
27
+ def __init__(self, env_path: Path):
28
+ self.env_path = env_path.resolve()
29
+
30
+ @abstractmethod
31
+ def create_env(self, python_path: Path | None = None) -> None:
32
+ pass
33
+
34
+ @abstractmethod
35
+ def install_packages(self, packages: list[str], **kwargs):
36
+ pass
37
+
38
+ @abstractmethod
39
+ def cancel_install(self):
40
+ pass
41
+
42
+ @abstractmethod
43
+ def get_lib_path(self) -> str:
44
+ pass
45
+
46
+ @abstractmethod
47
+ def remove_env(self):
48
+ pass
@@ -0,0 +1,79 @@
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
+ from __future__ import annotations
16
+
17
+ import shutil
18
+ import subprocess
19
+ import sysconfig
20
+ from pathlib import Path
21
+ from typing import Optional
22
+
23
+ from .core import VirtualEnvManager
24
+
25
+
26
+ class UVVirtualEnvManager(VirtualEnvManager):
27
+ def __init__(self, env_path: Path):
28
+ super().__init__(env_path)
29
+ self._install_process: Optional[subprocess.Popen] = None
30
+
31
+ @classmethod
32
+ def is_available(cls):
33
+ return shutil.which("uv") is not None
34
+
35
+ def create_env(self, python_path: Path | None = None) -> None:
36
+ cmd = ["uv", "venv", str(self.env_path)]
37
+ if python_path:
38
+ cmd += ["--python", str(python_path)]
39
+ subprocess.run(cmd, check=True)
40
+
41
+ def install_packages(self, packages: list[str], **kwargs):
42
+ """
43
+ Install packages into the virtual environment using uv.
44
+ Supports pip-compatible kwargs: index_url, extra_index_url, find_links.
45
+ """
46
+ if not packages:
47
+ return
48
+
49
+ cmd = ["uv", "pip", "install", "-p", str(self.env_path)] + packages
50
+
51
+ # Handle known pip-related kwargs
52
+ if "index_url" in kwargs and kwargs["index_url"]:
53
+ cmd += ["-i", kwargs["index_url"]]
54
+ if "extra_index_url" in kwargs and kwargs["extra_index_url"]:
55
+ cmd += ["--extra-index-url", kwargs["extra_index_url"]]
56
+ if "find_links" in kwargs and kwargs["find_links"]:
57
+ cmd += ["-f", kwargs["find_links"]]
58
+ if "trusted_host" in kwargs and kwargs["trusted_host"]:
59
+ cmd += ["--trusted-host", kwargs["trusted_host"]]
60
+
61
+ self._install_process = process = subprocess.Popen(cmd)
62
+ returncode = process.wait()
63
+
64
+ self._install_process = None # install finished, clear reference
65
+
66
+ if returncode != 0:
67
+ raise subprocess.CalledProcessError(returncode, cmd)
68
+
69
+ def cancel_install(self):
70
+ if self._install_process and self._install_process.poll() is None:
71
+ self._install_process.terminate()
72
+ self._install_process.wait()
73
+
74
+ def get_lib_path(self) -> str:
75
+ return sysconfig.get_path("purelib", vars={"base": str(self.env_path)})
76
+
77
+ def remove_env(self):
78
+ if self.env_path.exists():
79
+ shutil.rmtree(self.env_path, ignore_errors=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xoscar
3
- Version: 0.5.0
3
+ Version: 0.6.1
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -40,6 +40,7 @@ Requires-Dist: pydata-sphinx-theme>=0.3.0; extra == "dev"
40
40
  Requires-Dist: sphinx-intl>=0.9.9; extra == "dev"
41
41
  Requires-Dist: flake8>=3.8.0; extra == "dev"
42
42
  Requires-Dist: black; extra == "dev"
43
+ Requires-Dist: uv; extra == "dev"
43
44
  Provides-Extra: doc
44
45
  Requires-Dist: ipython>=6.5.0; extra == "doc"
45
46
  Requires-Dist: sphinx; extra == "doc"
@@ -1,7 +1,7 @@
1
- xoscar-0.5.0.dist-info/RECORD,,
2
- xoscar-0.5.0.dist-info/WHEEL,sha256=zT4bWmTpgvLb-CO5IGKhtulo8JdnX1gd0cgiqom_p-o,109
3
- xoscar-0.5.0.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
- xoscar-0.5.0.dist-info/METADATA,sha256=j5WH3M8UvoD1VpwA3ooeBzR2aWjBeseWcSjetW51-MY,9097
1
+ xoscar-0.6.1.dist-info/RECORD,,
2
+ xoscar-0.6.1.dist-info/WHEEL,sha256=zT4bWmTpgvLb-CO5IGKhtulo8JdnX1gd0cgiqom_p-o,109
3
+ xoscar-0.6.1.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
+ xoscar-0.6.1.dist-info/METADATA,sha256=9fv3VVarAR1QSCiE-ufI-_7w9qXAYxsTeDVzbAAWdC4,9131
5
5
  xoscar/_utils.pyx,sha256=6iqO4eTwEI-n9i39n_TKz7MWqbytMRnVNubdJ5egL6o,7279
6
6
  xoscar/backend.py,sha256=is436OPkZfSpQXaoqTRVta5eoye_pp45RFgCstAk2hU,1850
7
7
  xoscar/core.pxd,sha256=I_C2ka7XryyGnnAVXUVm8xfS1gtIrCs6X-9rswgOcUU,1317
@@ -10,16 +10,16 @@ xoscar/context.pxd,sha256=qKa0OyDPZtVymftSh447m-RzFZgmz8rGqQBa7qlauvc,725
10
10
  xoscar/batch.py,sha256=DpArS0L3WYJ_HVPG-6hSYEwoAFY1mY2-mlC4Jp5M_Dw,7872
11
11
  xoscar/nvutils.py,sha256=qmW4mKLU0WB2yCs198ccQOgLL02zB7Fsa-AotO3NOmg,20412
12
12
  xoscar/constants.py,sha256=QHHSREw6uWBBjQDCFqlNfTvBZgniJPGy42KSIsR8Fqw,787
13
- xoscar/core.cpython-312-darwin.so,sha256=EPeCk67vEmVV9e5TTzTiTemo4Qtu_UQYGklpNdqF4Y8,441432
13
+ xoscar/core.cpython-312-darwin.so,sha256=MHNO5qn5RWaVUrESGK_bs2VsT8oTTfV6GHXkl74wUZ8,441432
14
14
  xoscar/__init__.py,sha256=0zX8kKaio3ZIrlzB79WybcravMJw1OxPWjDspTgJFyQ,1608
15
- xoscar/context.cpython-312-darwin.so,sha256=Z27ktylgD-f_jCxAsHCZiJUnBKVEpwushhFVJEBZJuE,210096
15
+ xoscar/context.cpython-312-darwin.so,sha256=NfX20K0mWqjbGZV-wpWkR_Ugxz3onFqqG0uXnTXlN_8,210096
16
16
  xoscar/api.py,sha256=3hztPoOxg8A_mlhWyWgVP7FMXG0PATA1TP4Rbaj7A-g,13327
17
17
  xoscar/utils.py,sha256=jUw6OICZUPBbmS1b3GE4vLctJf6fCKXrYtLtBuK-Oqc,16483
18
18
  xoscar/debug.py,sha256=9Z8SgE2WaKYQcyDo-5-DxEJQ533v7kWjrvCd28pSx3E,5069
19
19
  xoscar/libcpp.pxd,sha256=DJqBxLFOKL4iRr9Kale5UH3rbvPRD1x5bTSOPHFpz9I,1147
20
20
  xoscar/context.pyx,sha256=8CdgPnWcE9eOp3N600WgDQ03MCi8P73eUOGcfV7Zksg,10942
21
21
  xoscar/errors.py,sha256=wBlQOKsXf0Fc4skN39tDie0YZT-VIAuLNRgoDl2pZcA,1241
22
- xoscar/_utils.cpython-312-darwin.so,sha256=9YkK5hKML6-l7QRo2Lj5CVZA8v7-rHacCgGDrfhJl20,167168
22
+ xoscar/_utils.cpython-312-darwin.so,sha256=fWAzrdkm19T_ihMjahogiheVGhgLcxDrkESEZBBuTc8,167168
23
23
  xoscar/core.pyx,sha256=phN-yYV0A0QI8WFi2jCu0nc4CnShTepfDi0V7ZrLYPY,22092
24
24
  xoscar/driver.py,sha256=498fowtJr6b3FE8FIOA_Tc1Vwx88nfZw7p0FxrML0h4,1372
25
25
  xoscar/profiling.py,sha256=BC5OF0HzSaXv8V7w-y-B8r5gV5DgxHFoTEIF6jCMioQ,8015
@@ -43,7 +43,7 @@ xoscar/serialization/exception.py,sha256=Jy8Lsk0z-VJyEUaWeuZIwkmxqaoB-nLKMa1D15C
43
43
  xoscar/serialization/pyfury.py,sha256=sifOnVMYoS82PzZEkzkfxesmMHei23k5UAUUKUyoOYQ,1163
44
44
  xoscar/serialization/core.pxd,sha256=k4RoJgX5E5LGs4jdCQ7vvcn26MabXbrWoWhkO49X6YI,985
45
45
  xoscar/serialization/core.pyi,sha256=-pQARSj91rt3iU4ftWGFH6jYwsSKYCT_Ya7EJsaGEjg,1874
46
- xoscar/serialization/core.cpython-312-darwin.so,sha256=TzzzeO6cPzxcvvnKnetAUzlWXY5CMtBKqsK1a24d4us,378616
46
+ xoscar/serialization/core.cpython-312-darwin.so,sha256=xcAv3cxUIO3sJGVz58GoMt95rinT_OUhIcdgpJt1KwY,378616
47
47
  xoscar/serialization/__init__.py,sha256=v76XC2OQLp-Yk4_U3_IVguEylMeyRw1UrkU_DPDMh0U,856
48
48
  xoscar/serialization/numpy.py,sha256=5Kem87CvpJmzUMp3QHk4WeHU30FoQWTJJP2SwIcaQG0,2919
49
49
  xoscar/serialization/cuda.py,sha256=iFUEnN4SiquBIhyieyOrfw3TnKnW-tU_vYgqOxO_DrA,3758
@@ -58,9 +58,9 @@ xoscar/backends/__init__.py,sha256=VHEBQcUWM5bj027W8EUf9PiJUAP7JoMrRw3Tsvy5ySw,6
58
58
  xoscar/backends/core.py,sha256=EH-fHlV9x3bnruEHaUtGYO7osKLfLJ4AQHtuzA_mr2g,10857
59
59
  xoscar/backends/context.py,sha256=XfDPG2eDhAhE6hWBEkEsHTnyyOYN9R3houlMjAL7BFw,16329
60
60
  xoscar/backends/router.py,sha256=MVl5naz-FYf-Wla7XRn3kRxOpWV0SjKDsKNluifVA8M,10532
61
- xoscar/backends/message.cpython-312-darwin.so,sha256=RdhpYrsEBczn2MJzqgO6i4PtDXkBLsy5o55UGDQ3brU,381056
61
+ xoscar/backends/message.cpython-312-darwin.so,sha256=QKper0LRYloF9IDuKVatLKyEE1Lc3fZ_Hu3EOx3Zggg,381056
62
62
  xoscar/backends/message.pyx,sha256=krGVtZ1YDaZX8yWhaNHwZiudQooLvcGlw6x3Sq7jxjE,19685
63
- xoscar/backends/pool.py,sha256=omYqaPyv1WW1YrU3OSZhk3kr0JyfI7MYhBtTemVJKZA,60895
63
+ xoscar/backends/pool.py,sha256=OezOhvvXAV3TpODhLHmJVgqCfowb3aA_fWZKPodm8bE,61003
64
64
  xoscar/backends/indigen/backend.py,sha256=znl_fZzWGEtLH8hZ9j9Kkf0fva25jEem2_KO7I1RVvc,1612
65
65
  xoscar/backends/indigen/__init__.py,sha256=tKHP5ClzedBRBpZsLRVErR3EUNbbDm4CY4u0rCFJr44,685
66
66
  xoscar/backends/indigen/driver.py,sha256=VGzkacYKykegW5qhCuhx01gdgBZEKJjNIyfNCnA6Nm8,952
@@ -81,3 +81,6 @@ xoscar/aio/file.py,sha256=PBtkLp-Q7XtYl-zk00s18TtgIrkNr60J3Itf66ctO1o,1486
81
81
  xoscar/aio/lru.py,sha256=rpXCqSLtPV5xnWtd6uDwQQFGgIPEgvmWEQDkPNUx9cM,6311
82
82
  xoscar/aio/parallelism.py,sha256=VSsjk8wP-Bw7tLeUsTyLVNgp91thjxEfE3pCrw_vF5Q,1293
83
83
  xoscar/aio/base.py,sha256=9j0f1piwfE5R5GIvV212vSD03ixdaeSzSSsO2kxJZVE,2249
84
+ xoscar/virtualenv/__init__.py,sha256=65t9_X1DvbanNjFy366SiiWZrRTpa9SXWMXPmqayE-4,1117
85
+ xoscar/virtualenv/core.py,sha256=YMN6yHoNeEc8ecbJMbZkKeWKUABK1mUZ_OYOjcbRqWs,1263
86
+ xoscar/virtualenv/uv.py,sha256=l9w5JxETbW2wN8vfZR7k7aKTz4cWV4MvH06MoogBOVc,2842
File without changes