tasktree 0.0.10__py3-none-any.whl → 0.0.11__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.
tasktree/cli.py CHANGED
@@ -192,10 +192,12 @@ tasks:
192
192
  # deploy:
193
193
  # desc: Deploy to environment
194
194
  # deps: [build]
195
- # args: [environment, region=eu-west-1]
195
+ # args:
196
+ # - environment
197
+ # - region: { default: eu-west-1 }
196
198
  # cmd: |
197
- # echo "Deploying to {{environment}} in {{region}}"
198
- # ./deploy.sh {{environment}} {{region}}
199
+ # echo "Deploying to {{ arg.environment }} in {{ arg.region }}"
200
+ # ./deploy.sh {{ arg.environment }} {{ arg.region }}
199
201
 
200
202
  # Uncomment and modify the examples above to define your tasks
201
203
  """
tasktree/parser.py CHANGED
@@ -1259,18 +1259,16 @@ def parse_arg_spec(arg_spec: str | dict) -> ArgSpec:
1259
1259
 
1260
1260
  Supports both string format and dictionary format:
1261
1261
 
1262
- String format:
1262
+ String format (simple names only):
1263
1263
  - Simple name: "argname"
1264
1264
  - Exported (becomes env var): "$argname"
1265
- - With default: "argname=value" or "$argname=value"
1266
- - Legacy type syntax: "argname:type=value" (for backwards compat)
1267
1265
 
1268
1266
  Dictionary format:
1269
1267
  - argname: { default: "value" }
1270
1268
  - argname: { type: int, default: 42 }
1271
1269
  - argname: { type: int, min: 1, max: 100 }
1272
1270
  - argname: { type: str, choices: ["dev", "staging", "prod"] }
1273
- - $argname: { default: "value" } # Exported
1271
+ - $argname: { default: "value" } # Exported (type not allowed)
1274
1272
 
1275
1273
  Args:
1276
1274
  arg_spec: Argument specification (string or dict with single key)
@@ -1328,34 +1326,24 @@ def parse_arg_spec(arg_spec: str | dict) -> ArgSpec:
1328
1326
  if is_exported:
1329
1327
  arg_spec = arg_spec[1:] # Remove $ prefix
1330
1328
 
1331
- # Split on = to separate name:type from default
1332
- if "=" in arg_spec:
1333
- name_type, default = arg_spec.split("=", 1)
1334
- else:
1335
- name_type = arg_spec
1336
- default = None
1329
+ # String format only supports simple names (no = or :)
1330
+ if "=" in arg_spec or ":" in arg_spec:
1331
+ raise ValueError(
1332
+ f"Invalid argument syntax: {'$' if is_exported else ''}{arg_spec}\n\n"
1333
+ f"String format only supports simple argument names.\n"
1334
+ f"Use YAML dict format for type annotations, defaults, or constraints:\n"
1335
+ f" args:\n"
1336
+ f" - {'$' if is_exported else ''}{arg_spec.split('=')[0].split(':')[0]}: {{ default: value }}"
1337
+ )
1337
1338
 
1338
- # Split on : to separate name from type
1339
- if ":" in name_type:
1340
- name, arg_type = name_type.split(":", 1)
1339
+ name = arg_spec
1340
+ arg_type = "str"
1341
1341
 
1342
- # Exported arguments cannot have type annotations
1343
- if is_exported:
1344
- raise ValueError(
1345
- f"Type annotations not allowed on exported arguments\n"
1346
- f"In argument: ${name}:{arg_type}\n\n"
1347
- f"Exported arguments are always strings. Remove the type annotation:\n"
1348
- f" args: [${name}]"
1349
- )
1350
- else:
1351
- name = name_type
1352
- arg_type = "str"
1353
-
1354
- # String format doesn't support min/max/choices
1342
+ # String format doesn't support min/max/choices/defaults
1355
1343
  return ArgSpec(
1356
1344
  name=name,
1357
1345
  arg_type=arg_type,
1358
- default=default,
1346
+ default=None,
1359
1347
  is_exported=is_exported,
1360
1348
  min_val=None,
1361
1349
  max_val=None,
@@ -1403,6 +1391,15 @@ def _parse_arg_dict(arg_name: str, config: dict, is_exported: bool) -> ArgSpec:
1403
1391
  f"Exported arguments are always strings. Remove the 'type' field"
1404
1392
  )
1405
1393
 
1394
+ # Exported arguments must have string defaults (if any default is provided)
1395
+ if is_exported and default is not None and not isinstance(default, str):
1396
+ raise ValueError(
1397
+ f"Exported argument '${arg_name}' must have a string default value.\n"
1398
+ f"Got: {default!r} (type: {type(default).__name__})\n"
1399
+ f"Exported arguments become environment variables, which are always strings.\n"
1400
+ f"Use a quoted string: ${arg_name}: {{ default: \"{default}\" }}"
1401
+ )
1402
+
1406
1403
  # Validate choices
1407
1404
  if choices is not None:
1408
1405
  # Validate choices is a list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tasktree
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: A task automation tool with incremental execution
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: click>=8.1.0
@@ -604,7 +604,9 @@ Dependencies can invoke tasks with specific arguments, enabling flexible and reu
604
604
  tasks:
605
605
  # Task with parameters
606
606
  process:
607
- args: [mode, verbose=false]
607
+ args:
608
+ - mode
609
+ - verbose: { default: false }
608
610
  cmd: echo "mode={{arg.mode}} verbose={{arg.verbose}}"
609
611
 
610
612
  # Simple dependency (uses defaults)
@@ -1,15 +1,15 @@
1
1
  tasktree/__init__.py,sha256=MVmdvKb3JdqLlo0x2_TPGMfgFC0HsDnP79HAzGnFnjI,1081
2
- tasktree/cli.py,sha256=H5T8wOxLBGx-ZTQEnkoJrX3srgD5b_7BLf1IWl18M2M,17597
2
+ tasktree/cli.py,sha256=uL4RGap1U7-_4mcdEGbsELR4cvm1aUaqbvnX8XJFNKc,17652
3
3
  tasktree/docker.py,sha256=qvja8G63uAcC73YMVY739egda1_CcBtoqzm0qIJU_Q8,14443
4
4
  tasktree/executor.py,sha256=Q7Bks5B88i-IyZDpxGSps9MM3uflz0U3yn4Rtq_uHMM,42266
5
5
  tasktree/graph.py,sha256=oXLxX0Ix4zSkVBg8_3x9K7WxSFpg136sp4MF-d2mDEQ,9682
6
6
  tasktree/hasher.py,sha256=0GrnCfwAXnwq_kpnHFFb12B5_2VFNXx6Ng7hTdcCyXo,4415
7
- tasktree/parser.py,sha256=N_dXHl5UF0rBvIVdbsVZOo5Ur5uFEKgY1sSPNfScTxc,67135
7
+ tasktree/parser.py,sha256=rHJuYMM4AUjM1E-Jh3SpUpBRKGkciYOvgfgERoXylSE,67364
8
8
  tasktree/state.py,sha256=Cktl4D8iDZVd55aO2LqVyPrc-BnljkesxxkcMcdcfOY,3541
9
9
  tasktree/substitution.py,sha256=M_qcP0NKJATrKcNShSqHJatneuth1RVwTk1ci8-ZuxQ,6473
10
10
  tasktree/tasks.py,sha256=2QdQZtJAX2rSGbyXKG1z9VF_siz1DUzdvzCgPkykxtU,173
11
11
  tasktree/types.py,sha256=R_YAyO5bMLB6XZnkMRT7VAtlkA_Xx6xu0aIpzQjrBXs,4357
12
- tasktree-0.0.10.dist-info/METADATA,sha256=JyhF89pfUwr0bkV33rNae-0ytPyOEr2bKHfiWN-YsK0,37124
13
- tasktree-0.0.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
- tasktree-0.0.10.dist-info/entry_points.txt,sha256=lQINlvRYnimvteBbnhH84A9clTg8NnpEjCWqWkqg8KE,40
15
- tasktree-0.0.10.dist-info/RECORD,,
12
+ tasktree-0.0.11.dist-info/METADATA,sha256=a41OmLVRm4BbIpZT4e7v-l3g3gmw3DD1Eg0OXnrVsYA,37151
13
+ tasktree-0.0.11.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
+ tasktree-0.0.11.dist-info/entry_points.txt,sha256=lQINlvRYnimvteBbnhH84A9clTg8NnpEjCWqWkqg8KE,40
15
+ tasktree-0.0.11.dist-info/RECORD,,