ominfra 0.0.0.dev254__py3-none-any.whl → 0.0.0.dev256__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.
ominfra/pyremote.py CHANGED
@@ -35,46 +35,82 @@ class PyremoteBootstrapOptions:
35
35
 
36
36
  @dc.dataclass(frozen=True)
37
37
  class PyremoteEnvInfo:
38
- sys_base_prefix: str
39
- sys_byteorder: str
40
- sys_defaultencoding: str
41
- sys_exec_prefix: str
42
- sys_executable: str
43
- sys_implementation_name: str
44
- sys_path: ta.List[str]
45
- sys_platform: str
46
- sys_prefix: str
47
- sys_version: str
48
- sys_version_info: ta.List[ta.Union[int, str]]
49
-
50
- platform_architecture: ta.List[str]
51
- platform_machine: str
52
- platform_platform: str
53
- platform_processor: str
54
- platform_system: str
55
- platform_release: str
56
- platform_version: str
57
-
58
- site_userbase: str
59
-
60
- os_cwd: str
61
- os_gid: int
62
- os_loadavg: ta.List[float]
63
- os_login: ta.Optional[str]
64
- os_pgrp: int
65
- os_pid: int
66
- os_ppid: int
67
- os_uid: int
68
-
69
- pw_name: str
70
- pw_uid: int
71
- pw_gid: int
72
- pw_gecos: str
73
- pw_dir: str
74
- pw_shell: str
38
+ @dc.dataclass(frozen=True)
39
+ class Sys:
40
+ base_prefix: str
41
+ byteorder: str
42
+ defaultencoding: str
43
+ exec_prefix: str
44
+ executable: str
45
+ implementation_name: str
46
+ path: ta.List[str]
47
+ platform: str
48
+ prefix: str
49
+ version: str
50
+ version_info: ta.List[ta.Union[int, str]]
51
+
52
+ sys: Sys
53
+
54
+ @dc.dataclass(frozen=True)
55
+ class Platform:
56
+ architecture: ta.List[str]
57
+ machine: str
58
+ platform: str
59
+ processor: str
60
+ system: str
61
+ release: str
62
+ version: str
63
+
64
+ platform: Platform
65
+
66
+ @dc.dataclass(frozen=True)
67
+ class Site:
68
+ userbase: str
69
+
70
+ site: Site
71
+
72
+ @dc.dataclass(frozen=True)
73
+ class Os:
74
+ cwd: str
75
+ gid: int
76
+ loadavg: ta.List[float]
77
+ login: ta.Optional[str]
78
+ pgrp: int
79
+ pid: int
80
+ ppid: int
81
+ uid: int
82
+
83
+ os: Os
84
+
85
+ @dc.dataclass(frozen=True)
86
+ class Pw:
87
+ name: str
88
+ uid: int
89
+ gid: int
90
+ gecos: str
91
+ dir: str
92
+ shell: str
93
+
94
+ pw: Pw
75
95
 
76
96
  env_path: ta.Optional[str]
77
97
 
98
+ #
99
+
100
+ def to_dict(self) -> dict:
101
+ return {
102
+ f.name: dc.asdict(v) if dc.is_dataclass(v := getattr(self, f.name)) else v # type: ignore[arg-type]
103
+ for f in dc.fields(self)
104
+ }
105
+
106
+ @classmethod
107
+ def from_dict(cls, dct: dict) -> 'PyremoteEnvInfo':
108
+ flds_dct = {f.name: f for f in dc.fields(cls)}
109
+ return cls(**{
110
+ k: ft(**v) if isinstance((ft := flds_dct[k].type), type) and dc.is_dataclass(ft) is not None else v
111
+ for k, v in dct.items()
112
+ })
113
+
78
114
 
79
115
  def _get_pyremote_env_info() -> PyremoteEnvInfo:
80
116
  os_uid = os.getuid()
@@ -88,43 +124,53 @@ def _get_pyremote_env_info() -> PyremoteEnvInfo:
88
124
  os_login = None
89
125
 
90
126
  return PyremoteEnvInfo(
91
- sys_base_prefix=sys.base_prefix,
92
- sys_byteorder=sys.byteorder,
93
- sys_defaultencoding=sys.getdefaultencoding(),
94
- sys_exec_prefix=sys.exec_prefix,
95
- sys_executable=sys.executable,
96
- sys_implementation_name=sys.implementation.name,
97
- sys_path=sys.path,
98
- sys_platform=sys.platform,
99
- sys_prefix=sys.prefix,
100
- sys_version=sys.version,
101
- sys_version_info=list(sys.version_info),
102
-
103
- platform_architecture=list(platform.architecture()),
104
- platform_machine=platform.machine(),
105
- platform_platform=platform.platform(),
106
- platform_processor=platform.processor(),
107
- platform_system=platform.system(),
108
- platform_release=platform.release(),
109
- platform_version=platform.version(),
110
-
111
- site_userbase=site.getuserbase(),
112
-
113
- os_cwd=os.getcwd(),
114
- os_gid=os.getgid(),
115
- os_loadavg=list(os.getloadavg()),
116
- os_login=os_login,
117
- os_pgrp=os.getpgrp(),
118
- os_pid=os.getpid(),
119
- os_ppid=os.getppid(),
120
- os_uid=os_uid,
121
-
122
- pw_name=pw.pw_name,
123
- pw_uid=pw.pw_uid,
124
- pw_gid=pw.pw_gid,
125
- pw_gecos=pw.pw_gecos,
126
- pw_dir=pw.pw_dir,
127
- pw_shell=pw.pw_shell,
127
+ sys=PyremoteEnvInfo.Sys(
128
+ base_prefix=sys.base_prefix,
129
+ byteorder=sys.byteorder,
130
+ defaultencoding=sys.getdefaultencoding(),
131
+ exec_prefix=sys.exec_prefix,
132
+ executable=sys.executable,
133
+ implementation_name=sys.implementation.name,
134
+ path=sys.path,
135
+ platform=sys.platform,
136
+ prefix=sys.prefix,
137
+ version=sys.version,
138
+ version_info=list(sys.version_info),
139
+ ),
140
+
141
+ platform=PyremoteEnvInfo.Platform(
142
+ architecture=list(platform.architecture()),
143
+ machine=platform.machine(),
144
+ platform=platform.platform(),
145
+ processor=platform.processor(),
146
+ system=platform.system(),
147
+ release=platform.release(),
148
+ version=platform.version(),
149
+ ),
150
+
151
+ site=PyremoteEnvInfo.Site(
152
+ userbase=site.getuserbase(),
153
+ ),
154
+
155
+ os=PyremoteEnvInfo.Os(
156
+ cwd=os.getcwd(),
157
+ gid=os.getgid(),
158
+ loadavg=list(os.getloadavg()),
159
+ login=os_login,
160
+ pgrp=os.getpgrp(),
161
+ pid=os.getpid(),
162
+ ppid=os.getppid(),
163
+ uid=os_uid,
164
+ ),
165
+
166
+ pw=PyremoteEnvInfo.Pw(
167
+ name=pw.pw_name,
168
+ uid=pw.pw_uid,
169
+ gid=pw.pw_gid,
170
+ gecos=pw.pw_gecos,
171
+ dir=pw.pw_dir,
172
+ shell=pw.pw_shell,
173
+ ),
128
174
 
129
175
  env_path=os.environ.get('PATH'),
130
176
  )
@@ -335,7 +381,7 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
335
381
 
336
382
  # Write env info
337
383
  env_info = _get_pyremote_env_info()
338
- env_info_json = json.dumps(dc.asdict(env_info), indent=None, separators=(',', ':')) # noqa
384
+ env_info_json = json.dumps(env_info.to_dict(), indent=None, separators=(',', ':')) # noqa
339
385
  os.write(1, struct.pack('<I', len(env_info_json)))
340
386
  os.write(1, env_info_json.encode('utf-8'))
341
387
 
@@ -449,7 +495,7 @@ class PyremoteBootstrapDriver:
449
495
  env_info_json_len = struct.unpack('<I', d)[0]
450
496
  d = yield from self._read(env_info_json_len)
451
497
  env_info_json = d.decode('utf-8')
452
- env_info = PyremoteEnvInfo(**json.loads(env_info_json))
498
+ env_info = PyremoteEnvInfo.from_dict(json.loads(env_info_json))
453
499
 
454
500
  # Read fourth ack (after finalization completed)
455
501
  yield from self._expect(_PYREMOTE_BOOTSTRAP_ACK3)
ominfra/scripts/manage.py CHANGED
@@ -697,46 +697,82 @@ class PyremoteBootstrapOptions:
697
697
 
698
698
  @dc.dataclass(frozen=True)
699
699
  class PyremoteEnvInfo:
700
- sys_base_prefix: str
701
- sys_byteorder: str
702
- sys_defaultencoding: str
703
- sys_exec_prefix: str
704
- sys_executable: str
705
- sys_implementation_name: str
706
- sys_path: ta.List[str]
707
- sys_platform: str
708
- sys_prefix: str
709
- sys_version: str
710
- sys_version_info: ta.List[ta.Union[int, str]]
711
-
712
- platform_architecture: ta.List[str]
713
- platform_machine: str
714
- platform_platform: str
715
- platform_processor: str
716
- platform_system: str
717
- platform_release: str
718
- platform_version: str
719
-
720
- site_userbase: str
721
-
722
- os_cwd: str
723
- os_gid: int
724
- os_loadavg: ta.List[float]
725
- os_login: ta.Optional[str]
726
- os_pgrp: int
727
- os_pid: int
728
- os_ppid: int
729
- os_uid: int
730
-
731
- pw_name: str
732
- pw_uid: int
733
- pw_gid: int
734
- pw_gecos: str
735
- pw_dir: str
736
- pw_shell: str
700
+ @dc.dataclass(frozen=True)
701
+ class Sys:
702
+ base_prefix: str
703
+ byteorder: str
704
+ defaultencoding: str
705
+ exec_prefix: str
706
+ executable: str
707
+ implementation_name: str
708
+ path: ta.List[str]
709
+ platform: str
710
+ prefix: str
711
+ version: str
712
+ version_info: ta.List[ta.Union[int, str]]
713
+
714
+ sys: Sys
715
+
716
+ @dc.dataclass(frozen=True)
717
+ class Platform:
718
+ architecture: ta.List[str]
719
+ machine: str
720
+ platform: str
721
+ processor: str
722
+ system: str
723
+ release: str
724
+ version: str
725
+
726
+ platform: Platform
727
+
728
+ @dc.dataclass(frozen=True)
729
+ class Site:
730
+ userbase: str
731
+
732
+ site: Site
733
+
734
+ @dc.dataclass(frozen=True)
735
+ class Os:
736
+ cwd: str
737
+ gid: int
738
+ loadavg: ta.List[float]
739
+ login: ta.Optional[str]
740
+ pgrp: int
741
+ pid: int
742
+ ppid: int
743
+ uid: int
744
+
745
+ os: Os
746
+
747
+ @dc.dataclass(frozen=True)
748
+ class Pw:
749
+ name: str
750
+ uid: int
751
+ gid: int
752
+ gecos: str
753
+ dir: str
754
+ shell: str
755
+
756
+ pw: Pw
737
757
 
738
758
  env_path: ta.Optional[str]
739
759
 
760
+ #
761
+
762
+ def to_dict(self) -> dict:
763
+ return {
764
+ f.name: dc.asdict(v) if dc.is_dataclass(v := getattr(self, f.name)) else v # type: ignore[arg-type]
765
+ for f in dc.fields(self)
766
+ }
767
+
768
+ @classmethod
769
+ def from_dict(cls, dct: dict) -> 'PyremoteEnvInfo':
770
+ flds_dct = {f.name: f for f in dc.fields(cls)}
771
+ return cls(**{
772
+ k: ft(**v) if isinstance((ft := flds_dct[k].type), type) and dc.is_dataclass(ft) is not None else v
773
+ for k, v in dct.items()
774
+ })
775
+
740
776
 
741
777
  def _get_pyremote_env_info() -> PyremoteEnvInfo:
742
778
  os_uid = os.getuid()
@@ -750,43 +786,53 @@ def _get_pyremote_env_info() -> PyremoteEnvInfo:
750
786
  os_login = None
751
787
 
752
788
  return PyremoteEnvInfo(
753
- sys_base_prefix=sys.base_prefix,
754
- sys_byteorder=sys.byteorder,
755
- sys_defaultencoding=sys.getdefaultencoding(),
756
- sys_exec_prefix=sys.exec_prefix,
757
- sys_executable=sys.executable,
758
- sys_implementation_name=sys.implementation.name,
759
- sys_path=sys.path,
760
- sys_platform=sys.platform,
761
- sys_prefix=sys.prefix,
762
- sys_version=sys.version,
763
- sys_version_info=list(sys.version_info),
764
-
765
- platform_architecture=list(platform.architecture()),
766
- platform_machine=platform.machine(),
767
- platform_platform=platform.platform(),
768
- platform_processor=platform.processor(),
769
- platform_system=platform.system(),
770
- platform_release=platform.release(),
771
- platform_version=platform.version(),
772
-
773
- site_userbase=site.getuserbase(),
774
-
775
- os_cwd=os.getcwd(),
776
- os_gid=os.getgid(),
777
- os_loadavg=list(os.getloadavg()),
778
- os_login=os_login,
779
- os_pgrp=os.getpgrp(),
780
- os_pid=os.getpid(),
781
- os_ppid=os.getppid(),
782
- os_uid=os_uid,
783
-
784
- pw_name=pw.pw_name,
785
- pw_uid=pw.pw_uid,
786
- pw_gid=pw.pw_gid,
787
- pw_gecos=pw.pw_gecos,
788
- pw_dir=pw.pw_dir,
789
- pw_shell=pw.pw_shell,
789
+ sys=PyremoteEnvInfo.Sys(
790
+ base_prefix=sys.base_prefix,
791
+ byteorder=sys.byteorder,
792
+ defaultencoding=sys.getdefaultencoding(),
793
+ exec_prefix=sys.exec_prefix,
794
+ executable=sys.executable,
795
+ implementation_name=sys.implementation.name,
796
+ path=sys.path,
797
+ platform=sys.platform,
798
+ prefix=sys.prefix,
799
+ version=sys.version,
800
+ version_info=list(sys.version_info),
801
+ ),
802
+
803
+ platform=PyremoteEnvInfo.Platform(
804
+ architecture=list(platform.architecture()),
805
+ machine=platform.machine(),
806
+ platform=platform.platform(),
807
+ processor=platform.processor(),
808
+ system=platform.system(),
809
+ release=platform.release(),
810
+ version=platform.version(),
811
+ ),
812
+
813
+ site=PyremoteEnvInfo.Site(
814
+ userbase=site.getuserbase(),
815
+ ),
816
+
817
+ os=PyremoteEnvInfo.Os(
818
+ cwd=os.getcwd(),
819
+ gid=os.getgid(),
820
+ loadavg=list(os.getloadavg()),
821
+ login=os_login,
822
+ pgrp=os.getpgrp(),
823
+ pid=os.getpid(),
824
+ ppid=os.getppid(),
825
+ uid=os_uid,
826
+ ),
827
+
828
+ pw=PyremoteEnvInfo.Pw(
829
+ name=pw.pw_name,
830
+ uid=pw.pw_uid,
831
+ gid=pw.pw_gid,
832
+ gecos=pw.pw_gecos,
833
+ dir=pw.pw_dir,
834
+ shell=pw.pw_shell,
835
+ ),
790
836
 
791
837
  env_path=os.environ.get('PATH'),
792
838
  )
@@ -997,7 +1043,7 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
997
1043
 
998
1044
  # Write env info
999
1045
  env_info = _get_pyremote_env_info()
1000
- env_info_json = json.dumps(dc.asdict(env_info), indent=None, separators=(',', ':')) # noqa
1046
+ env_info_json = json.dumps(env_info.to_dict(), indent=None, separators=(',', ':')) # noqa
1001
1047
  os.write(1, struct.pack('<I', len(env_info_json)))
1002
1048
  os.write(1, env_info_json.encode('utf-8'))
1003
1049
 
@@ -1111,7 +1157,7 @@ class PyremoteBootstrapDriver:
1111
1157
  env_info_json_len = struct.unpack('<I', d)[0]
1112
1158
  d = yield from self._read(env_info_json_len)
1113
1159
  env_info_json = d.decode('utf-8')
1114
- env_info = PyremoteEnvInfo(**json.loads(env_info_json))
1160
+ env_info = PyremoteEnvInfo.from_dict(json.loads(env_info_json))
1115
1161
 
1116
1162
  # Read fourth ack (after finalization completed)
1117
1163
  yield from self._expect(_PYREMOTE_BOOTSTRAP_ACK3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ominfra
3
- Version: 0.0.0.dev254
3
+ Version: 0.0.0.dev256
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,8 +12,8 @@ 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: omdev==0.0.0.dev254
16
- Requires-Dist: omlish==0.0.0.dev254
15
+ Requires-Dist: omdev==0.0.0.dev256
16
+ Requires-Dist: omlish==0.0.0.dev256
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -1,7 +1,7 @@
1
1
  ominfra/.manifests.json,sha256=8KREXxMAlsilZOktXPYru1ND3V5hFI22vnrp6hT3bio,589
2
2
  ominfra/__about__.py,sha256=6i1AoruFYQCd-PyhhbDQDWY2d1tiQu9nkwWr-fXAqfY,705
3
3
  ominfra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- ominfra/pyremote.py,sha256=qjY3Bj0GhuYznQ3bhqXmU9zyIVZkhD9Wv76QUG34ZME,15198
4
+ ominfra/pyremote.py,sha256=I8775ohUGn1DsI-6NQFAV2hxa6TPsH4ksINHxeIEw0w,16228
5
5
  ominfra/systemd.py,sha256=d61NVrJoItzSaqhMDgKGrQjbrxEVAujUMDsj8WggXos,1022
6
6
  ominfra/threadworkers.py,sha256=ADWHAdvjzPxm94yJcEt5_nM7q7aahdQUNP_EGQeOWAw,4974
7
7
  ominfra/clouds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -113,7 +113,7 @@ ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhh
113
113
  ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
114
114
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
115
  ominfra/scripts/journald2aws.py,sha256=vvuAU6O3tu5deEg5TjPjepgytXCqEvi7EQAMnGZ8NjY,168285
116
- ominfra/scripts/manage.py,sha256=YSuCcEYgj-t8uiIG_hyymIIXuSBzJvLVgi4-rZ7fEyg,378493
116
+ ominfra/scripts/manage.py,sha256=Jpsbj9DUB852agbxWS2wOBWOJUZ1wK-WlRfyDvbhiVs,379523
117
117
  ominfra/scripts/supervisor.py,sha256=U9soYrTfOpwei1681aNdCkq94HqGxh5g1IHTMiqM8oU,296898
118
118
  ominfra/supervisor/LICENSE.txt,sha256=ZrHY15PVR98y26Yg6iQfa-SXnUaYTDhrUsPVcEO5OKM,1874
119
119
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
@@ -156,9 +156,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
156
156
  ominfra/tailscale/cli.py,sha256=3FnJbgpLw6gInTfhERd1mDy9ijjMUGxkdYVo43Tnxx4,3555
157
157
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
158
158
  ominfra/tools/listresources.py,sha256=auGP1LlbBJSFKUWNvQo_UzA8IsBNZBTMwEkFFRJ4FX4,6185
159
- ominfra-0.0.0.dev254.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
160
- ominfra-0.0.0.dev254.dist-info/METADATA,sha256=eAu1ItjX_mQlTNvscVjmfrsBPBEkjCR3rsQUBDSTQBI,731
161
- ominfra-0.0.0.dev254.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
162
- ominfra-0.0.0.dev254.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
163
- ominfra-0.0.0.dev254.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
164
- ominfra-0.0.0.dev254.dist-info/RECORD,,
159
+ ominfra-0.0.0.dev256.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
160
+ ominfra-0.0.0.dev256.dist-info/METADATA,sha256=PGAUnHBdPLbXdWT6OHuKvELOuMjNYzeI_i0jMiRfXs8,731
161
+ ominfra-0.0.0.dev256.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
162
+ ominfra-0.0.0.dev256.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
163
+ ominfra-0.0.0.dev256.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
164
+ ominfra-0.0.0.dev256.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (76.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5