dyngle 0.1.2__py3-none-any.whl → 0.2.0__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.
@@ -1,3 +1,4 @@
1
+ import shlex
1
2
  import subprocess
2
3
  from wizlib.parser import WizParser
3
4
 
@@ -12,27 +13,27 @@ class RunCommand(DyngleCommand):
12
13
  @classmethod
13
14
  def add_args(cls, parser: WizParser):
14
15
  super().add_args(parser)
15
- parser.add_argument('flow', help='Flow name to run')
16
+ parser.add_argument('flow', help='Operation name to run')
16
17
 
17
18
  def handle_vals(self):
18
19
  super().handle_vals()
19
20
  if not self.provided('flow'):
20
21
  self.flow = self.app.ui.get_input('Enter flow name: ')
21
22
 
22
- def _validate_flow_exists(self, flows):
23
+ def _validate_flow_exists(self, operations):
23
24
  """Validate that the requested flow exists in configuration"""
24
- if not flows:
25
- raise RuntimeError('No flows configured')
25
+ if not operations:
26
+ raise RuntimeError('No operations configured')
26
27
 
27
- if self.flow not in flows:
28
- available_flows = ', '.join(flows.keys())
28
+ if self.flow not in operations:
29
+ available_operations = ', '.join(operations.keys())
29
30
  raise RuntimeError(
30
- f'Flow "{self.flow}" not found. " + \
31
- f"Available flows: {available_flows}')
31
+ f'Operation "{self.flow}" not found. " + \
32
+ f"Available operations: {available_operations}')
32
33
 
33
34
  def _execute_task(self, task_str):
34
35
  """Execute a single task and handle errors"""
35
- task_parts = task_str.split()
36
+ task_parts = shlex.split(task_str)
36
37
  result = subprocess.run(task_parts)
37
38
 
38
39
  if result.returncode != 0:
@@ -41,11 +42,11 @@ class RunCommand(DyngleCommand):
41
42
 
42
43
  @DyngleCommand.wrap
43
44
  def execute(self):
44
- flows = self.app.config.get('dyngle-flows')
45
- self._validate_flow_exists(flows)
45
+ operations = self.app.config.get('dyngle-operations')
46
+ self._validate_flow_exists(operations)
46
47
 
47
- tasks = flows[self.flow]
48
+ tasks = operations[self.flow]
48
49
  for task_str in tasks:
49
50
  self._execute_task(task_str)
50
51
 
51
- return f'Flow "{self.flow}" completed successfully'
52
+ return f'Operation "{self.flow}" completed successfully'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dyngle
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Run lightweight local workflows
5
5
  License: MIT
6
6
  Author: Steampunk Wizard
@@ -21,11 +21,11 @@ Dyngle is a simple workflow runner that executes sequences of commands defined i
21
21
 
22
22
  ## Basic usage
23
23
 
24
- Create a configuration file (e.g., `config.yml`) with your workflows:
24
+ Create a configuration file (e.g., `.dyngle.yml`) with your workflows:
25
25
 
26
26
  ```yaml
27
27
  dyngle:
28
- flows:
28
+ operations:
29
29
  build:
30
30
  - python -m pip install -e .
31
31
  - python -m pytest
@@ -37,10 +37,10 @@ dyngle:
37
37
  - rm -rf .pytest_cache
38
38
  ```
39
39
 
40
- Run a workflow:
40
+ Run an operation:
41
41
 
42
42
  ```bash
43
- dyngle --config config.yml run build
43
+ dyngle run build
44
44
  ```
45
45
 
46
46
  ## Configuration
@@ -54,13 +54,13 @@ Dyngle reads configuration from YAML files. You can specify the config file loca
54
54
 
55
55
  ## Workflow structure
56
56
 
57
- Each workflow (called a "flow") is defined as a list of tasks under `dyngle.flows`. Tasks are executed sequentially using Python's subprocess module for security.
57
+ Each operation is defined as a list of tasks under `dyngle.operations`. Tasks are executed sequentially using Python's subprocess module for security.
58
58
 
59
- Example with multiple flows:
59
+ Example with multiple operations:
60
60
 
61
61
  ```yaml
62
62
  dyngle:
63
- flows:
63
+ operations:
64
64
  test:
65
65
  - python -m unittest discover
66
66
  - python -m coverage report
@@ -75,13 +75,13 @@ dyngle:
75
75
 
76
76
  ## Security
77
77
 
78
- Commands are executed using Python's `subprocess.run()` with arguments split by spaces. The shell is not used, preventing shell injection attacks.
78
+ Commands are executed using Python's `subprocess.run()` with arguments split in a shell-like fashion. The shell is not used, which reduces the likelihood of shell injection attacks. However, note that Dyngle is not robust to malicious configuration.
79
79
 
80
80
  ## Quick installation (MacOS)
81
81
 
82
82
  ```bash
83
83
  brew install python@3.11
84
84
  python3.11 -m pip install pipx
85
- pipx install kwark
85
+ pipx install dyngle
86
86
  ```
87
87
 
@@ -0,0 +1,8 @@
1
+ dyngle/__init__.py,sha256=2KD52sWHfMhk1g1wxHdnxjRtEKeYNJn7sTPkKRpSqNA,338
2
+ dyngle/__main__.py,sha256=mXOQ5tiUi5mEfp1NG2viz5kW2DEeWg1oCPFhfXgxJ4U,92
3
+ dyngle/command/__init__.py,sha256=1S86gbef8MYvG-TWD5JRIWzFg7qV5xKhp9QXx9zEx5c,94
4
+ dyngle/command/run_command.py,sha256=UbkzqlrbAkxQSbN8lHBaTaV23xYmVBlGEOZTiiuARjo,1667
5
+ dyngle-0.2.0.dist-info/METADATA,sha256=naF-xfNR-gcqrJGOOur2pM0gX5tRTwbrTcqfePuhntQ,2288
6
+ dyngle-0.2.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
+ dyngle-0.2.0.dist-info/entry_points.txt,sha256=rekiGhtweiHKm9g1jdGb3FhzqDrk1kigJDeSNollZSA,48
8
+ dyngle-0.2.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- dyngle/__init__.py,sha256=2KD52sWHfMhk1g1wxHdnxjRtEKeYNJn7sTPkKRpSqNA,338
2
- dyngle/__main__.py,sha256=mXOQ5tiUi5mEfp1NG2viz5kW2DEeWg1oCPFhfXgxJ4U,92
3
- dyngle/command/__init__.py,sha256=1S86gbef8MYvG-TWD5JRIWzFg7qV5xKhp9QXx9zEx5c,94
4
- dyngle/command/run_command.py,sha256=89GMbVcjqLLTRLvF9fVr5ehzC-1aoznS-mN2L5zzpBk,1574
5
- dyngle-0.1.2.dist-info/METADATA,sha256=up7gMCVwJPMWk7gYRQxcf5X9fROikh9OpIgY9XepT_4,2197
6
- dyngle-0.1.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
- dyngle-0.1.2.dist-info/entry_points.txt,sha256=rekiGhtweiHKm9g1jdGb3FhzqDrk1kigJDeSNollZSA,48
8
- dyngle-0.1.2.dist-info/RECORD,,
File without changes