xoscar 0.7.1__tar.gz → 0.7.3__tar.gz
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.
- {xoscar-0.7.1 → xoscar-0.7.3}/PKG-INFO +1 -1
- xoscar-0.7.3/xoscar/virtualenv/core.py +90 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/virtualenv/uv.py +24 -2
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar.egg-info/PKG-INFO +1 -1
- xoscar-0.7.1/xoscar/virtualenv/core.py +0 -52
- {xoscar-0.7.1 → xoscar-0.7.3}/MANIFEST.in +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/pyproject.toml +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/setup.cfg +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/setup.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/versioneer.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/_utils.pxd +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/_utils.pyx +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/_version.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/aio/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/aio/base.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/aio/file.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/aio/lru.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/aio/parallelism.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/api.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backend.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/allocate_strategy.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/base.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/core.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/dummy.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/errors.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/socket.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/ucx.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/communication/utils.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/config.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/context.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/core.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/indigen/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/indigen/__main__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/indigen/backend.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/indigen/driver.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/indigen/fate_sharing.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/indigen/pool.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/indigen/shared_memory.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/message.pyi +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/message.pyx +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/pool.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/router.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/test/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/test/backend.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/backends/test/pool.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/batch.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/collective/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/collective/common.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/collective/core.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/collective/process_group.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/collective/utils.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/collective/xoscar_pygloo.pyi +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/constants.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/context.pxd +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/context.pyx +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/core.pxd +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/core.pyx +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/debug.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/driver.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/errors.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/libcpp.pxd +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/api.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/backends/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/backends/console/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/backends/console/console_metric.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/backends/metric.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/backends/prometheus/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/metrics/backends/prometheus/prometheus_metric.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/nvutils.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/profiling.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/aio.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/core.pxd +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/core.pyi +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/core.pyx +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/cuda.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/exception.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/mlx.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/numpy.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/pyfury.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/serialization/scipy.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/utils.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar/virtualenv/__init__.py +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar.egg-info/SOURCES.txt +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar.egg-info/dependency_links.txt +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar.egg-info/not-zip-safe +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar.egg-info/requires.txt +0 -0
- {xoscar-0.7.1 → xoscar-0.7.3}/xoscar.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
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 importlib
|
|
18
|
+
from abc import ABC, abstractmethod
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class VirtualEnvManager(ABC):
|
|
23
|
+
@classmethod
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def is_available(cls):
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
def __init__(self, env_path: Path):
|
|
29
|
+
self.env_path = env_path.resolve()
|
|
30
|
+
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def create_env(self, python_path: Path | None = None) -> None:
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
@abstractmethod
|
|
36
|
+
def install_packages(self, packages: list[str], **kwargs):
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def process_packages(packages: list[str]) -> list[str]:
|
|
41
|
+
"""
|
|
42
|
+
Process a list of package names, replacing placeholders like #system_<package>#
|
|
43
|
+
with the installed version of the corresponding package from the system environment.
|
|
44
|
+
|
|
45
|
+
Example:
|
|
46
|
+
"#system_torch#" -> "torch==2.1.0" (if torch 2.1.0 is installed)
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
packages (list[str]): A list of package names, which may include placeholders.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
list[str]: A new list with resolved package names and versions.
|
|
53
|
+
|
|
54
|
+
Raises:
|
|
55
|
+
RuntimeError: If a specified system package is not found in the environment.
|
|
56
|
+
"""
|
|
57
|
+
processed = []
|
|
58
|
+
|
|
59
|
+
for pkg in packages:
|
|
60
|
+
if pkg.startswith("#system_") and pkg.endswith("#"):
|
|
61
|
+
real_pkg = pkg[
|
|
62
|
+
len("#system_") : -1
|
|
63
|
+
] # Extract actual package name, e.g., "torch"
|
|
64
|
+
try:
|
|
65
|
+
version = importlib.metadata.version(real_pkg)
|
|
66
|
+
except importlib.metadata.PackageNotFoundError:
|
|
67
|
+
raise RuntimeError(
|
|
68
|
+
f"System package '{real_pkg}' not found. Cannot resolve '{pkg}'."
|
|
69
|
+
)
|
|
70
|
+
processed.append(f"{real_pkg}=={version}")
|
|
71
|
+
else:
|
|
72
|
+
processed.append(pkg)
|
|
73
|
+
|
|
74
|
+
return processed
|
|
75
|
+
|
|
76
|
+
@abstractmethod
|
|
77
|
+
def cancel_install(self):
|
|
78
|
+
pass
|
|
79
|
+
|
|
80
|
+
@abstractmethod
|
|
81
|
+
def get_python_path(self) -> str | None:
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
@abstractmethod
|
|
85
|
+
def get_lib_path(self) -> str:
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
@abstractmethod
|
|
89
|
+
def remove_env(self):
|
|
90
|
+
pass
|
|
@@ -14,14 +14,22 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
+
import os
|
|
17
18
|
import shutil
|
|
18
19
|
import subprocess
|
|
20
|
+
import sys
|
|
19
21
|
import sysconfig
|
|
20
22
|
from pathlib import Path
|
|
21
23
|
from typing import Optional
|
|
22
24
|
|
|
23
25
|
from .core import VirtualEnvManager
|
|
24
26
|
|
|
27
|
+
UV_PATH = os.getenv("XOSCAR_UV_PATH")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _is_in_pyinstaller():
|
|
31
|
+
return hasattr(sys, "_MEIPASS")
|
|
32
|
+
|
|
25
33
|
|
|
26
34
|
class UVVirtualEnvManager(VirtualEnvManager):
|
|
27
35
|
def __init__(self, env_path: Path):
|
|
@@ -30,12 +38,21 @@ class UVVirtualEnvManager(VirtualEnvManager):
|
|
|
30
38
|
|
|
31
39
|
@classmethod
|
|
32
40
|
def is_available(cls):
|
|
41
|
+
if UV_PATH is not None:
|
|
42
|
+
# user specified uv, just treat it as existed
|
|
43
|
+
return True
|
|
33
44
|
return shutil.which("uv") is not None
|
|
34
45
|
|
|
35
46
|
def create_env(self, python_path: Path | None = None) -> None:
|
|
36
|
-
|
|
47
|
+
uv_path = UV_PATH or "uv"
|
|
48
|
+
cmd = [uv_path, "venv", str(self.env_path), "--system-site-packages"]
|
|
37
49
|
if python_path:
|
|
38
50
|
cmd += ["--python", str(python_path)]
|
|
51
|
+
elif _is_in_pyinstaller():
|
|
52
|
+
# in pyinstaller, uv would find the system python
|
|
53
|
+
# in this case we'd better specify the same python version
|
|
54
|
+
python_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
|
|
55
|
+
cmd += ["--python", python_version]
|
|
39
56
|
subprocess.run(cmd, check=True)
|
|
40
57
|
|
|
41
58
|
def install_packages(self, packages: list[str], **kwargs):
|
|
@@ -46,7 +63,12 @@ class UVVirtualEnvManager(VirtualEnvManager):
|
|
|
46
63
|
if not packages:
|
|
47
64
|
return
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
# extend the ability of pip
|
|
67
|
+
# maybe replace #system_torch# to the real version
|
|
68
|
+
packages = self.process_packages(packages)
|
|
69
|
+
|
|
70
|
+
uv_path = UV_PATH or "uv"
|
|
71
|
+
cmd = [uv_path, "pip", "install", "-p", str(self.env_path)] + packages
|
|
50
72
|
|
|
51
73
|
# Handle known pip-related kwargs
|
|
52
74
|
if "index_url" in kwargs and kwargs["index_url"]:
|
|
@@ -1,52 +0,0 @@
|
|
|
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_python_path(self) -> str | None:
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
@abstractmethod
|
|
47
|
-
def get_lib_path(self) -> str:
|
|
48
|
-
pass
|
|
49
|
-
|
|
50
|
-
@abstractmethod
|
|
51
|
-
def remove_env(self):
|
|
52
|
-
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|