wizlib 3.2.1__tar.gz → 3.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.

Potentially problematic release.


This version of wizlib might be problematic. Click here for more details.

wizlib-3.3.1/PKG-INFO ADDED
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.3
2
+ Name: wizlib
3
+ Version: 3.3.1
4
+ Summary: Framework for flexible and powerful command-line applications
5
+ License: MIT
6
+ Author: Steampunk Wizard
7
+ Author-email: wizlib@steampunkwizard.ca
8
+ Requires-Python: >=3.11,<3.12
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
13
+ Requires-Dist: gnureadline (>=8.1.2,<9.0.0) ; sys_platform == "darwin"
14
+ Requires-Dist: myst-parser (>=2.0.0,<3.0.0)
15
+ Requires-Dist: pyreadline3 (>=3.4.1,<4.0.0) ; sys_platform == "win32"
16
+ Requires-Dist: readchar (>=4.0.5,<5.0.0)
17
+ Description-Content-Type: text/markdown
18
+
19
+
20
+ # WizLib
21
+
22
+ Build configurable CLI tools easily in Python (a framework)
23
+
24
+ <a style="font-weight: bold; font-size: 1.2em;" href="https://wizlib.steamwiz.io">Documentation on SteamWiz.io</a>
25
+
26
+ <a style="font-weight: 300; font-size: 0.8em;" href="https://www.flaticon.com/free-icons/wizard" title="wizard icons">Wizard icon by Freepik-Flaticon</a>
27
+
wizlib-3.3.1/README.md ADDED
@@ -0,0 +1,8 @@
1
+
2
+ # WizLib
3
+
4
+ Build configurable CLI tools easily in Python (a framework)
5
+
6
+ <a style="font-weight: bold; font-size: 1.2em;" href="https://wizlib.steamwiz.io">Documentation on SteamWiz.io</a>
7
+
8
+ <a style="font-weight: 300; font-size: 0.8em;" href="https://www.flaticon.com/free-icons/wizard" title="wizard icons">Wizard icon by Freepik-Flaticon</a>
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "wizlib"
3
- version = "3.2.1"
3
+ version = "3.3.1"
4
4
  description = "Framework for flexible and powerful command-line applications"
5
5
  authors = ["Steampunk Wizard <wizlib@steampunkwizard.ca>"]
6
6
  license = "MIT"
@@ -2,6 +2,9 @@ from argparse import Namespace
2
2
  from pathlib import Path
3
3
  import os
4
4
  from dataclasses import dataclass
5
+ import re
6
+ import shlex
7
+ import subprocess
5
8
  from unittest.mock import patch
6
9
 
7
10
  from yaml import load
@@ -72,8 +75,9 @@ class ConfigHandler(Handler):
72
75
  while (val := split.pop(0)) and (val in yaml):
73
76
  yaml = yaml[val] if val in yaml else None
74
77
  if not split:
75
- self.cache[key] = yaml
76
- return yaml
78
+ result = evaluate_yaml_value(yaml)
79
+ self.cache[key] = result
80
+ return result
77
81
 
78
82
  @classmethod
79
83
  def fake(cls, **vals):
@@ -81,3 +85,17 @@ class ConfigHandler(Handler):
81
85
  self = cls()
82
86
  self.cache = {k.replace('_', '-'): vals[k] for k in vals}
83
87
  return self
88
+
89
+
90
+ def os_process(match):
91
+ """Run a subprocess"""
92
+ command_string = match.group(1).strip()
93
+ command = shlex.split(command_string)
94
+ result = subprocess.run(command, capture_output=True)
95
+ return result.stdout.decode().strip()
96
+
97
+
98
+ def evaluate_yaml_value(yaml: str) -> str:
99
+ """When getting a value from YAML, evaluate shell commands"""
100
+ text = yaml.strip()
101
+ return re.sub(r'\$\((.*?)\)', os_process, text)
wizlib-3.2.1/PKG-INFO DELETED
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: wizlib
3
- Version: 3.2.1
4
- Summary: Framework for flexible and powerful command-line applications
5
- License: MIT
6
- Author: Steampunk Wizard
7
- Author-email: wizlib@steampunkwizard.ca
8
- Requires-Python: >=3.11,<3.12
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.11
12
- Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
13
- Requires-Dist: gnureadline (>=8.1.2,<9.0.0) ; sys_platform == "darwin"
14
- Requires-Dist: myst-parser (>=2.0.0,<3.0.0)
15
- Requires-Dist: pyreadline3 (>=3.4.1,<4.0.0) ; sys_platform == "win32"
16
- Requires-Dist: readchar (>=4.0.5,<5.0.0)
17
- Description-Content-Type: text/markdown
18
-
19
-
20
- # WizLib
21
-
22
- A framework for command-line devops and personal productivity tools
23
-
24
- WizLib wraps the built-in ArgumentParser with a set of functions, classes, and conventions that enables:
25
-
26
- - Easy addition of loosely coupled new subcommands
27
- - Unified access to configuration files with a normalized approach
28
- - Standardized use of stdin, stdout, and stderr
29
- - Plugin-type system for handling alternate UIs (such as curses or even a web UI)
30
- - Usable completion support for user input
31
- - Abstracts some of the argparse complexity
32
- - Applies conventions to application code structure
33
- - Supports test-driven development and CICD
34
-
35
- ## Getting started
36
-
37
- - [Home page](https://wizlib.ca) with documentation
38
- - [Sample project](https://gitlab.com/wizlib/sample) to get started
39
- - [Related projects](https://gitlab.com/wizlib) for real-world examples
40
-
41
- ---
42
-
43
- Logo by [Freepik](https://www.freepik.com/?_gl=1*1y9rvc9*test_ga*Mjc1MTIzODYxLjE2ODA3OTczNTg.*test_ga_523JXC6VL7*MTY4MDc5NzM1OC4xLjEuMTY4MDc5NzQxNS4zLjAuMA..*fp_ga*Mjc1MTIzODYxLjE2ODA3OTczNTg.*fp_ga_1ZY8468CQB*MTY4MDc5NzM1OC4xLjEuMTY4MDc5NzQxNS4zLjAuMA..)
44
-
45
-
wizlib-3.2.1/README.md DELETED
@@ -1,26 +0,0 @@
1
-
2
- # WizLib
3
-
4
- A framework for command-line devops and personal productivity tools
5
-
6
- WizLib wraps the built-in ArgumentParser with a set of functions, classes, and conventions that enables:
7
-
8
- - Easy addition of loosely coupled new subcommands
9
- - Unified access to configuration files with a normalized approach
10
- - Standardized use of stdin, stdout, and stderr
11
- - Plugin-type system for handling alternate UIs (such as curses or even a web UI)
12
- - Usable completion support for user input
13
- - Abstracts some of the argparse complexity
14
- - Applies conventions to application code structure
15
- - Supports test-driven development and CICD
16
-
17
- ## Getting started
18
-
19
- - [Home page](https://wizlib.ca) with documentation
20
- - [Sample project](https://gitlab.com/wizlib/sample) to get started
21
- - [Related projects](https://gitlab.com/wizlib) for real-world examples
22
-
23
- ---
24
-
25
- Logo by [Freepik](https://www.freepik.com/?_gl=1*1y9rvc9*test_ga*Mjc1MTIzODYxLjE2ODA3OTczNTg.*test_ga_523JXC6VL7*MTY4MDc5NzM1OC4xLjEuMTY4MDc5NzQxNS4zLjAuMA..*fp_ga*Mjc1MTIzODYxLjE2ODA3OTczNTg.*fp_ga_1ZY8468CQB*MTY4MDc5NzM1OC4xLjEuMTY4MDc5NzQxNS4zLjAuMA..)
26
-
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