ominfra 0.0.0.dev315__py3-none-any.whl → 0.0.0.dev488__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.
Files changed (131) hide show
  1. ominfra/{.manifests.json → .omlish-manifests.json} +6 -6
  2. ominfra/__about__.py +5 -2
  3. ominfra/clouds/aws/auth.py +2 -1
  4. ominfra/clouds/aws/cli.py +3 -0
  5. ominfra/clouds/aws/dataclasses.py +4 -1
  6. ominfra/clouds/aws/instancetypes/cache.json.gz +0 -0
  7. ominfra/clouds/aws/instancetypes/cache.py +3 -0
  8. ominfra/clouds/aws/instancetypes/cli.py +4 -1
  9. ominfra/clouds/aws/journald2aws/cursor.py +9 -2
  10. ominfra/clouds/aws/journald2aws/driver.py +5 -2
  11. ominfra/clouds/aws/journald2aws/main.py +3 -0
  12. ominfra/clouds/aws/journald2aws/poster.py +9 -2
  13. ominfra/clouds/aws/logs.py +1 -1
  14. ominfra/clouds/aws/metadata.py +3 -0
  15. ominfra/clouds/aws/models/{base.py → base/__init__.py} +7 -2
  16. ominfra/clouds/aws/models/base/_dataclasses.py +721 -0
  17. ominfra/clouds/aws/models/gen/cli.py +2 -1
  18. ominfra/clouds/aws/models/gen/gen.py +16 -7
  19. ominfra/clouds/aws/models/services/{ec2.py → ec2/__init__.py} +438 -1
  20. ominfra/clouds/aws/models/services/ec2/_dataclasses.py +30654 -0
  21. ominfra/clouds/aws/models/services/{lambda_.py → lambda_/__init__.py} +139 -1
  22. ominfra/clouds/aws/models/services/lambda_/_dataclasses.py +4182 -0
  23. ominfra/clouds/aws/models/services/{rds.py → rds/__init__.py} +254 -78
  24. ominfra/clouds/aws/models/services/rds/_dataclasses.py +8231 -0
  25. ominfra/clouds/aws/models/services/{s3.py → s3/__init__.py} +19 -1
  26. ominfra/clouds/aws/models/services/s3/_dataclasses.py +5014 -0
  27. ominfra/clouds/gcp/auth.py +3 -0
  28. ominfra/commands/runners.py +2 -0
  29. ominfra/commands/ssh.py +3 -0
  30. ominfra/journald/genmessages.py +3 -0
  31. ominfra/journald/messages.py +8 -2
  32. ominfra/journald/tailer.py +17 -11
  33. ominfra/manage/bootstrap.py +4 -1
  34. ominfra/manage/bootstrap_.py +4 -1
  35. ominfra/manage/commands/base.py +8 -7
  36. ominfra/manage/commands/inject.py +1 -1
  37. ominfra/manage/commands/injection.py +4 -1
  38. ominfra/manage/commands/local.py +4 -1
  39. ominfra/manage/commands/marshal.py +3 -0
  40. ominfra/manage/commands/subprocess.py +43 -5
  41. ominfra/manage/commands/types.py +1 -1
  42. ominfra/manage/config.py +4 -1
  43. ominfra/manage/deploy/apps.py +4 -1
  44. ominfra/manage/deploy/commands.py +5 -2
  45. ominfra/manage/deploy/conf/inject.py +4 -1
  46. ominfra/manage/deploy/conf/manager.py +1 -1
  47. ominfra/manage/deploy/conf/specs.py +3 -3
  48. ominfra/manage/deploy/config.py +1 -1
  49. ominfra/manage/deploy/deploy.py +1 -1
  50. ominfra/manage/deploy/git.py +1 -1
  51. ominfra/manage/deploy/inject.py +1 -1
  52. ominfra/manage/deploy/injection.py +4 -1
  53. ominfra/manage/deploy/interp.py +1 -1
  54. ominfra/manage/deploy/nginx.py +4 -1
  55. ominfra/manage/deploy/paths/inject.py +4 -1
  56. ominfra/manage/deploy/paths/manager.py +4 -1
  57. ominfra/manage/deploy/paths/owners.py +7 -3
  58. ominfra/manage/deploy/paths/paths.py +5 -4
  59. ominfra/manage/deploy/paths/specs.py +4 -1
  60. ominfra/manage/deploy/paths/types.py +1 -1
  61. ominfra/manage/deploy/specs.py +1 -1
  62. ominfra/manage/deploy/systemd.py +4 -1
  63. ominfra/manage/deploy/tags.py +9 -9
  64. ominfra/manage/deploy/tmp.py +4 -1
  65. ominfra/manage/deploy/venvs.py +4 -1
  66. ominfra/manage/inject.py +3 -2
  67. ominfra/manage/main.py +10 -5
  68. ominfra/manage/marshal.py +3 -0
  69. ominfra/manage/remote/_main.py +6 -2
  70. ominfra/manage/remote/channel.py +3 -2
  71. ominfra/manage/remote/config.py +4 -1
  72. ominfra/manage/remote/connection.py +1 -1
  73. ominfra/manage/remote/execution.py +11 -7
  74. ominfra/manage/remote/inject.py +4 -1
  75. ominfra/manage/remote/payload.py +4 -1
  76. ominfra/manage/remote/spawning.py +3 -2
  77. ominfra/manage/system/commands.py +5 -2
  78. ominfra/manage/system/config.py +4 -1
  79. ominfra/manage/system/inject.py +4 -1
  80. ominfra/manage/system/packages.py +7 -3
  81. ominfra/manage/system/platforms.py +7 -4
  82. ominfra/manage/targets/bestpython.py +3 -0
  83. ominfra/manage/targets/bestpython.sh +1 -1
  84. ominfra/manage/targets/connection.py +3 -2
  85. ominfra/manage/targets/inject.py +4 -1
  86. ominfra/manage/targets/targets.py +6 -6
  87. ominfra/pyremote.py +10 -4
  88. ominfra/scripts/journald2aws.py +5086 -2409
  89. ominfra/scripts/manage.py +10770 -7455
  90. ominfra/scripts/supervisor.py +6823 -3829
  91. ominfra/supervisor/configs.py +7 -7
  92. ominfra/supervisor/dispatchers.py +4 -1
  93. ominfra/supervisor/dispatchersimpl.py +10 -4
  94. ominfra/supervisor/events.py +14 -7
  95. ominfra/supervisor/groups.py +4 -1
  96. ominfra/supervisor/groupsimpl.py +4 -1
  97. ominfra/supervisor/http.py +2 -2
  98. ominfra/supervisor/inject.py +4 -1
  99. ominfra/supervisor/io.py +5 -2
  100. ominfra/supervisor/main.py +4 -4
  101. ominfra/supervisor/pipes.py +4 -1
  102. ominfra/supervisor/privileges.py +4 -1
  103. ominfra/supervisor/process.py +1 -1
  104. ominfra/supervisor/processimpl.py +5 -2
  105. ominfra/supervisor/setup.py +5 -3
  106. ominfra/supervisor/setupimpl.py +5 -2
  107. ominfra/supervisor/signals.py +8 -2
  108. ominfra/supervisor/spawning.py +4 -1
  109. ominfra/supervisor/spawningimpl.py +1 -1
  110. ominfra/supervisor/supervisor.py +5 -2
  111. ominfra/supervisor/types.py +13 -9
  112. ominfra/supervisor/utils/collections.py +8 -3
  113. ominfra/supervisor/utils/diag.py +4 -1
  114. ominfra/supervisor/utils/fds.py +4 -1
  115. ominfra/supervisor/utils/fs.py +4 -1
  116. ominfra/supervisor/utils/os.py +4 -3
  117. ominfra/supervisor/utils/signals.py +1 -1
  118. ominfra/supervisor/utils/strings.py +2 -1
  119. ominfra/supervisor/utils/users.py +1 -1
  120. ominfra/systemd.py +1 -1
  121. ominfra/tailscale/api.py +3 -0
  122. ominfra/threadworkers.py +7 -3
  123. ominfra/tools/listresources.py +1 -1
  124. ominfra-0.0.0.dev488.dist-info/METADATA +54 -0
  125. ominfra-0.0.0.dev488.dist-info/RECORD +169 -0
  126. {ominfra-0.0.0.dev315.dist-info → ominfra-0.0.0.dev488.dist-info}/WHEEL +1 -1
  127. ominfra-0.0.0.dev315.dist-info/METADATA +0 -23
  128. ominfra-0.0.0.dev315.dist-info/RECORD +0 -164
  129. {ominfra-0.0.0.dev315.dist-info → ominfra-0.0.0.dev488.dist-info}/entry_points.txt +0 -0
  130. {ominfra-0.0.0.dev315.dist-info → ominfra-0.0.0.dev488.dist-info}/licenses/LICENSE +0 -0
  131. {ominfra-0.0.0.dev315.dist-info → ominfra-0.0.0.dev488.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,10 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  from omlish.lite.check import check
3
3
 
4
4
 
5
+ ##
6
+
7
+
5
8
  def check_valid_deploy_spec_path(s: str) -> str:
6
9
  check.non_empty_str(s)
7
10
  for c in ['..', '//']:
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import typing as ta
3
3
 
4
4
 
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import abc
3
3
  import dataclasses as dc
4
4
  import hashlib
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  """
3
3
  TODO:
4
4
  - verify - systemd-analyze
@@ -22,6 +22,9 @@ from .tmp import DeployHomeAtomics
22
22
  from .types import DeployHome
23
23
 
24
24
 
25
+ ##
26
+
27
+
25
28
  class DeploySystemdManager:
26
29
  def __init__(
27
30
  self,
@@ -1,8 +1,8 @@
1
- # ruff: noqa: UP006 UP007
2
- import abc
1
+ # ruff: noqa: UP006 UP007 UP045
3
2
  import dataclasses as dc
4
3
  import typing as ta
5
4
 
5
+ from omlish.lite.abstract import Abstract
6
6
  from omlish.lite.check import check
7
7
  from omlish.lite.marshal import register_single_field_type_obj_marshaler
8
8
 
@@ -30,11 +30,11 @@ DEPLOY_TAG_ILLEGAL_STRS: ta.AbstractSet[str] = frozenset([
30
30
 
31
31
 
32
32
  @dc.dataclass(frozen=True, order=True)
33
- class DeployTag(abc.ABC): # noqa
33
+ class DeployTag(Abstract):
34
34
  s: str
35
35
 
36
36
  def __post_init__(self) -> None:
37
- check.not_in(abc.ABC, type(self).__bases__)
37
+ check.not_in(Abstract, type(self).__bases__)
38
38
  check.non_empty_str(self.s)
39
39
  for ch in DEPLOY_TAG_ILLEGAL_STRS:
40
40
  check.state(ch not in self.s)
@@ -47,12 +47,12 @@ class DeployTag(abc.ABC): # noqa
47
47
  def __init_subclass__(cls, **kwargs: ta.Any) -> None:
48
48
  super().__init_subclass__(**kwargs)
49
49
 
50
- if abc.ABC in cls.__bases__:
50
+ if Abstract in cls.__bases__:
51
51
  return
52
52
 
53
53
  for b in cls.__bases__:
54
54
  if issubclass(b, DeployTag):
55
- check.in_(abc.ABC, b.__bases__)
55
+ check.in_(Abstract, b.__bases__)
56
56
 
57
57
  check.non_empty_str(tn := cls.tag_name)
58
58
  check.equal(tn, tn.lower().strip())
@@ -99,7 +99,7 @@ class DeployTime(DeployTag):
99
99
  ##
100
100
 
101
101
 
102
- class NameDeployTag(DeployTag, abc.ABC): # noqa
102
+ class NameDeployTag(DeployTag, Abstract):
103
103
  pass
104
104
 
105
105
 
@@ -116,7 +116,7 @@ class DeployConf(NameDeployTag):
116
116
  ##
117
117
 
118
118
 
119
- class KeyDeployTag(DeployTag, abc.ABC): # noqa
119
+ class KeyDeployTag(DeployTag, Abstract):
120
120
  pass
121
121
 
122
122
 
@@ -133,7 +133,7 @@ class DeployAppKey(KeyDeployTag):
133
133
  ##
134
134
 
135
135
 
136
- class RevDeployTag(DeployTag, abc.ABC): # noqa
136
+ class RevDeployTag(DeployTag, Abstract):
137
137
  pass
138
138
 
139
139
 
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  from omlish.lite.check import check
3
3
  from omlish.lite.typing import Func1
4
4
  from omlish.os.atomics import AtomicPathSwapping
@@ -8,6 +8,9 @@ from .paths.owners import SingleDirDeployPathOwner
8
8
  from .types import DeployHome
9
9
 
10
10
 
11
+ ##
12
+
13
+
11
14
  class DeployHomeAtomics(Func1[DeployHome, AtomicPathSwapping]):
12
15
  pass
13
16
 
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  """
3
3
  TODO:
4
4
  - interp
@@ -15,6 +15,9 @@ from omlish.lite.check import check
15
15
  from .specs import DeployVenvSpec
16
16
 
17
17
 
18
+ ##
19
+
20
+
18
21
  class DeployVenvManager:
19
22
  async def setup_venv(
20
23
  self,
ominfra/manage/inject.py CHANGED
@@ -1,10 +1,11 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import typing as ta
3
3
 
4
4
  from omlish.lite.inject import InjectorBindingOrBindings
5
5
  from omlish.lite.inject import InjectorBindings
6
6
  from omlish.lite.inject import inj
7
7
  from omlish.lite.marshal import ObjMarshalerManager
8
+ from omlish.lite.marshal import new_obj_marshaler_manager
8
9
 
9
10
  from .bootstrap import MainBootstrap
10
11
  from .commands.inject import bind_commands
@@ -63,7 +64,7 @@ def bind_main(
63
64
  #
64
65
 
65
66
  def build_obj_marshaler_manager(insts: ObjMarshalerInstallers) -> ObjMarshalerManager:
66
- msh = ObjMarshalerManager()
67
+ msh = new_obj_marshaler_manager()
67
68
  inst: ObjMarshalerInstaller
68
69
  for inst in insts:
69
70
  inst.fn(msh)
ominfra/manage/main.py CHANGED
@@ -1,14 +1,13 @@
1
1
  # @omlish-amalg ../scripts/manage.py
2
- # ruff: noqa: UP006 UP007
2
+ # ruff: noqa: UP006 UP007 UP045
3
3
  """
4
- manage.py -s 'docker run -i python:3.12'
4
+ manage.py -s 'docker run -i python:3.13'
5
5
  manage.py -s 'ssh -i /foo/bar.pem foo@bar.baz' -q --python=python3.8
6
6
  """
7
7
  import asyncio
8
8
  import dataclasses as dc
9
9
  import json
10
10
  import os.path
11
- import sys
12
11
  import typing as ta
13
12
 
14
13
  from omdev.home.paths import get_home_paths
@@ -18,10 +17,10 @@ from omlish.argparse.cli import argparse_cmd
18
17
  from omlish.lite.cached import cached_nullary
19
18
  from omlish.lite.check import check
20
19
  from omlish.lite.configs import load_config_file_obj
21
- from omlish.lite.logs import log # noqa
22
20
  from omlish.lite.marshal import ObjMarshalerManager
23
21
  from omlish.lite.marshal import ObjMarshalOptions
24
22
  from omlish.lite.pycharm import PycharmRemoteDebug
23
+ from omlish.logs.modules import get_module_logger
25
24
 
26
25
  from .bootstrap import MainBootstrap
27
26
  from .bootstrap_ import main_bootstrap
@@ -33,6 +32,12 @@ from .targets.connection import ManageTargetConnector
33
32
  from .targets.targets import ManageTarget
34
33
 
35
34
 
35
+ log = get_module_logger(globals()) # noqa
36
+
37
+
38
+ ##
39
+
40
+
36
41
  @dc.dataclass(frozen=True)
37
42
  class ManageConfig:
38
43
  targets: ta.Optional[ta.Mapping[str, ManageTarget]] = None
@@ -144,7 +149,7 @@ class MainCli(ArgparseCli):
144
149
 
145
150
 
146
151
  def _main() -> None:
147
- sys.exit(asyncio.run(MainCli().async_cli_run()))
152
+ raise SystemExit(asyncio.run(MainCli().async_cli_run()))
148
153
 
149
154
 
150
155
  if __name__ == '__main__':
ominfra/manage/marshal.py CHANGED
@@ -4,6 +4,9 @@ import typing as ta
4
4
  from omlish.lite.marshal import ObjMarshalerManager
5
5
 
6
6
 
7
+ ##
8
+
9
+
7
10
  @dc.dataclass(frozen=True)
8
11
  class ObjMarshalerInstaller:
9
12
  fn: ta.Callable[[ObjMarshalerManager], None]
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import asyncio
3
3
  import functools
4
4
  import logging
@@ -13,9 +13,9 @@ from omlish.asyncs.asyncio.streams import asyncio_open_stream_writer
13
13
  from omlish.lite.cached import cached_nullary
14
14
  from omlish.lite.check import check
15
15
  from omlish.lite.inject import Injector
16
- from omlish.lite.logs import log
17
16
  from omlish.lite.marshal import ObjMarshalerManager
18
17
  from omlish.lite.pycharm import pycharm_debug_connect
18
+ from omlish.logs.modules import get_module_logger
19
19
  from omlish.os.deathsig import set_process_deathsig
20
20
 
21
21
  from ...pyremote import pyremote_bootstrap_finalize
@@ -33,12 +33,16 @@ else:
33
33
  main_bootstrap: ta.Any = None
34
34
 
35
35
 
36
+ log = get_module_logger(globals()) # noqa
37
+
38
+
36
39
  ##
37
40
 
38
41
 
39
42
  class _RemoteExecutionLogHandler(logging.Handler):
40
43
  def __init__(self, fn: ta.Callable[[str], None]) -> None:
41
44
  super().__init__()
45
+
42
46
  self._fn = fn
43
47
 
44
48
  def emit(self, record):
@@ -1,10 +1,11 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import abc
3
3
  import asyncio
4
4
  import json
5
5
  import struct
6
6
  import typing as ta
7
7
 
8
+ from omlish.lite.abstract import Abstract
8
9
  from omlish.lite.json import json_dumps_compact
9
10
  from omlish.lite.marshal import OBJ_MARSHALER_MANAGER
10
11
  from omlish.lite.marshal import ObjMarshalerManager
@@ -16,7 +17,7 @@ T = ta.TypeVar('T')
16
17
  ##
17
18
 
18
19
 
19
- class RemoteChannel(abc.ABC):
20
+ class RemoteChannel(Abstract):
20
21
  @abc.abstractmethod
21
22
  def send_obj(self, o: ta.Any, ty: ta.Any = None) -> ta.Awaitable[None]:
22
23
  raise NotImplementedError
@@ -1,10 +1,13 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import dataclasses as dc
3
3
  import typing as ta
4
4
 
5
5
  from omlish.lite.pycharm import PycharmRemoteDebug
6
6
 
7
7
 
8
+ ##
9
+
10
+
8
11
  @dc.dataclass(frozen=True)
9
12
  class RemoteConfig:
10
13
  payload_file: ta.Optional[str] = None
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP043 UP045
2
2
  import asyncio
3
3
  import contextlib
4
4
  import typing as ta
@@ -1,9 +1,8 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  """
3
3
  TODO:
4
4
  - sequence all messages
5
5
  """
6
- import abc
7
6
  import asyncio
8
7
  import dataclasses as dc
9
8
  import itertools
@@ -11,8 +10,10 @@ import logging
11
10
  import time
12
11
  import typing as ta
13
12
 
13
+ from omlish.lite.abstract import Abstract
14
14
  from omlish.lite.check import check
15
- from omlish.lite.logs import log
15
+ from omlish.logs.modules import get_module_logger
16
+ from omlish.logs.protocols import LoggerLike
16
17
 
17
18
  from ..commands.base import Command
18
19
  from ..commands.base import CommandException
@@ -25,11 +26,14 @@ from .channel import RemoteChannel
25
26
  T = ta.TypeVar('T')
26
27
 
27
28
 
29
+ log = get_module_logger(globals()) # noqa
30
+
31
+
28
32
  ##
29
33
 
30
34
 
31
35
  class _RemoteProtocol:
32
- class Message(abc.ABC): # noqa
36
+ class Message(Abstract):
33
37
  async def send(self, chan: RemoteChannel) -> None:
34
38
  await chan.send_obj(self, _RemoteProtocol.Message)
35
39
 
@@ -39,7 +43,7 @@ class _RemoteProtocol:
39
43
 
40
44
  #
41
45
 
42
- class Request(Message, abc.ABC): # noqa
46
+ class Request(Message, Abstract):
43
47
  pass
44
48
 
45
49
  @dc.dataclass(frozen=True)
@@ -53,7 +57,7 @@ class _RemoteProtocol:
53
57
 
54
58
  #
55
59
 
56
- class Response(Message, abc.ABC): # noqa
60
+ class Response(Message, Abstract):
57
61
  pass
58
62
 
59
63
  @dc.dataclass(frozen=True)
@@ -394,7 +398,7 @@ class RemoteCommandExecutor(CommandExecutor):
394
398
  self,
395
399
  cmd: Command,
396
400
  *,
397
- log: ta.Optional[logging.Logger] = None, # noqa
401
+ log: ta.Optional[LoggerLike] = None, # noqa
398
402
  omit_exc_object: bool = False,
399
403
  ) -> CommandOutputOrException:
400
404
  try:
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import typing as ta
3
3
 
4
4
  from omlish.lite.inject import InjectorBindingOrBindings
@@ -13,6 +13,9 @@ from .spawning import RemoteSpawning
13
13
  from .spawning import SubprocessRemoteSpawning
14
14
 
15
15
 
16
+ ##
17
+
18
+
16
19
  def bind_remote(
17
20
  *,
18
21
  remote_config: RemoteConfig,
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import inspect
3
3
  import sys
4
4
  import typing as ta
@@ -9,6 +9,9 @@ from omlish.lite.cached import cached_nullary
9
9
  RemoteExecutionPayloadFile = ta.NewType('RemoteExecutionPayloadFile', str)
10
10
 
11
11
 
12
+ ##
13
+
14
+
12
15
  @cached_nullary
13
16
  def _get_self_src() -> str:
14
17
  return inspect.getsource(sys.modules[__name__])
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP043 UP045
2
2
  import abc
3
3
  import asyncio
4
4
  import contextlib
@@ -8,6 +8,7 @@ import subprocess
8
8
  import typing as ta
9
9
 
10
10
  from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
11
+ from omlish.lite.abstract import Abstract
11
12
  from omlish.lite.check import check
12
13
  from omlish.shlex import shlex_maybe_quote
13
14
  from omlish.subprocesses.base import SUBPROCESS_CHANNEL_OPTION_VALUES
@@ -17,7 +18,7 @@ from omlish.subprocesses.base import SubprocessChannelOption
17
18
  ##
18
19
 
19
20
 
20
- class RemoteSpawning(abc.ABC):
21
+ class RemoteSpawning(Abstract):
21
22
  @dc.dataclass(frozen=True)
22
23
  class Target:
23
24
  shell: ta.Optional[str] = None
@@ -1,9 +1,9 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import dataclasses as dc
3
3
  import typing as ta
4
4
 
5
5
  from omlish.lite.check import check
6
- from omlish.lite.logs import log
6
+ from omlish.logs.modules import get_module_logger
7
7
 
8
8
  from ..commands.base import Command
9
9
  from ..commands.base import CommandExecutor
@@ -11,6 +11,9 @@ from .packages import SystemPackage
11
11
  from .packages import SystemPackageManager
12
12
 
13
13
 
14
+ log = get_module_logger(globals()) # noqa
15
+
16
+
14
17
  ##
15
18
 
16
19
 
@@ -1,10 +1,13 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import dataclasses as dc
3
3
  import typing as ta
4
4
 
5
5
  from .platforms import Platform
6
6
 
7
7
 
8
+ ##
9
+
10
+
8
11
  @dc.dataclass(frozen=True)
9
12
  class SystemConfig:
10
13
  platform: ta.Optional[Platform] = None
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import typing as ta
3
3
 
4
4
  from omlish.lite.inject import InjectorBindingOrBindings
@@ -20,6 +20,9 @@ from .platforms import Platform
20
20
  from .platforms import detect_system_platform
21
21
 
22
22
 
23
+ ##
24
+
25
+
23
26
  def bind_system(
24
27
  *,
25
28
  system_config: SystemConfig,
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  """
3
3
  TODO:
4
4
  - yum/rpm
@@ -10,10 +10,14 @@ import os
10
10
  import typing as ta
11
11
 
12
12
  from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
13
+ from omlish.lite.abstract import Abstract
13
14
  from omlish.lite.check import check
14
15
 
15
16
 
16
- SystemPackageOrStr = ta.Union['SystemPackage', str]
17
+ SystemPackageOrStr = ta.Union['SystemPackage', str] # ta.TypeAlias
18
+
19
+
20
+ ##
17
21
 
18
22
 
19
23
  @dc.dataclass(frozen=True)
@@ -22,7 +26,7 @@ class SystemPackage:
22
26
  version: ta.Optional[str] = None
23
27
 
24
28
 
25
- class SystemPackageManager(abc.ABC):
29
+ class SystemPackageManager(Abstract):
26
30
  @abc.abstractmethod
27
31
  def update(self) -> ta.Awaitable[None]:
28
32
  raise NotImplementedError
@@ -1,21 +1,24 @@
1
- import abc
2
1
  import dataclasses as dc
3
2
  import sys
4
3
 
4
+ from omlish.lite.abstract import Abstract
5
5
  from omlish.lite.cached import cached_nullary
6
- from omlish.lite.logs import log
6
+ from omlish.logs.modules import get_module_logger
7
7
  from omlish.os.linux import LinuxOsRelease
8
8
 
9
9
 
10
+ log = get_module_logger(globals()) # noqa
11
+
12
+
10
13
  ##
11
14
 
12
15
 
13
16
  @dc.dataclass(frozen=True)
14
- class Platform(abc.ABC): # noqa
17
+ class Platform(Abstract):
15
18
  pass
16
19
 
17
20
 
18
- class LinuxPlatform(Platform, abc.ABC):
21
+ class LinuxPlatform(Platform, Abstract):
19
22
  pass
20
23
 
21
24
 
@@ -4,6 +4,9 @@ from omlish.lite.cached import cached_nullary
4
4
  from omlish.lite.resources import read_package_resource_text
5
5
 
6
6
 
7
+ ##
8
+
9
+
7
10
  BEST_PYTHON_SH = read_package_resource_text(__package__, 'bestpython.sh')
8
11
 
9
12
 
@@ -1,7 +1,7 @@
1
1
  bv=""
2
2
  bx=""
3
3
 
4
- for v in "" 3 3.{8..13}; do
4
+ for v in "" 3 3.{8..14}; do
5
5
  x="python$v"
6
6
  v=$($x -c "import sys; print((\"%02d\" * 3) % sys.version_info[:3])" 2>/dev/null)
7
7
  if [ $? -eq 0 ] && [ "$v" \> 030799 ] && ([ -z "$bv" ] || [ "$v" \> "$bv" ]); then
@@ -1,9 +1,10 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP043 UP045
2
2
  import abc
3
3
  import contextlib
4
4
  import dataclasses as dc
5
5
  import typing as ta
6
6
 
7
+ from omlish.lite.abstract import Abstract
7
8
  from omlish.lite.check import check
8
9
 
9
10
  from ..bootstrap import MainBootstrap
@@ -24,7 +25,7 @@ from .targets import SubprocessManageTarget
24
25
  ##
25
26
 
26
27
 
27
- class ManageTargetConnector(abc.ABC):
28
+ class ManageTargetConnector(Abstract):
28
29
  @abc.abstractmethod
29
30
  def connect(self, tgt: ManageTarget) -> ta.AsyncContextManager[CommandExecutor]:
30
31
  raise NotImplementedError
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  import typing as ta
3
3
 
4
4
  from omlish.lite.inject import Injector
@@ -17,6 +17,9 @@ from .targets import LocalManageTarget
17
17
  from .targets import SshManageTarget
18
18
 
19
19
 
20
+ ##
21
+
22
+
20
23
  def bind_targets() -> InjectorBindings:
21
24
  lst: ta.List[InjectorBindingOrBindings] = [
22
25
  inj.bind(LocalManageTargetConnector, singleton=True),
@@ -1,20 +1,20 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP045
2
2
  """
3
3
  It's desugaring. Subprocess and locals are only leafs. Retain an origin?
4
4
  ** TWO LAYERS ** - ManageTarget is user-facing, ConnectorTarget is bound, internal
5
5
  """
6
- import abc
7
6
  import dataclasses as dc
8
7
  import enum
9
8
  import typing as ta
10
9
 
10
+ from omlish.lite.abstract import Abstract
11
11
  from omlish.lite.check import check
12
12
 
13
13
 
14
14
  ##
15
15
 
16
16
 
17
- class ManageTarget(abc.ABC): # noqa
17
+ class ManageTarget(Abstract):
18
18
  def __init_subclass__(cls, **kwargs: ta.Any) -> None:
19
19
  super().__init_subclass__(**kwargs)
20
20
 
@@ -36,15 +36,15 @@ class PythonRemoteManageTarget:
36
36
  #
37
37
 
38
38
 
39
- class RemoteManageTarget(ManageTarget, abc.ABC):
39
+ class RemoteManageTarget(ManageTarget, Abstract):
40
40
  pass
41
41
 
42
42
 
43
- class PhysicallyRemoteManageTarget(RemoteManageTarget, abc.ABC):
43
+ class PhysicallyRemoteManageTarget(RemoteManageTarget, Abstract):
44
44
  pass
45
45
 
46
46
 
47
- class LocalManageTarget(ManageTarget, abc.ABC):
47
+ class LocalManageTarget(ManageTarget, Abstract):
48
48
  pass
49
49
 
50
50
 
ominfra/pyremote.py CHANGED
@@ -1,4 +1,4 @@
1
- # ruff: noqa: UP006 UP007
1
+ # ruff: noqa: UP006 UP007 UP043 UP045
2
2
  # @omlish-lite
3
3
  """
4
4
  Basically this: https://mitogen.networkgenomics.com/howitworks.html
@@ -438,15 +438,21 @@ class PyremoteBootstrapDriver:
438
438
  if isinstance(payload_src, str):
439
439
  parts = [payload_src]
440
440
  else:
441
- parts = list(payload_src)
441
+ parts = []
442
+ for i, p in enumerate(payload_src):
443
+ if i:
444
+ parts.append('\n\n')
445
+ parts.append(p)
442
446
 
443
447
  if (mn := options.main_name_override) is not None:
444
- parts.insert(0, f'__name__ = {mn!r}')
448
+ # Must go on same single line as first line of user payload to preserve '<stdin>' line numbers. If more
449
+ # things wind up having to be done here, it can still be crammed on one line into a single `exec()`.
450
+ parts.insert(0, f'__name__ = {mn!r}; ')
445
451
 
446
452
  if len(parts) == 1:
447
453
  return parts[0]
448
454
  else:
449
- return '\n\n'.join(parts)
455
+ return ''.join(parts)
450
456
 
451
457
  #
452
458