omdev 0.0.0.dev394__py3-none-any.whl → 0.0.0.dev396__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/.manifests.json +12 -0
- omdev/cache/data/manifests.py +7 -5
- omdev/dataclasses/__init__.py +0 -0
- omdev/dataclasses/__main__.py +11 -0
- omdev/dataclasses/cli.py +28 -0
- omdev/dataclasses/codegen.py +96 -0
- omdev/imgur.py +1 -1
- omdev/intellij/ides.py +1 -1
- {omdev-0.0.0.dev394.dist-info → omdev-0.0.0.dev396.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev394.dist-info → omdev-0.0.0.dev396.dist-info}/RECORD +14 -10
- {omdev-0.0.0.dev394.dist-info → omdev-0.0.0.dev396.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev394.dist-info → omdev-0.0.0.dev396.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev394.dist-info → omdev-0.0.0.dev396.dist-info}/licenses/LICENSE +0 -0
- {omdev-0.0.0.dev394.dist-info → omdev-0.0.0.dev396.dist-info}/top_level.txt +0 -0
omdev/.manifests.json
CHANGED
@@ -59,6 +59,18 @@
|
|
59
59
|
}
|
60
60
|
}
|
61
61
|
},
|
62
|
+
{
|
63
|
+
"module": ".dataclasses.__main__",
|
64
|
+
"attr": "_CLI_MODULE",
|
65
|
+
"file": "omdev/dataclasses/__main__.py",
|
66
|
+
"line": 4,
|
67
|
+
"value": {
|
68
|
+
"$.cli.types.CliModule": {
|
69
|
+
"cmd_name": "dataclasses",
|
70
|
+
"mod_name": "omdev.dataclasses.__main__"
|
71
|
+
}
|
72
|
+
}
|
73
|
+
},
|
62
74
|
{
|
63
75
|
"module": ".imgur",
|
64
76
|
"attr": "_FOO_CLI_MODULE",
|
omdev/cache/data/manifests.py
CHANGED
@@ -27,13 +27,15 @@ def _lib_revision() -> str | None:
|
|
27
27
|
class Manifest:
|
28
28
|
spec: Spec
|
29
29
|
|
30
|
-
|
31
|
-
end_at: datetime.datetime = dc.field(kw_only=True)
|
30
|
+
_: dc.KW_ONLY
|
32
31
|
|
33
|
-
|
34
|
-
|
32
|
+
start_at: datetime.datetime = dc.field()
|
33
|
+
end_at: datetime.datetime = dc.field()
|
35
34
|
|
36
|
-
|
35
|
+
lib_version: str = dc.field(default_factory=lambda: about.__version__)
|
36
|
+
lib_revision: str | None = dc.field(default_factory=_lib_revision)
|
37
|
+
|
38
|
+
serialization_version: int = dc.field(default=SERIALIZATION_VERSION)
|
37
39
|
|
38
40
|
@dc.validate
|
39
41
|
def _validate_serialization_versions(self) -> bool:
|
File without changes
|
omdev/dataclasses/cli.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
from omlish.argparse import all as ap
|
2
|
+
from omlish.logs.standard import configure_standard_logging
|
3
|
+
|
4
|
+
from .codegen import DataclassCodeGen
|
5
|
+
|
6
|
+
|
7
|
+
##
|
8
|
+
|
9
|
+
|
10
|
+
class Cli(ap.Cli):
|
11
|
+
@ap.cmd(
|
12
|
+
ap.arg('roots', metavar='root', nargs='+'),
|
13
|
+
)
|
14
|
+
def codegen(self) -> None:
|
15
|
+
DataclassCodeGen().run(self.args.roots)
|
16
|
+
|
17
|
+
|
18
|
+
##
|
19
|
+
|
20
|
+
|
21
|
+
def _main() -> None:
|
22
|
+
configure_standard_logging()
|
23
|
+
|
24
|
+
Cli().cli_run_and_exit()
|
25
|
+
|
26
|
+
|
27
|
+
if __name__ == '__main__':
|
28
|
+
_main()
|
@@ -0,0 +1,96 @@
|
|
1
|
+
"""
|
2
|
+
TODO:
|
3
|
+
- subdir conf files override parents, codegen those separately, don't duplicate
|
4
|
+
- refactor dc gen to just Execute and Codegen
|
5
|
+
- need to bubble up imports, preamble, deduped
|
6
|
+
- still need plan repr / cmp
|
7
|
+
- !! manifests for dataclass config?
|
8
|
+
- more sparse / diffuse intent, not package-level
|
9
|
+
"""
|
10
|
+
import json
|
11
|
+
import logging
|
12
|
+
import os.path
|
13
|
+
import typing as ta
|
14
|
+
|
15
|
+
from omlish import check
|
16
|
+
from omlish import collections as col
|
17
|
+
from omlish import lang
|
18
|
+
from omlish.dataclasses.impl.configs import PACKAGE_CONFIG_FILE_NAME
|
19
|
+
from omlish.dataclasses.impl.configs import PackageConfig
|
20
|
+
from omlish.dataclasses.impl.generation.compilation import OpCompiler
|
21
|
+
from omlish.dataclasses.impl.generation.processor import Codegen as CodegenProcessingOption
|
22
|
+
from omlish.dataclasses.impl.generation.processor import GeneratorProcessor
|
23
|
+
from omlish.dataclasses.impl.processing.base import ProcessingContext
|
24
|
+
from omlish.dataclasses.impl.processing.driving import processing_options_context
|
25
|
+
|
26
|
+
|
27
|
+
log = logging.getLogger(__name__)
|
28
|
+
|
29
|
+
|
30
|
+
##
|
31
|
+
|
32
|
+
|
33
|
+
class DataclassCodeGen:
|
34
|
+
def __init__(self) -> None:
|
35
|
+
super().__init__()
|
36
|
+
|
37
|
+
def run_package_config(
|
38
|
+
self,
|
39
|
+
pkg_root: str,
|
40
|
+
config: PackageConfig,
|
41
|
+
) -> None:
|
42
|
+
if not config.codegen:
|
43
|
+
return
|
44
|
+
|
45
|
+
log.info('Running codegen on package: %s', pkg_root)
|
46
|
+
|
47
|
+
sub_pkgs = sorted(lang.yield_importable(
|
48
|
+
pkg_root,
|
49
|
+
recursive=True,
|
50
|
+
include_special=True,
|
51
|
+
))
|
52
|
+
|
53
|
+
for sub_pkg in sub_pkgs:
|
54
|
+
def callback(
|
55
|
+
ctx: ProcessingContext,
|
56
|
+
prepared: GeneratorProcessor.Prepared,
|
57
|
+
comp: OpCompiler.CompileResult,
|
58
|
+
) -> None:
|
59
|
+
print(ctx.cls)
|
60
|
+
print(prepared.plans)
|
61
|
+
print(comp.src)
|
62
|
+
|
63
|
+
with processing_options_context(CodegenProcessingOption(callback)):
|
64
|
+
print(f'{sub_pkg=}')
|
65
|
+
try:
|
66
|
+
__import__(sub_pkg)
|
67
|
+
except ImportError as e:
|
68
|
+
print(repr(e))
|
69
|
+
|
70
|
+
def build_config_trie(
|
71
|
+
self,
|
72
|
+
root_dirs: ta.Iterable[str],
|
73
|
+
) -> col.Trie[str, PackageConfig]:
|
74
|
+
check.not_isinstance(root_dirs, str)
|
75
|
+
|
76
|
+
trie: col.Trie[str, PackageConfig] = col.Trie()
|
77
|
+
for root_dir in root_dirs:
|
78
|
+
for dp, _, fns in os.walk(root_dir):
|
79
|
+
if PACKAGE_CONFIG_FILE_NAME in fns:
|
80
|
+
with open(os.path.join(dp, PACKAGE_CONFIG_FILE_NAME)) as f:
|
81
|
+
config = PackageConfig(**json.load(f))
|
82
|
+
pkg_parts = dp.split(os.sep)
|
83
|
+
trie[pkg_parts] = config
|
84
|
+
|
85
|
+
return trie
|
86
|
+
|
87
|
+
def run(
|
88
|
+
self,
|
89
|
+
root_dirs: ta.Iterable[str],
|
90
|
+
) -> None:
|
91
|
+
check.not_isinstance(root_dirs, str)
|
92
|
+
|
93
|
+
config_trie = self.build_config_trie(root_dirs)
|
94
|
+
|
95
|
+
for pkg_parts, pkg_config in config_trie.iter_items(sort_children=True):
|
96
|
+
self.run_package_config('.'.join(pkg_parts), pkg_config)
|
omdev/imgur.py
CHANGED
@@ -97,7 +97,7 @@ def upload_image(
|
|
97
97
|
|
98
98
|
resp = hu.request(
|
99
99
|
url,
|
100
|
-
headers={
|
100
|
+
headers={ # type: ignore[arg-type]
|
101
101
|
hu.consts.HEADER_AUTH: hu.consts.format_bearer_auth_header(Secret.of(auth_key).reveal()),
|
102
102
|
hu.consts.HEADER_CONTENT_TYPE: me.content_type().decode(),
|
103
103
|
},
|
omdev/intellij/ides.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: omdev
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev396
|
4
4
|
Summary: omdev
|
5
5
|
Author: wrmsr
|
6
6
|
License-Expression: BSD-3-Clause
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
14
14
|
Requires-Python: >=3.13
|
15
15
|
Description-Content-Type: text/markdown
|
16
16
|
License-File: LICENSE
|
17
|
-
Requires-Dist: omlish==0.0.0.
|
17
|
+
Requires-Dist: omlish==0.0.0.dev396
|
18
18
|
Provides-Extra: all
|
19
19
|
Requires-Dist: black~=25.1; extra == "all"
|
20
20
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
@@ -1,8 +1,8 @@
|
|
1
|
-
omdev/.manifests.json,sha256=
|
1
|
+
omdev/.manifests.json,sha256=zs6pTjCl5WETKw4-z4zXwBY5t-hWIhu-tjcxr_K3Nmo,12451
|
2
2
|
omdev/__about__.py,sha256=fQNmzSa1MntcPSrzg_Vpo6JRU2RbXik2NqRz0oQCApE,1202
|
3
3
|
omdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
omdev/cmake.py,sha256=9rfSvFHPmKDj9ngvfDB2vK8O-xO_ZwUm7hMKLWA-yOw,4578
|
5
|
-
omdev/imgur.py,sha256=
|
5
|
+
omdev/imgur.py,sha256=oG4jZH2EAk1my0JzoPNes-4LCtF2_aU08vmKbGzmuxo,3129
|
6
6
|
omdev/pip.py,sha256=PqzAWDO_CbiZvXzJAZcCkFqWynUDls1jIgBWlrswQyA,2012
|
7
7
|
omdev/tagstrings.py,sha256=cBmAc9-TtOBupvGQ9G4T1jjjtzijx4ihQCBu6FezzV0,5490
|
8
8
|
omdev/amalg/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -30,7 +30,7 @@ omdev/cache/data/actions.py,sha256=Mv7eXeZuohCjQLpmLyvqvGjjBacXIvTYzIRMVpEh-zM,1
|
|
30
30
|
omdev/cache/data/cache.py,sha256=oveyGl6gfTmQ4fKVO-NbB5Zx4rmEcti3BdZIvv5C6CU,7632
|
31
31
|
omdev/cache/data/consts.py,sha256=d6W_aeMqgah6PmPYi9RA8Be54oQ4BcNCy8kDQ7FlB_Q,26
|
32
32
|
omdev/cache/data/defaults.py,sha256=NL_mT7kaSLm2Mk9VO5wdSu-DIcHTR1KgcihJqdSd4TY,312
|
33
|
-
omdev/cache/data/manifests.py,sha256=
|
33
|
+
omdev/cache/data/manifests.py,sha256=NweXxbkuLMBG1DiUFliOSYeXBrLPMIY4GA_gOZzHwho,949
|
34
34
|
omdev/cache/data/specs.py,sha256=P50VSvMf2Jp3VHjhHy4i1-PwYwEGD4MMXEpxIg0CQis,2468
|
35
35
|
omdev/capi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
36
|
omdev/capi/darwin/__init__.py,sha256=iAlc3ReV3LJOv5X9zGME1FKeZ2yf0auUuj1I3sGSo4E,86
|
@@ -125,6 +125,10 @@ omdev/cmdlog/__main__.py,sha256=m31h6AcI9rjRNVeBGoLcR-5pWp-yS8LXCorf4iBhX9w,162
|
|
125
125
|
omdev/cmdlog/_cmdlog.py,sha256=9VSuUKXBMBHAH3OfBCeqp16YPddPT9Man2zDHgzzCtI,1507
|
126
126
|
omdev/cmdlog/cli.py,sha256=9AJC3xeQA-2pdmTnsjo__9WRAML1jpEJUJMn6qQQpJA,1427
|
127
127
|
omdev/cmdlog/cmdlog.py,sha256=MJqfCG7sVWjSK_i1shD7cgWpFZXZkPvGhGEh-yd6iwM,1982
|
128
|
+
omdev/dataclasses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
129
|
+
omdev/dataclasses/__main__.py,sha256=N-a0Lf_s7D0VajuZCCY_dt8R4rSpeck9inbCsoIvciQ,175
|
130
|
+
omdev/dataclasses/cli.py,sha256=j5GfpJQSkA_jmV94XTVb3amCFYjgrasMs-bp_zJEkqE,445
|
131
|
+
omdev/dataclasses/codegen.py,sha256=yXTgTBSHafFwkbPOlnyxgaO_S5rDpSxB4awA5U6qMPU,3041
|
128
132
|
omdev/dataserver/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
129
133
|
omdev/dataserver/handlers.py,sha256=YTuRfZehP9panTwq8dPReHZwXF1_fFIueh-_ZoztA98,5446
|
130
134
|
omdev/dataserver/http.py,sha256=SMS6w-GVevG58FypqmPytcEqW8aUWpd2_F6JlBDIuBc,1730
|
@@ -142,7 +146,7 @@ omdev/home/secrets.py,sha256=Bq9Pak4lzsogw5GvOeQ4zs3Yatmn7glGH0q-b0Sf6h8,2003
|
|
142
146
|
omdev/home/shadow.py,sha256=6mGDJV70IExa-nzd7mOUW4R3OZIXO0fBwmOUU9T9f4M,295
|
143
147
|
omdev/intellij/__init__.py,sha256=OkihYdld_LTk_gTcyzOWc9Nze_drjsIYMYpbA5DG6m4,132
|
144
148
|
omdev/intellij/cli.py,sha256=Sds9Xj_OHgbm76j70frhwrZEzlVi-1Rd93g0ypIe6t4,2038
|
145
|
-
omdev/intellij/ides.py,sha256=
|
149
|
+
omdev/intellij/ides.py,sha256=uYSbVDPOlhKeImRCPV6HdcrO2JtACBPUpElbecTz7uM,1580
|
146
150
|
omdev/intellij/open.py,sha256=3HlbJsGkwZ28UBi1P7dVJMRDMLbJyOGQs9QMQqgYVus,2679
|
147
151
|
omdev/interp/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
148
152
|
omdev/interp/__main__.py,sha256=GMCqeGYltgt5dlJzHxY9gqisa8cRkrPfmZYuZnjg4WI,162
|
@@ -317,9 +321,9 @@ omdev/tools/jsonview/resources/jsonview.js,sha256=faDvXDOXKvEvjOuIlz4D3F2ReQXb_b
|
|
317
321
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
318
322
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
319
323
|
omdev/tools/pawk/pawk.py,sha256=ao5mdrpiSU4AZ8mBozoEaV3UVlmVTnRG9wD9XP70MZE,11429
|
320
|
-
omdev-0.0.0.
|
321
|
-
omdev-0.0.0.
|
322
|
-
omdev-0.0.0.
|
323
|
-
omdev-0.0.0.
|
324
|
-
omdev-0.0.0.
|
325
|
-
omdev-0.0.0.
|
324
|
+
omdev-0.0.0.dev396.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
325
|
+
omdev-0.0.0.dev396.dist-info/METADATA,sha256=P-t7fBSvtfmpL6qn22sWqHkKJ5RS-fAAjn_ncEb9nQw,5094
|
326
|
+
omdev-0.0.0.dev396.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
327
|
+
omdev-0.0.0.dev396.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
328
|
+
omdev-0.0.0.dev396.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
329
|
+
omdev-0.0.0.dev396.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|