omdev 0.0.0.dev186__py3-none-any.whl → 0.0.0.dev188__py3-none-any.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.
- omdev/interp/uv/provider.py +21 -0
- omdev/interp/uv/uv.py +60 -15
- omdev/tools/json/rendering.py +3 -3
- {omdev-0.0.0.dev186.dist-info → omdev-0.0.0.dev188.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev186.dist-info → omdev-0.0.0.dev188.dist-info}/RECORD +9 -8
- {omdev-0.0.0.dev186.dist-info → omdev-0.0.0.dev188.dist-info}/LICENSE +0 -0
- {omdev-0.0.0.dev186.dist-info → omdev-0.0.0.dev188.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev186.dist-info → omdev-0.0.0.dev188.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev186.dist-info → omdev-0.0.0.dev188.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# ruff: noqa: UP006 UP007
|
2
|
+
"""
|
3
|
+
uv run pip
|
4
|
+
uv run --python 3.11.6 pip
|
5
|
+
uv venv --python 3.11.6 --seed barf
|
6
|
+
python3 -m venv barf && barf/bin/pip install uv && barf/bin/uv venv --python 3.11.6 --seed barf2
|
7
|
+
"""
|
8
|
+
import typing as ta
|
9
|
+
|
10
|
+
from ..providers.base import InterpProvider
|
11
|
+
from ..types import Interp
|
12
|
+
from ..types import InterpSpecifier
|
13
|
+
from ..types import InterpVersion
|
14
|
+
|
15
|
+
|
16
|
+
class UvInterpProvider(InterpProvider):
|
17
|
+
def get_installed_versions(self, spec: InterpSpecifier) -> ta.Awaitable[ta.Sequence[InterpVersion]]:
|
18
|
+
raise NotImplementedError
|
19
|
+
|
20
|
+
def get_installed_version(self, version: InterpVersion) -> ta.Awaitable[Interp]:
|
21
|
+
raise NotImplementedError
|
omdev/interp/uv/uv.py
CHANGED
@@ -1,21 +1,66 @@
|
|
1
1
|
# ruff: noqa: UP006 UP007
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
import dataclasses as dc
|
3
|
+
import logging
|
4
|
+
import os.path
|
5
|
+
import shutil
|
6
|
+
import sys
|
7
|
+
import tempfile
|
8
8
|
import typing as ta
|
9
9
|
|
10
|
-
from
|
11
|
-
from
|
12
|
-
from
|
13
|
-
from ..types import InterpVersion
|
10
|
+
from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
|
11
|
+
from omlish.lite.cached import async_cached_nullary
|
12
|
+
from omlish.lite.check import check
|
14
13
|
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
@dc.dataclass(frozen=True)
|
16
|
+
class UvConfig:
|
17
|
+
ignore_path: bool = False
|
18
|
+
pip_bootstrap: bool = True
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
class Uv:
|
22
|
+
def __init__(
|
23
|
+
self,
|
24
|
+
config: UvConfig = UvConfig(),
|
25
|
+
*,
|
26
|
+
log: ta.Optional[logging.Logger] = None,
|
27
|
+
) -> None:
|
28
|
+
super().__init__()
|
29
|
+
|
30
|
+
self._config = config
|
31
|
+
self._log = log
|
32
|
+
|
33
|
+
self._bootstrap_dir: ta.Optional[str] = None
|
34
|
+
|
35
|
+
def delete_bootstrap_dir(self) -> bool:
|
36
|
+
if (bs := self._bootstrap_dir) is None:
|
37
|
+
return False
|
38
|
+
|
39
|
+
shutil.rmtree(bs)
|
40
|
+
self._bootstrap_dir = None
|
41
|
+
return True
|
42
|
+
|
43
|
+
@async_cached_nullary
|
44
|
+
async def uv_exe(self) -> ta.Optional[str]:
|
45
|
+
if not self._config.ignore_path and (uv := shutil.which('uv')):
|
46
|
+
return uv
|
47
|
+
|
48
|
+
if self._config.pip_bootstrap:
|
49
|
+
if (bd := self._bootstrap_dir) is None:
|
50
|
+
bd = self._bootstrap_dir = tempfile.mkdtemp()
|
51
|
+
|
52
|
+
if self._log is not None:
|
53
|
+
self._log.info(f'Bootstrapping uv into %s', bd)
|
54
|
+
|
55
|
+
vn = 'uv-bootstrap'
|
56
|
+
await asyncio_subprocesses.check_call(os.path.realpath(sys.executable), '-m', 'venv', vn, cwd=bd)
|
57
|
+
|
58
|
+
vx = os.path.join(bd, vn, 'bin', 'python3')
|
59
|
+
await asyncio_subprocesses.check_call(vx, '-m', 'pip', 'install', 'uv', cwd=bd)
|
60
|
+
|
61
|
+
ux = os.path.join(bd, vn, 'bin', 'uv')
|
62
|
+
check.state(os.path.isfile(ux))
|
63
|
+
|
64
|
+
return ux
|
65
|
+
|
66
|
+
return None
|
omdev/tools/json/rendering.py
CHANGED
@@ -3,10 +3,10 @@ import json
|
|
3
3
|
import typing as ta
|
4
4
|
|
5
5
|
from omlish import lang
|
6
|
-
from omlish import term
|
7
6
|
from omlish.formats.json.render import JsonRenderer
|
8
7
|
from omlish.formats.json.stream.parse import JsonStreamParserEvent
|
9
8
|
from omlish.formats.json.stream.render import StreamJsonRenderer
|
9
|
+
from omlish.term import codes as tc
|
10
10
|
|
11
11
|
|
12
12
|
##
|
@@ -43,9 +43,9 @@ class Renderer(lang.Abstract):
|
|
43
43
|
|
44
44
|
def term_color(o: ta.Any, state: JsonRenderer.State) -> tuple[str, str]:
|
45
45
|
if state is JsonRenderer.State.KEY:
|
46
|
-
return
|
46
|
+
return tc.SGR(tc.SGRs.FG.BRIGHT_BLUE), tc.SGR(tc.SGRs.RESET)
|
47
47
|
elif isinstance(o, str):
|
48
|
-
return
|
48
|
+
return tc.SGR(tc.SGRs.FG.GREEN), tc.SGR(tc.SGRs.RESET)
|
49
49
|
else:
|
50
50
|
return '', ''
|
51
51
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omdev
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev188
|
4
4
|
Summary: omdev
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
13
13
|
Requires-Python: >=3.12
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
15
|
+
Requires-Dist: omlish==0.0.0.dev188
|
16
16
|
Provides-Extra: all
|
17
17
|
Requires-Dist: black~=24.10; extra == "all"
|
18
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
@@ -102,7 +102,8 @@ omdev/interp/pyenv/provider.py,sha256=RvPWnT5Fpj85gYxfw9o8E4kNtgvM0AcXk8_7FUk7rT
|
|
102
102
|
omdev/interp/pyenv/pyenv.py,sha256=1Gt77di-lxeje9SnNYCWhYRo7CHdhTWZD0whvPanNP8,2643
|
103
103
|
omdev/interp/uv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
104
|
omdev/interp/uv/inject.py,sha256=3nHYu8qQMbV5iXdp-ItzNtfYE0zkIxrzmt7QdV7WiXU,314
|
105
|
-
omdev/interp/uv/
|
105
|
+
omdev/interp/uv/provider.py,sha256=_4EoNPv1pDK8d_r1z_eES1pEW6ci4UPvefYWGOWeSPg,668
|
106
|
+
omdev/interp/uv/uv.py,sha256=O1fArTkjwddVYyFe0hL1tB2TIUoCX8CD0FCRRfnD9T0,1773
|
106
107
|
omdev/magic/__init__.py,sha256=CBzRB71RLyylkrj8dph6JUEddA8KSMJvDgriHqFfJGU,478
|
107
108
|
omdev/magic/__main__.py,sha256=1_BAKDtA6Rn5hswyl4S5J78BPRbynX4is_wQsD0U7jI,161
|
108
109
|
omdev/magic/cli.py,sha256=puL5Snnc-i9Dpa3AU8DtaCp5qUd_7RXwv-qWU_B2fa8,1184
|
@@ -176,13 +177,13 @@ omdev/tools/json/formats.py,sha256=XHabWAQnAQ9uNS7fHu3mdgxoptWw00RVLq08uadD6kk,1
|
|
176
177
|
omdev/tools/json/io.py,sha256=sfj2hJS9Hy3aUR8a_lLzOrYcmL9fSKyvOHiofdUASsI,1427
|
177
178
|
omdev/tools/json/parsing.py,sha256=YOeTRY6Gd89EfcHvqXO5PRWJ3IgRCpNnI54Lb_N3v2k,2183
|
178
179
|
omdev/tools/json/processing.py,sha256=iFm5VqaxJ97WHaun2ed7NEjMxhFeJqf28bLNfoDJft0,1209
|
179
|
-
omdev/tools/json/rendering.py,sha256=
|
180
|
+
omdev/tools/json/rendering.py,sha256=tMcjOW5edfozcMSTxxvF7WVTsbYLoe9bCKFh50qyaGw,2236
|
180
181
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
181
182
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
182
183
|
omdev/tools/pawk/pawk.py,sha256=Eckymn22GfychCQcQi96BFqRo_LmiJ-EPhC8TTUJdB4,11446
|
183
|
-
omdev-0.0.0.
|
184
|
-
omdev-0.0.0.
|
185
|
-
omdev-0.0.0.
|
186
|
-
omdev-0.0.0.
|
187
|
-
omdev-0.0.0.
|
188
|
-
omdev-0.0.0.
|
184
|
+
omdev-0.0.0.dev188.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
185
|
+
omdev-0.0.0.dev188.dist-info/METADATA,sha256=cjKh_dFXi5T7txrXI8xzK1sTpgYVo3kY1dxENbUnhsE,1760
|
186
|
+
omdev-0.0.0.dev188.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
187
|
+
omdev-0.0.0.dev188.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
188
|
+
omdev-0.0.0.dev188.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
189
|
+
omdev-0.0.0.dev188.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|