nuclear 2.2.4__tar.gz → 2.3.1__tar.gz
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.
- {nuclear-2.2.4 → nuclear-2.3.1}/PKG-INFO +5 -1
- {nuclear-2.2.4 → nuclear-2.3.1}/README.md +4 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/sublog/logging.py +2 -1
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/config.py +22 -1
- nuclear-2.3.1/nuclear/version.py +1 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear.egg-info/PKG-INFO +5 -1
- nuclear-2.2.4/nuclear/version.py +0 -1
- {nuclear-2.2.4 → nuclear-2.3.1}/LICENSE +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/args/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/args/args_que.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/args/container.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/autocomplete/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/autocomplete/autocomplete.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/autocomplete/install.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/builder/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/builder/builder.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/builder/decorator_builder.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/builder/rule.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/builder/rule_factory.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/builder/typedef.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/completers/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/completers/file.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/help.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/context.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/error.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/inject.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/internal_vars.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/keyword.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/matcher.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/parser.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/transform.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/validate.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/parser/value.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/types/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/types/boolean.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/types/filesystem.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/cli/types/time.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/inspection/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/inspection/inspection.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/py.typed +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/shell/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/shell/background_cmd.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/shell/shell_utils.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/sublog/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/sublog/catch.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/sublog/context_error.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/sublog/exception.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/__init__.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/collections.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/datamodel.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/env.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/files.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/functools.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/input.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/regex.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/strings.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/time.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear/utils/url.py +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear.egg-info/SOURCES.txt +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear.egg-info/dependency_links.txt +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear.egg-info/requires.txt +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/nuclear.egg-info/top_level.txt +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/setup.cfg +0 -0
- {nuclear-2.2.4 → nuclear-2.3.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nuclear
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Declarative parser for command line interfaces
|
|
5
5
|
Home-page: https://github.com/igrek51/nuclear
|
|
6
6
|
Author: igrek51
|
|
@@ -36,6 +36,7 @@ It consists of tools for building CLI applications in Python, including:
|
|
|
36
36
|
- [Sublog](https://igrek51.github.io/nuclear/sublog/) - contextual logger
|
|
37
37
|
- [WAT](https://igrek51.github.io/nuclear/inspect/) - inspection tool
|
|
38
38
|
- [Shell utilities](https://igrek51.github.io/nuclear/shell/)
|
|
39
|
+
-en
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
# CLI Demo
|
|
@@ -76,6 +77,7 @@ python3 -m pip install --upgrade nuclear
|
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
You need Python 3.8 or newer.
|
|
80
|
+
-en
|
|
79
81
|
|
|
80
82
|
|
|
81
83
|
# 🙀 WAT Inspector
|
|
@@ -254,6 +256,7 @@ wat.locals
|
|
|
254
256
|
```python
|
|
255
257
|
wat.globals
|
|
256
258
|
```
|
|
259
|
+
-en
|
|
257
260
|
|
|
258
261
|
|
|
259
262
|
# 📜 Sublog
|
|
@@ -320,6 +323,7 @@ reloading plugins: loading config: file is missing
|
|
|
320
323
|
Note that while each individual part of the message may not provide a comprehensive explanation of the error,
|
|
321
324
|
when combined, the whole message becomes highly informative.
|
|
322
325
|
This is the core principle behind enriching errors with context.
|
|
326
|
+
-en
|
|
323
327
|
|
|
324
328
|
|
|
325
329
|
# 🐌 Shell utilities
|
|
@@ -21,6 +21,7 @@ It consists of tools for building CLI applications in Python, including:
|
|
|
21
21
|
- [Sublog](https://igrek51.github.io/nuclear/sublog/) - contextual logger
|
|
22
22
|
- [WAT](https://igrek51.github.io/nuclear/inspect/) - inspection tool
|
|
23
23
|
- [Shell utilities](https://igrek51.github.io/nuclear/shell/)
|
|
24
|
+
-en
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
# CLI Demo
|
|
@@ -61,6 +62,7 @@ python3 -m pip install --upgrade nuclear
|
|
|
61
62
|
```
|
|
62
63
|
|
|
63
64
|
You need Python 3.8 or newer.
|
|
65
|
+
-en
|
|
64
66
|
|
|
65
67
|
|
|
66
68
|
# 🙀 WAT Inspector
|
|
@@ -239,6 +241,7 @@ wat.locals
|
|
|
239
241
|
```python
|
|
240
242
|
wat.globals
|
|
241
243
|
```
|
|
244
|
+
-en
|
|
242
245
|
|
|
243
246
|
|
|
244
247
|
# 📜 Sublog
|
|
@@ -305,6 +308,7 @@ reloading plugins: loading config: file is missing
|
|
|
305
308
|
Note that while each individual part of the message may not provide a comprehensive explanation of the error,
|
|
306
309
|
when combined, the whole message becomes highly informative.
|
|
307
310
|
This is the core principle behind enriching errors with context.
|
|
311
|
+
-en
|
|
308
312
|
|
|
309
313
|
|
|
310
314
|
# 🐌 Shell utilities
|
|
@@ -185,7 +185,8 @@ class ColoredFormatter(logging.Formatter):
|
|
|
185
185
|
if self.log_level_show:
|
|
186
186
|
part_levelname = self.log_level_templates.get(record.levelname, record.levelname)
|
|
187
187
|
parts.append(part_levelname)
|
|
188
|
-
|
|
188
|
+
log_message: str = record.getMessage()
|
|
189
|
+
parts.append(log_message)
|
|
189
190
|
line = ' '.join(parts)
|
|
190
191
|
if not sys.stdout.isatty():
|
|
191
192
|
line = strip_ansi_colors(line)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import os
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from typing import Dict
|
|
3
|
+
from typing import Dict, Type, TypeVar
|
|
4
4
|
|
|
5
5
|
import yaml
|
|
6
6
|
|
|
7
7
|
from nuclear import logger
|
|
8
8
|
|
|
9
|
+
T = TypeVar('T')
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
def load_config() -> Dict:
|
|
11
13
|
"""
|
|
@@ -29,3 +31,22 @@ def load_config() -> Dict:
|
|
|
29
31
|
return config_dict
|
|
30
32
|
except Exception as e:
|
|
31
33
|
raise RuntimeError('loading config failed') from e
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def load_local_config(dataclazz: Type[T]) -> T:
|
|
37
|
+
"""
|
|
38
|
+
Load local configuration from YAML file and return it as a dataclass.
|
|
39
|
+
"""
|
|
40
|
+
path = Path('.config.yaml')
|
|
41
|
+
if not path.is_file():
|
|
42
|
+
logger.warning(f'Local config not found at {path}, using defaults')
|
|
43
|
+
return dataclazz()
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
with path.open() as file:
|
|
47
|
+
config_dict = yaml.load(file, Loader=yaml.FullLoader)
|
|
48
|
+
config = dataclazz(**config_dict)
|
|
49
|
+
logger.debug(f'local config loaded from {path}: {config_dict}')
|
|
50
|
+
return config
|
|
51
|
+
except Exception as e:
|
|
52
|
+
raise RuntimeError('loading local config failed') from e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.3.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nuclear
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Declarative parser for command line interfaces
|
|
5
5
|
Home-page: https://github.com/igrek51/nuclear
|
|
6
6
|
Author: igrek51
|
|
@@ -36,6 +36,7 @@ It consists of tools for building CLI applications in Python, including:
|
|
|
36
36
|
- [Sublog](https://igrek51.github.io/nuclear/sublog/) - contextual logger
|
|
37
37
|
- [WAT](https://igrek51.github.io/nuclear/inspect/) - inspection tool
|
|
38
38
|
- [Shell utilities](https://igrek51.github.io/nuclear/shell/)
|
|
39
|
+
-en
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
# CLI Demo
|
|
@@ -76,6 +77,7 @@ python3 -m pip install --upgrade nuclear
|
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
You need Python 3.8 or newer.
|
|
80
|
+
-en
|
|
79
81
|
|
|
80
82
|
|
|
81
83
|
# 🙀 WAT Inspector
|
|
@@ -254,6 +256,7 @@ wat.locals
|
|
|
254
256
|
```python
|
|
255
257
|
wat.globals
|
|
256
258
|
```
|
|
259
|
+
-en
|
|
257
260
|
|
|
258
261
|
|
|
259
262
|
# 📜 Sublog
|
|
@@ -320,6 +323,7 @@ reloading plugins: loading config: file is missing
|
|
|
320
323
|
Note that while each individual part of the message may not provide a comprehensive explanation of the error,
|
|
321
324
|
when combined, the whole message becomes highly informative.
|
|
322
325
|
This is the core principle behind enriching errors with context.
|
|
326
|
+
-en
|
|
323
327
|
|
|
324
328
|
|
|
325
329
|
# 🐌 Shell utilities
|
nuclear-2.2.4/nuclear/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|