py-rattler 0.12.0__cp38-abi3-musllinux_1_2_aarch64.whl → 0.13.1__cp38-abi3-musllinux_1_2_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 py-rattler might be problematic. Click here for more details.
- {py_rattler-0.12.0.dist-info → py_rattler-0.13.1.dist-info}/METADATA +1 -1
- {py_rattler-0.12.0.dist-info → py_rattler-0.13.1.dist-info}/RECORD +9 -9
- rattler/__init__.py +2 -0
- rattler/prefix/prefix_paths.py +9 -9
- rattler/rattler.abi3.so +0 -0
- rattler/repo_data/__init__.py +2 -1
- rattler/repo_data/sparse.py +198 -19
- rattler/solver/solver.py +6 -1
- {py_rattler-0.12.0.dist-info → py_rattler-0.13.1.dist-info}/WHEEL +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
py_rattler-0.
|
|
2
|
-
py_rattler-0.
|
|
1
|
+
py_rattler-0.13.1.dist-info/METADATA,sha256=Rr2E94GLr-7_oXjqHW3XgP-l7kYHLgw2GobYO7YE6zA,7910
|
|
2
|
+
py_rattler-0.13.1.dist-info/WHEEL,sha256=fCr-HkpmK0KVXiZv7weieXzHvjoHuHQ_a-g-zPeQr24,106
|
|
3
3
|
rattler.libs/libgcc_s-e52197c3.so.1,sha256=vkPW1Auw6CH9Bjk7frmX3hry_1H9c0tRI0Ncyg71WUI,724137
|
|
4
4
|
rattler/package_streaming/__init__.py,sha256=I-mbr0sJnHzdFQP8v0Yb_GKpu4bIO3JbAJtq_wzA71Q,898
|
|
5
5
|
rattler/solver/__init__.py,sha256=NZabrelb_pcqOi5PyZTr3OeBbjd85IqW1-2ymOBO-k0,119
|
|
6
|
-
rattler/solver/solver.py,sha256=
|
|
6
|
+
rattler/solver/solver.py,sha256=EEF86vA-ryVuBmq5uOomgzPq1BGXsNcAhJvf7JKVVDQ,11259
|
|
7
7
|
rattler/explicit_environment/__init__.py,sha256=QHmwZkdVt-tFL-tEEdhLdH3apuI5F7ElpMzCRZeH3_o,170
|
|
8
8
|
rattler/explicit_environment/environment.py,sha256=Dqcvm5c7C3K0FJ04YVN8WIUrl0R8Fe2TeXZ4Qq8Dg-0,2641
|
|
9
9
|
rattler/match_spec/__init__.py,sha256=uBV3ov1VlCIZlIWhkxxMPcTqRBF5p5lqvT2g6kQv5kQ,167
|
|
@@ -17,15 +17,15 @@ rattler/lock/environment.py,sha256=sbcGqkb9rrGwpVCucDKkwdp2SFOyHZQGqvBArGEZFYs,7
|
|
|
17
17
|
rattler/lock/channel.py,sha256=PaLb-vWRLTJWUx7fyMdP2Tow5wMlGuq3WUrHkrQIzeg,1331
|
|
18
18
|
rattler/prefix/prefix_record.py,sha256=KWbjcBJO-KpdWz2VEYdlz_RPLpLByyaec0aViILi_EM,6290
|
|
19
19
|
rattler/prefix/__init__.py,sha256=gkgyqZ0yTmxOCW8DHuSG-X0spEzb8BIoiox8YG50XYc,257
|
|
20
|
-
rattler/prefix/prefix_paths.py,sha256=
|
|
20
|
+
rattler/prefix/prefix_paths.py,sha256=B0EwOFkVbSzuLChdjkjenTehfxjXwwMBIodSGOfBHFU,12828
|
|
21
21
|
rattler/platform/arch.py,sha256=7tanyDql5BvDvY9UryEXyTJ9nWRfx6bn7BWrl6fGEfI,1145
|
|
22
22
|
rattler/platform/__init__.py,sha256=YZaXxnJmG_WjYbhIAxA0jQDhaPYAR4rTVQCm4yRoyZQ,154
|
|
23
23
|
rattler/platform/platform.py,sha256=H_P35Z0irNiyQX2fxX7ombMkGwyYa-Ow_iDIDxJrmG8,4395
|
|
24
|
-
rattler/__init__.py,sha256=
|
|
24
|
+
rattler/__init__.py,sha256=QKjBUll9mX4TVwJy-dy5Gt8IezLnJz8EPTlKhOsw2IA,2476
|
|
25
25
|
rattler/repo_data/gateway.py,sha256=G9CTfz6Qc84Wo3QJSxWjsCH79WOohSxxUxYwKiss8ng,10141
|
|
26
|
-
rattler/repo_data/sparse.py,sha256
|
|
26
|
+
rattler/repo_data/sparse.py,sha256=qO3XuIfvcDEfo8mHu8UB9JBoz0IR3k_kNR32ZTpbPWU,12542
|
|
27
27
|
rattler/repo_data/package_record.py,sha256=t8vxRsfAToIolhBRjt9lB4e5Q7Tm-FjZHUI9vhxd-eA,28358
|
|
28
|
-
rattler/repo_data/__init__.py,sha256=
|
|
28
|
+
rattler/repo_data/__init__.py,sha256=cMoMtFOJBGonfWxizGphWpXdQ1GYXDXos7ESYigfco8,549
|
|
29
29
|
rattler/repo_data/repo_data.py,sha256=lB7hQ1SN5b2VxuOaOH1BOFeIXbRUf2fslitLyT5aVwo,2264
|
|
30
30
|
rattler/repo_data/patch_instructions.py,sha256=TNa7NgLtqGQ6lSpibLFxuPFwsmqRLrORpDZOpeZ5fnk,694
|
|
31
31
|
rattler/repo_data/record.py,sha256=6CK2-KyvVZ8kaZ2l-o4DFWivxMJE_ChkOrm97bmIjn4,4572
|
|
@@ -59,5 +59,5 @@ rattler/channel/__init__.py,sha256=K-ZAo0qFzchXWP-6DpMHLg_djGD25-0CRwusisIGp8k,2
|
|
|
59
59
|
rattler/channel/channel_config.py,sha256=rRD4dGeHTBIcm3vTuQR1wTGTELNdN69yq4lyCaTaN3M,1532
|
|
60
60
|
rattler/channel/channel_priority.py,sha256=OQfCHp_DeInkMB0YahCf2X7yCk0_RtM_C_Vy4Ny-65M,474
|
|
61
61
|
rattler/channel/channel.py,sha256=kGeZKa_YkSM943CA1i_8O1FXG9kS9hkrnmSl6OhkbbQ,2474
|
|
62
|
-
rattler/rattler.abi3.so,sha256=
|
|
63
|
-
py_rattler-0.
|
|
62
|
+
rattler/rattler.abi3.so,sha256=H7Bd4U-zcac70FHZRqFR7XNnhjnEfXyTB0Ce8SZUkqI,43062305
|
|
63
|
+
py_rattler-0.13.1.dist-info/RECORD,,
|
rattler/__init__.py
CHANGED
|
@@ -8,6 +8,7 @@ from rattler.repo_data import (
|
|
|
8
8
|
SparseRepoData,
|
|
9
9
|
Gateway,
|
|
10
10
|
SourceConfig,
|
|
11
|
+
PackageFormatSelection,
|
|
11
12
|
)
|
|
12
13
|
from rattler.channel import Channel, ChannelConfig, ChannelPriority
|
|
13
14
|
from rattler.networking import Client, fetch_repo_data
|
|
@@ -70,6 +71,7 @@ __all__ = [
|
|
|
70
71
|
"PrefixPathsEntry",
|
|
71
72
|
"PrefixPathType",
|
|
72
73
|
"SparseRepoData",
|
|
74
|
+
"PackageFormatSelection",
|
|
73
75
|
"LockFile",
|
|
74
76
|
"Environment",
|
|
75
77
|
"LockChannel",
|
rattler/prefix/prefix_paths.py
CHANGED
|
@@ -22,9 +22,9 @@ class PrefixPathType:
|
|
|
22
22
|
"softlink",
|
|
23
23
|
"directory",
|
|
24
24
|
"pyc_file",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"windows_python_entry_point_script",
|
|
26
|
+
"windows_python_entry_point_exe",
|
|
27
|
+
"unix_python_entry_point",
|
|
28
28
|
],
|
|
29
29
|
) -> None:
|
|
30
30
|
"""
|
|
@@ -82,25 +82,25 @@ class PrefixPathType:
|
|
|
82
82
|
return self._inner.pyc_file
|
|
83
83
|
|
|
84
84
|
@property
|
|
85
|
-
def
|
|
85
|
+
def windows_python_entry_point_script(self) -> bool:
|
|
86
86
|
"""
|
|
87
87
|
A Windows entry point python script (a <entrypoint>-script.py Python script file)
|
|
88
88
|
"""
|
|
89
|
-
return self._inner.
|
|
89
|
+
return self._inner.windows_python_entry_point_script
|
|
90
90
|
|
|
91
91
|
@property
|
|
92
|
-
def
|
|
92
|
+
def windows_python_entry_point_exe(self) -> bool:
|
|
93
93
|
"""
|
|
94
94
|
A Windows entry point python script (a <entrypoint>.exe executable)
|
|
95
95
|
"""
|
|
96
|
-
return self._inner.
|
|
96
|
+
return self._inner.windows_python_entry_point_exe
|
|
97
97
|
|
|
98
98
|
@property
|
|
99
|
-
def
|
|
99
|
+
def unix_python_entry_point(self) -> bool:
|
|
100
100
|
"""
|
|
101
101
|
A Unix entry point python script (a <entrypoint> Python script file)
|
|
102
102
|
"""
|
|
103
|
-
return self._inner.
|
|
103
|
+
return self._inner.unix_python_entry_point
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
class PrefixPathsEntry(BasePathLike):
|
rattler/rattler.abi3.so
CHANGED
|
Binary file
|
rattler/repo_data/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@ from rattler.repo_data.package_record import PackageRecord
|
|
|
2
2
|
from rattler.repo_data.repo_data import RepoData
|
|
3
3
|
from rattler.repo_data.patch_instructions import PatchInstructions
|
|
4
4
|
from rattler.repo_data.record import RepoDataRecord
|
|
5
|
-
from rattler.repo_data.sparse import SparseRepoData
|
|
5
|
+
from rattler.repo_data.sparse import SparseRepoData, PackageFormatSelection
|
|
6
6
|
from rattler.repo_data.gateway import Gateway, SourceConfig
|
|
7
7
|
|
|
8
8
|
__all__ = [
|
|
@@ -13,4 +13,5 @@ __all__ = [
|
|
|
13
13
|
"SparseRepoData",
|
|
14
14
|
"Gateway",
|
|
15
15
|
"SourceConfig",
|
|
16
|
+
"PackageFormatSelection",
|
|
16
17
|
]
|
rattler/repo_data/sparse.py
CHANGED
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
import os
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import List
|
|
4
|
+
from typing import List, Optional, Type, Literal, Iterable
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
|
|
7
|
+
from rattler.match_spec.match_spec import MatchSpec
|
|
5
8
|
from rattler.channel.channel import Channel
|
|
6
9
|
from rattler.package.package_name import PackageName
|
|
10
|
+
from enum import Enum
|
|
7
11
|
|
|
8
|
-
from rattler.rattler import PySparseRepoData
|
|
12
|
+
from rattler.rattler import PySparseRepoData, PyPackageFormatSelection
|
|
9
13
|
from rattler.repo_data.record import RepoDataRecord
|
|
10
14
|
|
|
11
15
|
|
|
16
|
+
class PackageFormatSelection(Enum):
|
|
17
|
+
"""
|
|
18
|
+
Enum that describes what to do if both a `.tar.bz2` and a `.conda` package is available.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
ONLY_TAR_BZ2 = PyPackageFormatSelection.OnlyTarBz2
|
|
22
|
+
"""
|
|
23
|
+
Only use the `.tar.bz2` packages, ignore all `.conda` packages.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
ONLY_CONDA = PyPackageFormatSelection.OnlyConda
|
|
27
|
+
"""
|
|
28
|
+
Only use the `.conda` packages, ignore all `.tar.bz2` packages.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
PREFER_CONDA = PyPackageFormatSelection.PreferConda
|
|
32
|
+
"""
|
|
33
|
+
Only use the `.conda` packages if there are both a `.tar.bz2` and a `.conda` package available.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
BOTH = PyPackageFormatSelection.Both
|
|
37
|
+
"""
|
|
38
|
+
Use both the `.tar.bz2` and the `.conda` packages.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
|
|
12
42
|
class SparseRepoData:
|
|
13
43
|
"""
|
|
14
44
|
A class to enable loading records from a `repodata.json` file on demand.
|
|
@@ -39,7 +69,43 @@ class SparseRepoData:
|
|
|
39
69
|
)
|
|
40
70
|
self._sparse = PySparseRepoData(channel._channel, subdir, str(path))
|
|
41
71
|
|
|
42
|
-
def
|
|
72
|
+
def close(self) -> None:
|
|
73
|
+
"""
|
|
74
|
+
Closes any mapped resources associated with this `SparseRepoData`
|
|
75
|
+
instance. It is good practice to call this method when you are done
|
|
76
|
+
with it. This is especially important if you want to modify or delete
|
|
77
|
+
the file from which this instance was created.
|
|
78
|
+
|
|
79
|
+
This method will release all resources associated with this instance,
|
|
80
|
+
including those that are currently being used on another thread. This
|
|
81
|
+
method will block until all resources are released.
|
|
82
|
+
|
|
83
|
+
This method has no effect if the file is already closed. Once the
|
|
84
|
+
instance is closed, any operation on the instance will raise a
|
|
85
|
+
`ValueError`.
|
|
86
|
+
|
|
87
|
+
As a convenience, it is allowed to call this method more than once;
|
|
88
|
+
only the first call, however, will have an effect.
|
|
89
|
+
|
|
90
|
+
Examples
|
|
91
|
+
--------
|
|
92
|
+
```python
|
|
93
|
+
>>> from rattler import Channel, ChannelConfig
|
|
94
|
+
>>> channel = Channel("dummy", ChannelConfig())
|
|
95
|
+
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
96
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
97
|
+
>>> sparse_data.close()
|
|
98
|
+
>>> sparse_data.package_names() # doctest: +IGNORE_EXCEPTION_DETAIL
|
|
99
|
+
Traceback (most recent call last):
|
|
100
|
+
ValueError: I/O operation on closed file.
|
|
101
|
+
>>>
|
|
102
|
+
```
|
|
103
|
+
"""
|
|
104
|
+
self._sparse.close()
|
|
105
|
+
|
|
106
|
+
def package_names(
|
|
107
|
+
self, package_format_selection: PackageFormatSelection = PackageFormatSelection.PREFER_CONDA
|
|
108
|
+
) -> List[str]:
|
|
43
109
|
"""
|
|
44
110
|
Returns a list over all package names in this repodata file.
|
|
45
111
|
This works by iterating over all elements in the `packages` and
|
|
@@ -51,9 +117,8 @@ class SparseRepoData:
|
|
|
51
117
|
```python
|
|
52
118
|
>>> from rattler import Channel, ChannelConfig
|
|
53
119
|
>>> channel = Channel("dummy", ChannelConfig())
|
|
54
|
-
>>> subdir = "test-data/dummy/noarch"
|
|
55
120
|
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
56
|
-
>>> sparse_data = SparseRepoData(channel,
|
|
121
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
57
122
|
>>> package_names = sparse_data.package_names()
|
|
58
123
|
>>> package_names
|
|
59
124
|
[...]
|
|
@@ -62,9 +127,22 @@ class SparseRepoData:
|
|
|
62
127
|
>>>
|
|
63
128
|
```
|
|
64
129
|
"""
|
|
65
|
-
return self._sparse.package_names()
|
|
130
|
+
return self._sparse.package_names(package_format_selection.value)
|
|
131
|
+
|
|
132
|
+
def record_count(
|
|
133
|
+
self, package_format_selection: PackageFormatSelection = PackageFormatSelection.PREFER_CONDA
|
|
134
|
+
) -> int:
|
|
135
|
+
"""
|
|
136
|
+
Returns the total number of packages in this repodata file.
|
|
137
|
+
:return:
|
|
138
|
+
"""
|
|
139
|
+
return self._sparse.record_count(package_format_selection.value)
|
|
66
140
|
|
|
67
|
-
def load_records(
|
|
141
|
+
def load_records(
|
|
142
|
+
self,
|
|
143
|
+
package_name: str | PackageName,
|
|
144
|
+
package_format_selection: PackageFormatSelection = PackageFormatSelection.PREFER_CONDA,
|
|
145
|
+
) -> List[RepoDataRecord]:
|
|
68
146
|
"""
|
|
69
147
|
Returns all the records for the specified package name.
|
|
70
148
|
|
|
@@ -73,9 +151,8 @@ class SparseRepoData:
|
|
|
73
151
|
```python
|
|
74
152
|
>>> from rattler import Channel, ChannelConfig, RepoDataRecord, PackageName
|
|
75
153
|
>>> channel = Channel("dummy", ChannelConfig())
|
|
76
|
-
>>> subdir = "test-data/dummy/noarch"
|
|
77
154
|
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
78
|
-
>>> sparse_data = SparseRepoData(channel,
|
|
155
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
79
156
|
>>> package_name = PackageName(sparse_data.package_names()[0])
|
|
80
157
|
>>> records = sparse_data.load_records(package_name)
|
|
81
158
|
>>> records
|
|
@@ -85,8 +162,66 @@ class SparseRepoData:
|
|
|
85
162
|
>>>
|
|
86
163
|
```
|
|
87
164
|
"""
|
|
165
|
+
if not isinstance(package_name, PackageName):
|
|
166
|
+
package_name = PackageName(package_name)
|
|
167
|
+
return [
|
|
168
|
+
RepoDataRecord._from_py_record(record)
|
|
169
|
+
for record in self._sparse.load_records(package_name._name, package_format_selection.value)
|
|
170
|
+
]
|
|
171
|
+
|
|
172
|
+
def load_all_records(
|
|
173
|
+
self, package_format_selection: PackageFormatSelection = PackageFormatSelection.PREFER_CONDA
|
|
174
|
+
) -> List[RepoDataRecord]:
|
|
175
|
+
"""
|
|
176
|
+
Returns all the records for the specified package name.
|
|
177
|
+
|
|
178
|
+
Examples
|
|
179
|
+
--------
|
|
180
|
+
```python
|
|
181
|
+
>>> from rattler import Channel, ChannelConfig, RepoDataRecord, PackageName
|
|
182
|
+
>>> channel = Channel("dummy", ChannelConfig())
|
|
183
|
+
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
184
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
185
|
+
>>> records = sparse_data.load_all_records()
|
|
186
|
+
>>> records
|
|
187
|
+
[...]
|
|
188
|
+
>>> isinstance(records[0], RepoDataRecord)
|
|
189
|
+
True
|
|
190
|
+
>>>
|
|
191
|
+
```
|
|
192
|
+
"""
|
|
88
193
|
# maybe change package_name to Union[str, PackageName]
|
|
89
|
-
return [
|
|
194
|
+
return [
|
|
195
|
+
RepoDataRecord._from_py_record(record)
|
|
196
|
+
for record in self._sparse.load_all_records(package_format_selection.value)
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
def load_matching_records(
|
|
200
|
+
self,
|
|
201
|
+
specs: Iterable[MatchSpec],
|
|
202
|
+
package_format_selection: PackageFormatSelection = PackageFormatSelection.PREFER_CONDA,
|
|
203
|
+
) -> List[RepoDataRecord]:
|
|
204
|
+
"""
|
|
205
|
+
Returns all the records that match any of the specified MatchSpecs.
|
|
206
|
+
|
|
207
|
+
Examples
|
|
208
|
+
--------
|
|
209
|
+
```python
|
|
210
|
+
>>> from rattler import Channel, ChannelConfig, RepoDataRecord, PackageName
|
|
211
|
+
>>> channel = Channel("dummy", ChannelConfig())
|
|
212
|
+
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
213
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
214
|
+
>>> [record.file_name for record in sparse_data.load_matching_records([MatchSpec("* 12.5")])]
|
|
215
|
+
['cuda-version-12.5-hd4f0392_3.conda']
|
|
216
|
+
>>>
|
|
217
|
+
```
|
|
218
|
+
"""
|
|
219
|
+
return [
|
|
220
|
+
RepoDataRecord._from_py_record(record)
|
|
221
|
+
for record in self._sparse.load_matching_records(
|
|
222
|
+
[spec._match_spec for spec in specs], package_format_selection.value
|
|
223
|
+
)
|
|
224
|
+
]
|
|
90
225
|
|
|
91
226
|
@property
|
|
92
227
|
def subdir(self) -> str:
|
|
@@ -98,11 +233,10 @@ class SparseRepoData:
|
|
|
98
233
|
```python
|
|
99
234
|
>>> from rattler import Channel, ChannelConfig
|
|
100
235
|
>>> channel = Channel("dummy", ChannelConfig())
|
|
101
|
-
>>> subdir = "test-data/dummy/noarch"
|
|
102
236
|
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
103
|
-
>>> sparse_data = SparseRepoData(channel,
|
|
237
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
104
238
|
>>> sparse_data.subdir
|
|
105
|
-
'
|
|
239
|
+
'linux-64'
|
|
106
240
|
>>>
|
|
107
241
|
```
|
|
108
242
|
"""
|
|
@@ -112,6 +246,7 @@ class SparseRepoData:
|
|
|
112
246
|
def load_records_recursive(
|
|
113
247
|
repo_data: List[SparseRepoData],
|
|
114
248
|
package_names: List[PackageName],
|
|
249
|
+
package_format_selection: PackageFormatSelection = PackageFormatSelection.PREFER_CONDA,
|
|
115
250
|
) -> List[List[RepoDataRecord]]:
|
|
116
251
|
"""
|
|
117
252
|
Given a set of [`SparseRepoData`]s load all the records
|
|
@@ -127,7 +262,7 @@ class SparseRepoData:
|
|
|
127
262
|
>>> channel = Channel("dummy")
|
|
128
263
|
>>> subdir = "test-data/dummy/linux-64"
|
|
129
264
|
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
130
|
-
>>> sparse_data = SparseRepoData(channel,
|
|
265
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
131
266
|
>>> package_name = PackageName("python")
|
|
132
267
|
>>> SparseRepoData.load_records_recursive([sparse_data], [package_name])
|
|
133
268
|
[...]
|
|
@@ -137,8 +272,7 @@ class SparseRepoData:
|
|
|
137
272
|
return [
|
|
138
273
|
[RepoDataRecord._from_py_record(record) for record in list_of_records]
|
|
139
274
|
for list_of_records in PySparseRepoData.load_records_recursive(
|
|
140
|
-
[r._sparse for r in repo_data],
|
|
141
|
-
[p._name for p in package_names],
|
|
275
|
+
[r._sparse for r in repo_data], [p._name for p in package_names], package_format_selection.value
|
|
142
276
|
)
|
|
143
277
|
]
|
|
144
278
|
|
|
@@ -160,12 +294,57 @@ class SparseRepoData:
|
|
|
160
294
|
```python
|
|
161
295
|
>>> from rattler import Channel, ChannelConfig
|
|
162
296
|
>>> channel = Channel("dummy", ChannelConfig())
|
|
163
|
-
>>> subdir = "test-data/dummy/noarch"
|
|
164
297
|
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
165
|
-
>>> sparse_data = SparseRepoData(channel,
|
|
298
|
+
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
|
|
166
299
|
>>> sparse_data
|
|
167
|
-
SparseRepoData(subdir="
|
|
300
|
+
SparseRepoData(subdir="linux-64")
|
|
168
301
|
>>>
|
|
169
302
|
```
|
|
170
303
|
"""
|
|
171
304
|
return f'SparseRepoData(subdir="{self.subdir}")'
|
|
305
|
+
|
|
306
|
+
def __enter__(self) -> SparseRepoData:
|
|
307
|
+
"""
|
|
308
|
+
Returns the `SparseRepoData` instance itself. This is used to
|
|
309
|
+
enable the use of the `with` statement to automatically close
|
|
310
|
+
the instance when done.
|
|
311
|
+
|
|
312
|
+
Examples
|
|
313
|
+
--------
|
|
314
|
+
```python
|
|
315
|
+
>>> from rattler import Channel, ChannelConfig
|
|
316
|
+
>>> channel = Channel("dummy", ChannelConfig())
|
|
317
|
+
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
318
|
+
>>> with SparseRepoData(channel, "linux-64", path) as sparse_data:
|
|
319
|
+
... print(sparse_data)
|
|
320
|
+
...
|
|
321
|
+
SparseRepoData(subdir="linux-64")
|
|
322
|
+
>>>
|
|
323
|
+
```
|
|
324
|
+
"""
|
|
325
|
+
return self
|
|
326
|
+
|
|
327
|
+
def __exit__(
|
|
328
|
+
self,
|
|
329
|
+
exctype: Optional[Type[BaseException]],
|
|
330
|
+
excinst: Optional[BaseException],
|
|
331
|
+
exctb: Optional[TracebackType],
|
|
332
|
+
) -> Literal[False]:
|
|
333
|
+
"""
|
|
334
|
+
Closes the `SparseRepoData` instance when exiting the `with` statement.
|
|
335
|
+
|
|
336
|
+
Examples
|
|
337
|
+
--------
|
|
338
|
+
```python
|
|
339
|
+
>>> from rattler import Channel, ChannelConfig
|
|
340
|
+
>>> channel = Channel("dummy", ChannelConfig())
|
|
341
|
+
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
|
|
342
|
+
>>> with SparseRepoData(channel, "linux-64", path) as sparse_data:
|
|
343
|
+
... print(sparse_data)
|
|
344
|
+
...
|
|
345
|
+
SparseRepoData(subdir="linux-64")
|
|
346
|
+
>>>
|
|
347
|
+
```
|
|
348
|
+
"""
|
|
349
|
+
self.close()
|
|
350
|
+
return False
|
rattler/solver/solver.py
CHANGED
|
@@ -6,7 +6,7 @@ from rattler import Channel, Platform, VirtualPackage, SparseRepoData
|
|
|
6
6
|
from rattler.match_spec.match_spec import MatchSpec
|
|
7
7
|
|
|
8
8
|
from rattler.channel import ChannelPriority
|
|
9
|
-
from rattler.rattler import py_solve, PyMatchSpec, py_solve_with_sparse_repodata
|
|
9
|
+
from rattler.rattler import py_solve, PyMatchSpec, py_solve_with_sparse_repodata, PyPackageFormatSelection
|
|
10
10
|
|
|
11
11
|
from rattler.platform.platform import PlatformLiteral
|
|
12
12
|
from rattler.repo_data.gateway import Gateway
|
|
@@ -127,6 +127,7 @@ async def solve_with_sparse_repodata(
|
|
|
127
127
|
exclude_newer: Optional[datetime.datetime] = None,
|
|
128
128
|
strategy: SolveStrategy = "highest",
|
|
129
129
|
constraints: Optional[Sequence[MatchSpec | str]] = None,
|
|
130
|
+
use_only_tar_bz2: bool = False,
|
|
130
131
|
) -> List[RepoDataRecord]:
|
|
131
132
|
"""
|
|
132
133
|
Resolve the dependencies and return the `RepoDataRecord`s
|
|
@@ -171,6 +172,7 @@ async def solve_with_sparse_repodata(
|
|
|
171
172
|
constraints: Additional constraints that should be satisfied by the solver.
|
|
172
173
|
Packages included in the `constraints` are not necessarily installed,
|
|
173
174
|
but they must be satisfied by the solution.
|
|
175
|
+
use_only_tar_bz2: If `True` only `.tar.bz2` packages are used. If `False` `.conda` packages are preferred.
|
|
174
176
|
|
|
175
177
|
Returns:
|
|
176
178
|
Resolved list of `RepoDataRecord`s.
|
|
@@ -191,6 +193,9 @@ async def solve_with_sparse_repodata(
|
|
|
191
193
|
],
|
|
192
194
|
channel_priority=channel_priority.value,
|
|
193
195
|
timeout=int(timeout / datetime.timedelta(microseconds=1)) if timeout else None,
|
|
196
|
+
package_format_selection=PyPackageFormatSelection.OnlyTarBz2
|
|
197
|
+
if use_only_tar_bz2
|
|
198
|
+
else PyPackageFormatSelection.PreferConda,
|
|
194
199
|
exclude_newer_timestamp_ms=int(exclude_newer.replace(tzinfo=datetime.timezone.utc).timestamp() * 1000)
|
|
195
200
|
if exclude_newer
|
|
196
201
|
else None,
|
|
File without changes
|