snk-cli 0.6.0__tar.gz → 0.6.2__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.
Files changed (71) hide show
  1. {snk_cli-0.6.0 → snk_cli-0.6.2}/PKG-INFO +1 -1
  2. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/__about__.py +1 -1
  3. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/config/config.py +4 -0
  4. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/dynamic_typer.py +6 -8
  5. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/snk.yaml +2 -2
  6. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_types.py +2 -2
  7. {snk_cli-0.6.0 → snk_cli-0.6.2}/.github/workflows/publish.yml +0 -0
  8. {snk_cli-0.6.0 → snk_cli-0.6.2}/.github/workflows/tests.yml +0 -0
  9. {snk_cli-0.6.0 → snk_cli-0.6.2}/.gitignore +0 -0
  10. {snk_cli-0.6.0 → snk_cli-0.6.2}/LICENSE.txt +0 -0
  11. {snk_cli-0.6.0 → snk_cli-0.6.2}/README.md +0 -0
  12. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/index.md +0 -0
  13. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/cli.md +0 -0
  14. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/config.md +0 -0
  15. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/dynamic_typer.md +0 -0
  16. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/options.md +0 -0
  17. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/subcommands.md +0 -0
  18. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/testing.md +0 -0
  19. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/utils.md +0 -0
  20. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/validate.md +0 -0
  21. {snk_cli-0.6.0 → snk_cli-0.6.2}/docs/reference/workflow.md +0 -0
  22. {snk_cli-0.6.0 → snk_cli-0.6.2}/mkdocs.yml +0 -0
  23. {snk_cli-0.6.0 → snk_cli-0.6.2}/pyproject.toml +0 -0
  24. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/__init__.py +0 -0
  25. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/cli.py +0 -0
  26. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/conda.py +0 -0
  27. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/config/__init__.py +0 -0
  28. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/config/utils.py +0 -0
  29. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/options/__init__.py +0 -0
  30. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/options/option.py +0 -0
  31. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/options/utils.py +0 -0
  32. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/subcommands/__init__.py +0 -0
  33. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/subcommands/config.py +0 -0
  34. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/subcommands/env.py +0 -0
  35. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/subcommands/profile.py +0 -0
  36. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/subcommands/run.py +0 -0
  37. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/subcommands/script.py +0 -0
  38. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/testing.py +0 -0
  39. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/utils.py +0 -0
  40. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/validate.py +0 -0
  41. {snk_cli-0.6.0 → snk_cli-0.6.2}/src/snk_cli/workflow.py +0 -0
  42. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/__init__.py +0 -0
  43. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/conftest.py +0 -0
  44. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/artic_v4.1.bed +0 -0
  45. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/config.yaml +0 -0
  46. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/cov.fasta +0 -0
  47. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/print_config/Snakefile +0 -0
  48. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/print_config/cli.py +0 -0
  49. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/print_config/config.yaml +0 -0
  50. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/print_config/snk.yaml +0 -0
  51. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/cli.py +0 -0
  52. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/config.yaml +0 -0
  53. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/resources/data.txt +0 -0
  54. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/things/__about__.py +0 -0
  55. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/workflow/Snakefile +0 -0
  56. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/workflow/envs/wget.yml +0 -0
  57. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/workflow/profiles/base/config.yaml +0 -0
  58. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/workflow/profiles/slurm/config.yaml +0 -0
  59. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/data/workflow/workflow/scripts/hello.py +0 -0
  60. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_SnkConfig.py +0 -0
  61. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/__init__.py +0 -0
  62. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/test_dynamic_options.py +0 -0
  63. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/test_profile.py +0 -0
  64. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/test_run.py +0 -0
  65. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/test_snk_config.py +0 -0
  66. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/test_subcommands.py +0 -0
  67. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/test_validate.py +0 -0
  68. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_cli/test_workflow_cli.py +0 -0
  69. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_conda_env.py +0 -0
  70. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/test_dynamic_typer.py +0 -0
  71. {snk_cli-0.6.0 → snk_cli-0.6.2}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: snk-cli
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Project-URL: Documentation, https://github.com/wytamma/snk-cli#readme
5
5
  Project-URL: Issues, https://github.com/wytamma/snk-cli/issues
6
6
  Project-URL: Source, https://github.com/wytamma/snk-cli
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Wytamma Wirth <wytamma.wirth@me.com>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.6.0"
4
+ __version__ = "0.6.2"
@@ -37,6 +37,9 @@ class SnkConfig:
37
37
  skip_missing (bool): Whether to skip missing CLI options. Defaults to False.
38
38
  additional_snakemake_args (List[str]): List of additional Snakemake command-line arguments. Defaults to an empty list.
39
39
  commands (List[str]): List of subcommands to include in the CLI. Defaults to ["run", "script", "env", "profile", "info", "config"].
40
+ snakefile (Optional[Path]): Path to the Snakefile. Defaults to None.
41
+ configfile (Optional[Path]): Path to the config file. Defaults to None.
42
+ min_snk_cli_version (Optional[str]): Minimum version of the SNK CLI required to run the workflow. Defaults to None.
40
43
  cli (dict): Dictionary of CLI options and their values. Defaults to an empty dictionary.
41
44
  _snk_config_path (Path): The path to the SNK config file. Defaults to None.
42
45
 
@@ -73,6 +76,7 @@ class SnkConfig:
73
76
  commands: List[str] = field(default_factory=lambda: ["run", "script", "env", "profile", "info", "config"])
74
77
  snakefile: Optional[Path] = None
75
78
  configfile: Optional[Path] = None
79
+ min_snk_cli_version: Optional[str] = None
76
80
  cli: dict = field(default_factory=dict)
77
81
  _snk_config_path: Path = None
78
82
 
@@ -8,8 +8,6 @@ from enum import Enum
8
8
  from .options import Option
9
9
  import sys
10
10
 
11
- def parse_colon_separated_pair(value: str):
12
- return tuple(value.split(sep=':', maxsplit=2))
13
11
 
14
12
  class DynamicTyper:
15
13
  app: typer.Typer
@@ -159,13 +157,14 @@ class DynamicTyper:
159
157
  except ValueError:
160
158
  raise ValueError(f"Default value '{default}' for option '{option.name}' is not a valid choice.")
161
159
  annotation_type = Enum(f'{option.name}', {str(e): annotation_type(e) for e in option.choices})
162
- metavar, parser = None, None
160
+ click_type = None
163
161
  if get_origin(annotation_type) is dict or annotation_type is dict:
164
- metavar = "KEY:VALUE"
165
- parser = parse_colon_separated_pair
162
+ click_type = Tuple([str, str])
163
+ if hasattr(annotation_type, '__args__') and len(annotation_type.__args__) == 2:
164
+ click_type = Tuple([str, annotation_type.__args__[1]])
166
165
  annotation_type = List[Tuple]
167
166
  if type(default) is dict:
168
- default = [f"{k}:{v}" for k, v in default.items()]
167
+ default = [[k, v] for k, v in default.items()]
169
168
  return Parameter(
170
169
  option.name,
171
170
  kind=Parameter.POSITIONAL_OR_KEYWORD,
@@ -175,8 +174,7 @@ class DynamicTyper:
175
174
  help=f"{option.help}",
176
175
  rich_help_panel="Workflow Configuration",
177
176
  hidden=option.hidden,
178
- metavar=metavar,
179
- parser=parser,
177
+ click_type=click_type,
180
178
  ),
181
179
  annotation=annotation_type,
182
180
  )
@@ -12,14 +12,14 @@ cli:
12
12
  KeyValuePair:
13
13
  default: ["key", "value"]
14
14
  help: A key-value pair
15
- type: pair
15
+ type: pair[str, str]
16
16
  enum:
17
17
  choices: [a, b, c]
18
18
  default: "a"
19
19
  dict:
20
20
  help: A dictionary
21
21
  type: dict[str, int]
22
- default: ["key:1"]
22
+ default: [["key", 1], ["key2", 2]]
23
23
  test:
24
24
  another:
25
25
  test:
@@ -167,7 +167,7 @@ def test_choices(snakemake_config, annotations, cli_args, expected):
167
167
  # dict
168
168
  (
169
169
  {"example": {"key": "value"}},
170
- {"example": {"type": "dict", "default": ["key:value"]}},
170
+ {"example": {"type": "dict", "default": [["key", "value"]]}},
171
171
  [],
172
172
  "{'example': {'key': 'value'}}"
173
173
  ),
@@ -186,7 +186,7 @@ def test_choices(snakemake_config, annotations, cli_args, expected):
186
186
  (
187
187
  {},
188
188
  {"example": {"type": "dict[str, str]"}},
189
- ["--example", "new:2"],
189
+ ["--example", "new", "2"],
190
190
  "{'example': {'new': '2'}}"
191
191
  )
192
192
  ])
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