runem 0.0.29__tar.gz → 0.0.30__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 (69) hide show
  1. {runem-0.0.29 → runem-0.0.30}/HISTORY.md +121 -0
  2. {runem-0.0.29 → runem-0.0.30}/PKG-INFO +18 -28
  3. {runem-0.0.29 → runem-0.0.30}/README.md +8 -18
  4. runem-0.0.30/runem/VERSION +1 -0
  5. {runem-0.0.29 → runem-0.0.30}/runem/cli.py +1 -0
  6. {runem-0.0.29 → runem-0.0.30}/runem/command_line.py +33 -8
  7. {runem-0.0.29 → runem-0.0.30}/runem/config.py +58 -9
  8. {runem-0.0.29 → runem-0.0.30}/runem/config_metadata.py +8 -0
  9. {runem-0.0.29 → runem-0.0.30}/runem/config_parse.py +188 -13
  10. {runem-0.0.29 → runem-0.0.30}/runem/files.py +32 -7
  11. runem-0.0.30/runem/hook_manager.py +116 -0
  12. {runem-0.0.29 → runem-0.0.30}/runem/job_execute.py +22 -21
  13. {runem-0.0.29 → runem-0.0.30}/runem/job_filter.py +2 -2
  14. {runem-0.0.29 → runem-0.0.30}/runem/job_runner_simple_command.py +7 -1
  15. runem-0.0.30/runem/job_wrapper.py +25 -0
  16. {runem-0.0.29 → runem-0.0.30}/runem/job_wrapper_python.py +7 -7
  17. {runem-0.0.29 → runem-0.0.30}/runem/log.py +8 -0
  18. {runem-0.0.29 → runem-0.0.30}/runem/report.py +18 -14
  19. {runem-0.0.29 → runem-0.0.30}/runem/runem.py +30 -13
  20. {runem-0.0.29 → runem-0.0.30}/runem/types.py +47 -4
  21. {runem-0.0.29 → runem-0.0.30}/runem.egg-info/PKG-INFO +18 -28
  22. {runem-0.0.29 → runem-0.0.30}/runem.egg-info/SOURCES.txt +3 -0
  23. {runem-0.0.29 → runem-0.0.30}/runem.egg-info/requires.txt +9 -9
  24. {runem-0.0.29 → runem-0.0.30}/setup.py +1 -0
  25. {runem-0.0.29 → runem-0.0.30}/tests/cli/test_initialise_options.py +2 -0
  26. {runem-0.0.29 → runem-0.0.30}/tests/data/help_output.3.10.txt +8 -2
  27. {runem-0.0.29 → runem-0.0.30}/tests/data/help_output.3.11.txt +8 -2
  28. runem-0.0.30/tests/sanitise_reports_footer.py +20 -0
  29. {runem-0.0.29 → runem-0.0.30}/tests/test_config.py +74 -9
  30. {runem-0.0.29 → runem-0.0.30}/tests/test_config_parse.py +319 -16
  31. runem-0.0.30/tests/test_files.py +87 -0
  32. runem-0.0.30/tests/test_hook_manager.py +198 -0
  33. {runem-0.0.29 → runem-0.0.30}/tests/test_job_execute.py +9 -81
  34. {runem-0.0.29 → runem-0.0.30}/tests/test_job_filter.py +26 -6
  35. {runem-0.0.29 → runem-0.0.30}/tests/test_job_wrapper.py +1 -1
  36. {runem-0.0.29 → runem-0.0.30}/tests/test_report.py +80 -11
  37. {runem-0.0.29 → runem-0.0.30}/tests/test_runem.py +588 -101
  38. runem-0.0.29/runem/VERSION +0 -1
  39. runem-0.0.29/runem/job_wrapper.py +0 -19
  40. runem-0.0.29/tests/test_files.py +0 -36
  41. {runem-0.0.29 → runem-0.0.30}/Containerfile +0 -0
  42. {runem-0.0.29 → runem-0.0.30}/LICENSE +0 -0
  43. {runem-0.0.29 → runem-0.0.30}/MANIFEST.in +0 -0
  44. {runem-0.0.29 → runem-0.0.30}/runem/__init__.py +0 -0
  45. {runem-0.0.29 → runem-0.0.30}/runem/__main__.py +0 -0
  46. {runem-0.0.29 → runem-0.0.30}/runem/base.py +0 -0
  47. {runem-0.0.29 → runem-0.0.30}/runem/blocking_print.py +0 -0
  48. {runem-0.0.29 → runem-0.0.30}/runem/cli/initialise_options.py +0 -0
  49. {runem-0.0.29 → runem-0.0.30}/runem/informative_dict.py +0 -0
  50. {runem-0.0.29 → runem-0.0.30}/runem/job.py +0 -0
  51. {runem-0.0.29 → runem-0.0.30}/runem/py.typed +0 -0
  52. {runem-0.0.29 → runem-0.0.30}/runem/run_command.py +0 -0
  53. {runem-0.0.29 → runem-0.0.30}/runem/runem_version.py +0 -0
  54. {runem-0.0.29 → runem-0.0.30}/runem/utils.py +0 -0
  55. {runem-0.0.29 → runem-0.0.30}/runem.egg-info/dependency_links.txt +0 -0
  56. {runem-0.0.29 → runem-0.0.30}/runem.egg-info/entry_points.txt +0 -0
  57. {runem-0.0.29 → runem-0.0.30}/runem.egg-info/top_level.txt +0 -0
  58. {runem-0.0.29 → runem-0.0.30}/setup.cfg +0 -0
  59. {runem-0.0.29 → runem-0.0.30}/tests/__init__.py +0 -0
  60. {runem-0.0.29 → runem-0.0.30}/tests/conftest.py +0 -0
  61. {runem-0.0.29 → runem-0.0.30}/tests/intentional_test_error.py +0 -0
  62. {runem-0.0.29 → runem-0.0.30}/tests/test_base.py +0 -0
  63. {runem-0.0.29 → runem-0.0.30}/tests/test_blocking_print.py +0 -0
  64. {runem-0.0.29 → runem-0.0.30}/tests/test_cli.py +0 -0
  65. {runem-0.0.29 → runem-0.0.30}/tests/test_informative_dict.py +0 -0
  66. {runem-0.0.29 → runem-0.0.30}/tests/test_job.py +0 -0
  67. {runem-0.0.29 → runem-0.0.30}/tests/test_job_runner_simple_command.py +0 -0
  68. {runem-0.0.29 → runem-0.0.30}/tests/test_job_wrapper_python.py +0 -0
  69. {runem-0.0.29 → runem-0.0.30}/tests/test_run_command.py +0 -0
@@ -4,6 +4,127 @@ Changelog
4
4
 
5
5
  (unreleased)
6
6
  ------------
7
+ - Merge pull request #47 from lursight/feat/git-fast-files. [Frank
8
+ Harrison]
9
+
10
+ Feat/git fast files
11
+ - Feat(git-files): adds -f and -h for handling changed files and head
12
+ files. [Frank Harrison]
13
+
14
+ This makes using runem for big projects MUCH more effecient.
15
+ - Chore(help): moves help switch from -h -> -H. [Frank Harrison]
16
+
17
+ This is so we can add `-h` as `HEAD files`
18
+ - Chore(error-reporting): adds warn() and error() logging types. [Frank
19
+ Harrison]
20
+ - Merge pull request #46 from lursight/chore/docs. [Frank Harrison]
21
+
22
+ Chore/docs
23
+ - Chore(test): adds a new e2e test for tags-to-ignore. [Frank Harrison]
24
+
25
+ Once again everything seems to be behaving properly.
26
+ - Chore(docs): annotates the tags-to-exclude test. [Frank Harrison]
27
+
28
+ I thought it was buggy, but we have another issue somewhere.
29
+ - Chore(docs): updates the core-goal in the README. [Frank Harrison]
30
+ - Chore(test): adds NUM CORES handling to tests. [Frank Harrison]
31
+ - Chore(coverage): fixes coverage warnings. [Frank Harrison]
32
+ - Merge pull request #45 from lursight/chore/update_deps. [Frank
33
+ Harrison]
34
+
35
+ updates deps
36
+ - Updates deps. [Frank Harrison]
37
+ - Merge pull request #44 from lursight/chore/update_py_black. [Frank
38
+ Harrison]
39
+
40
+ Chore/update py black
41
+ - Chore(black): updates formatting after upgrading black. [Frank
42
+ Harrison]
43
+ - Chore(deps): upgrades py-black following dependabot. [Frank Harrison]
44
+ - Merge pull request #43 from lursight/feat/user-local-hook_1st_pass.
45
+ [Frank Harrison]
46
+
47
+ Feat/user local hooks (1st pass)
48
+ - Feat(user-local-cfg): fixes for python 3.9 tests. [Frank Harrison]
49
+ - Feat(user-local-cfg): handles situations where jobs are in local
50
+ configs. [Frank Harrison]
51
+
52
+ ... and phases are missing.
53
+ - Chore(docs): stop the help-text test being verbose. [Frank Harrison]
54
+
55
+ ... it is unlikely that --help will be used in verbose mode... probs. Sigh.
56
+ - Feat(user-local-cfg): gets user- and local- configs working. [Frank
57
+ Harrison]
58
+ - Feat(user-local-cfg): splits the project loading into load and parse
59
+ phases. [Frank Harrison]
60
+
61
+ This is so we can use it to load user configs
62
+ - Feat(user-local-cfg): splits the config loading and the ConfigMetadata
63
+ construction functions. [Frank Harrison]
64
+
65
+ This allows re-using the parsing function for N files
66
+ - Feat(hooks): adds a hook system with support for ON_EXIT. [Frank
67
+ Harrison]
68
+
69
+ - we remove the deprecated function-type for jobs
70
+ - we add support for hooks
71
+ - add a hooks section to the .runem.yml reader
72
+ - add a on-exit hook to the runem project's .runem.yml
73
+ - Merge pull request #42 from lursight/feat/prettier_tree_graph. [Frank
74
+ Harrison]
75
+
76
+ Feat/prettier tree graph
77
+ - Feat(prettier-tree-report): changes how we index the leaver on the
78
+ report-tree. [Frank Harrison]
79
+
80
+ Basically removes the duplicate information, reducing visual noise,
81
+ especially after adding the variously shaded bar-graphs
82
+ - Chore(.runem): uses current best practise for accessing options in
83
+ runem's own jobs. [Frank Harrison]
84
+ - Chore(.runem): connects the unit-test option to the runem python
85
+ checks. [Frank Harrison]
86
+ - Chore(.runem): removes defunct options. [Frank Harrison]
87
+
88
+ These were left over from lursight's config
89
+ - Chore(.runem): rename switches for consistency. [Frank Harrison]
90
+ - Fix(pretty-tree): adds extra test for bar-graph chars. [Frank
91
+ Harrison]
92
+ - Chore: typo. [Frank Harrison]
93
+ - Merge pull request #41 from lursight/feat/prettier_tree_graph. [Frank
94
+ Harrison]
95
+
96
+ Feat/prettier tree graph
97
+ - Feat(tree-graph): hangs all tree leaves off of the runem.phases.
98
+ [Frank Harrison]
99
+ - Feat(tree-graph): adds runem-reports regression checks. [Frank
100
+ Harrison]
101
+
102
+ This means we can capture any changes if they happen to the layout of
103
+ the graph, as I intended to changed the layout next.
104
+ - Merge pull request #38 from
105
+ lursight/dependabot/github_actions/softprops/action-gh-release-2.
106
+ [Frank Harrison]
107
+
108
+ chore(deps): bump softprops/action-gh-release from 1 to 2
109
+ - Chore(deps): bump softprops/action-gh-release from 1 to 2.
110
+ [dependabot[bot]]
111
+
112
+ Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
113
+ - [Release notes](https://github.com/softprops/action-gh-release/releases)
114
+ - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
115
+ - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)
116
+
117
+ ---
118
+ updated-dependencies:
119
+ - dependency-name: softprops/action-gh-release
120
+ dependency-type: direct:production
121
+ update-type: version-update:semver-major
122
+ ...
123
+
124
+
125
+ 0.0.29 (2024-03-18)
126
+ -------------------
127
+ - Release: version 0.0.29 🚀 [Frank Harrison]
7
128
  - Merge pull request #40 from lursight/fix/time_saved. [Frank Harrison]
8
129
 
9
130
  Fix/time saved
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.29
3
+ Version: 0.0.30
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -10,26 +10,26 @@ Requires-Dist: halo
10
10
  Requires-Dist: packaging
11
11
  Requires-Dist: PyYAML
12
12
  Provides-Extra: test
13
- Requires-Dist: black==23.11.0; extra == "test"
14
- Requires-Dist: coverage==7.3.2; extra == "test"
13
+ Requires-Dist: black==24.3.0; extra == "test"
14
+ Requires-Dist: coverage==7.4.4; extra == "test"
15
15
  Requires-Dist: docformatter==1.7.5; extra == "test"
16
16
  Requires-Dist: flake8-bugbear==24.2.6; extra == "test"
17
17
  Requires-Dist: flake8==7.0.0; extra == "test"
18
18
  Requires-Dist: gitchangelog==3.0.4; extra == "test"
19
- Requires-Dist: isort==5.12.0; extra == "test"
19
+ Requires-Dist: isort==5.13.2; extra == "test"
20
20
  Requires-Dist: mkdocs==1.5.3; extra == "test"
21
- Requires-Dist: mypy==1.8.0; extra == "test"
21
+ Requires-Dist: mypy==1.9.0; extra == "test"
22
22
  Requires-Dist: pydocstyle==6.3.0; extra == "test"
23
- Requires-Dist: pylint==3.0.2; extra == "test"
23
+ Requires-Dist: pylint==3.1.0; extra == "test"
24
24
  Requires-Dist: pylama==8.4.1; extra == "test"
25
25
  Requires-Dist: pytest-cov==4.1.0; extra == "test"
26
26
  Requires-Dist: pytest-profiling==1.7.0; extra == "test"
27
- Requires-Dist: pytest-xdist==3.3.1; extra == "test"
28
- Requires-Dist: pytest==7.4.3; extra == "test"
27
+ Requires-Dist: pytest-xdist==3.5.0; extra == "test"
28
+ Requires-Dist: pytest==8.1.1; extra == "test"
29
29
  Requires-Dist: setuptools; extra == "test"
30
30
  Requires-Dist: termplotlib==0.3.9; extra == "test"
31
- Requires-Dist: types-PyYAML==6.0.12.12; extra == "test"
32
- Requires-Dist: requests-mock==1.10.0; extra == "test"
31
+ Requires-Dist: types-PyYAML==6.0.12.20240311; extra == "test"
32
+ Requires-Dist: requests-mock==1.11.0; extra == "test"
33
33
  Requires-Dist: types-setuptools; extra == "test"
34
34
 
35
35
  # Run 'em
@@ -40,7 +40,7 @@ Requires-Dist: types-setuptools; extra == "test"
40
40
 
41
41
  ## 1. Overview
42
42
 
43
- The core objective of Run'em's is to minimize the wall-clock time required for executing whatever command-line tools a developer uses (or *should* use). Overall it is designed to enhance iteration speed and boost developer productivity.
43
+ The core objective of Run'em's is to minimize the wall-clock time required for running checks, supporting [shift-left](https://en.wikipedia.org/wiki/Shift-left_testing). Overall it is designed to enhance iteration speed and boost developer productivity.
44
44
 
45
45
  `runem` is also designed to be easy to learn and simple to use, but `runem` also has many powerful tools for advanced users.
46
46
 
@@ -173,7 +173,7 @@ Here's a simple setup for a python project.
173
173
  type: bool
174
174
  desc: formats docs and comments in whatever job can do so
175
175
  - option:
176
- name: check_only
176
+ name: check-only
177
177
  alias: check
178
178
  default: false
179
179
  type: bool
@@ -247,11 +247,11 @@ def _job_py_code_reformat(
247
247
  docformatter_extra_args = [
248
248
  "--in-place",
249
249
  ]
250
- if "check_only" in options and options["check_only"]:
250
+ if options["check-only"]:
251
251
  extra_args.append("--check")
252
252
  docformatter_extra_args = [] # --inplace is not compatible with --check
253
253
 
254
- if "black" in options and options["black"]:
254
+ if options["black"]:
255
255
  black_cmd = [
256
256
  "python3",
257
257
  "-m",
@@ -262,7 +262,7 @@ def _job_py_code_reformat(
262
262
  kwargs["label"] = f"{label} black"
263
263
  run_command(cmd=black_cmd, **kwargs)
264
264
 
265
- if "docformatter" in options and options["docformatter"]:
265
+ if options["docformatter"]:
266
266
  docformatter_cmd = [
267
267
  "python3",
268
268
  "-m",
@@ -279,7 +279,7 @@ def _job_py_code_reformat(
279
279
  0, # no work/change required
280
280
  3, # no errors, but code was reformatted
281
281
  )
282
- if "check_only" in options and options["check_only"]:
282
+ if options["check-only"]:
283
283
  # in check it is ONLY ok if no work/change was required
284
284
  allowed_exits = (0,)
285
285
  kwargs["label"] = f"{label} docformatter"
@@ -469,8 +469,8 @@ usage: runem.py [-h] [--jobs JOBS [JOBS ...]] [--not-jobs JOBS_EXCLUDED [JOBS_EX
469
469
  [--not-phases PHASES_EXCLUDED [PHASES_EXCLUDED ...]] [--tags TAGS [TAGS ...]] [--not-tags TAGS_EXCLUDED [TAGS_EXCLUDED ...]]
470
470
  [--black] [--no-black] [--check-only] [--no-check-only] [--coverage] [--no-coverage] [--docformatter] [--no-docformatter]
471
471
  [--generate-call-graphs] [--no-generate-call-graphs] [--install-deps] [--no-install-deps] [--isort] [--no-isort] [--profile]
472
- [--no-profile] [--update-snapshots] [--no-update-snapshots] [--unit-test] [--no-unit-test] [--unit-test-firebase-data]
473
- [--no-unit-test-firebase-data] [--unit-test-python] [--no-unit-test-python] [--call-graphs | --no-call-graphs]
472
+ [--no-profile] [--unit-test] [--no-unit-test]
473
+ [--call-graphs | --no-call-graphs]
474
474
  [--procs PROCS] [--root ROOT_DIR] [--verbose | --no-verbose | -v]
475
475
 
476
476
  Runs the Lursight Lang test-suite
@@ -524,18 +524,8 @@ job-param overrides:
524
524
  --no-isort turn off allow/disallows isort from running on python files
525
525
  --profile generate profile information in jobs that can
526
526
  --no-profile turn off generate profile information in jobs that can
527
- --update-snapshots update snapshots in jobs that can update data snapshots
528
- --no-update-snapshots
529
- turn off update snapshots in jobs that can update data snapshots
530
527
  --unit-test run unit tests
531
528
  --no-unit-test turn off run unit tests
532
- --unit-test-firebase-data
533
- run unit tests for the firebase function's data
534
- --no-unit-test-firebase-data
535
- turn off run unit tests for the firebase function's data
536
- --unit-test-python run unit tests for the python code
537
- --no-unit-test-python
538
- turn off run unit tests for the python code
539
529
  ```
540
530
  </details>
541
531
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## 1. Overview
8
8
 
9
- The core objective of Run'em's is to minimize the wall-clock time required for executing whatever command-line tools a developer uses (or *should* use). Overall it is designed to enhance iteration speed and boost developer productivity.
9
+ The core objective of Run'em's is to minimize the wall-clock time required for running checks, supporting [shift-left](https://en.wikipedia.org/wiki/Shift-left_testing). Overall it is designed to enhance iteration speed and boost developer productivity.
10
10
 
11
11
  `runem` is also designed to be easy to learn and simple to use, but `runem` also has many powerful tools for advanced users.
12
12
 
@@ -139,7 +139,7 @@ Here's a simple setup for a python project.
139
139
  type: bool
140
140
  desc: formats docs and comments in whatever job can do so
141
141
  - option:
142
- name: check_only
142
+ name: check-only
143
143
  alias: check
144
144
  default: false
145
145
  type: bool
@@ -213,11 +213,11 @@ def _job_py_code_reformat(
213
213
  docformatter_extra_args = [
214
214
  "--in-place",
215
215
  ]
216
- if "check_only" in options and options["check_only"]:
216
+ if options["check-only"]:
217
217
  extra_args.append("--check")
218
218
  docformatter_extra_args = [] # --inplace is not compatible with --check
219
219
 
220
- if "black" in options and options["black"]:
220
+ if options["black"]:
221
221
  black_cmd = [
222
222
  "python3",
223
223
  "-m",
@@ -228,7 +228,7 @@ def _job_py_code_reformat(
228
228
  kwargs["label"] = f"{label} black"
229
229
  run_command(cmd=black_cmd, **kwargs)
230
230
 
231
- if "docformatter" in options and options["docformatter"]:
231
+ if options["docformatter"]:
232
232
  docformatter_cmd = [
233
233
  "python3",
234
234
  "-m",
@@ -245,7 +245,7 @@ def _job_py_code_reformat(
245
245
  0, # no work/change required
246
246
  3, # no errors, but code was reformatted
247
247
  )
248
- if "check_only" in options and options["check_only"]:
248
+ if options["check-only"]:
249
249
  # in check it is ONLY ok if no work/change was required
250
250
  allowed_exits = (0,)
251
251
  kwargs["label"] = f"{label} docformatter"
@@ -435,8 +435,8 @@ usage: runem.py [-h] [--jobs JOBS [JOBS ...]] [--not-jobs JOBS_EXCLUDED [JOBS_EX
435
435
  [--not-phases PHASES_EXCLUDED [PHASES_EXCLUDED ...]] [--tags TAGS [TAGS ...]] [--not-tags TAGS_EXCLUDED [TAGS_EXCLUDED ...]]
436
436
  [--black] [--no-black] [--check-only] [--no-check-only] [--coverage] [--no-coverage] [--docformatter] [--no-docformatter]
437
437
  [--generate-call-graphs] [--no-generate-call-graphs] [--install-deps] [--no-install-deps] [--isort] [--no-isort] [--profile]
438
- [--no-profile] [--update-snapshots] [--no-update-snapshots] [--unit-test] [--no-unit-test] [--unit-test-firebase-data]
439
- [--no-unit-test-firebase-data] [--unit-test-python] [--no-unit-test-python] [--call-graphs | --no-call-graphs]
438
+ [--no-profile] [--unit-test] [--no-unit-test]
439
+ [--call-graphs | --no-call-graphs]
440
440
  [--procs PROCS] [--root ROOT_DIR] [--verbose | --no-verbose | -v]
441
441
 
442
442
  Runs the Lursight Lang test-suite
@@ -490,18 +490,8 @@ job-param overrides:
490
490
  --no-isort turn off allow/disallows isort from running on python files
491
491
  --profile generate profile information in jobs that can
492
492
  --no-profile turn off generate profile information in jobs that can
493
- --update-snapshots update snapshots in jobs that can update data snapshots
494
- --no-update-snapshots
495
- turn off update snapshots in jobs that can update data snapshots
496
493
  --unit-test run unit tests
497
494
  --no-unit-test turn off run unit tests
498
- --unit-test-firebase-data
499
- run unit tests for the firebase function's data
500
- --no-unit-test-firebase-data
501
- turn off run unit tests for the firebase function's data
502
- --unit-test-python run unit tests for the python code
503
- --no-unit-test-python
504
- turn off run unit tests for the python code
505
495
  ```
506
496
  </details>
507
497
 
@@ -0,0 +1 @@
1
+ 0.0.30
@@ -1,4 +1,5 @@
1
1
  """CLI interface for runem project."""
2
+
2
3
  import sys
3
4
 
4
5
  from runem.runem import timed_main
@@ -6,7 +6,7 @@ import typing
6
6
 
7
7
  from runem.config_metadata import ConfigMetadata
8
8
  from runem.informative_dict import InformativeDict
9
- from runem.log import log
9
+ from runem.log import error, log
10
10
  from runem.runem_version import get_runem_version
11
11
  from runem.types import JobNames, OptionConfig, OptionsWritable
12
12
  from runem.utils import printable_set
@@ -22,7 +22,12 @@ def parse_args(
22
22
 
23
23
  Returns the parsed args, the jobs_names_to_run, job_phases_to_run, job_tags_to_run
24
24
  """
25
- parser = argparse.ArgumentParser(description="Runs the Lursight Lang test-suite")
25
+ parser = argparse.ArgumentParser(
26
+ add_help=False, description="Runs the Lursight Lang test-suite"
27
+ )
28
+ parser.add_argument(
29
+ "-H", "--help", action="help", help="show this help message and exit"
30
+ )
26
31
 
27
32
  job_group = parser.add_argument_group("jobs")
28
33
  all_job_names: JobNames = set(name for name in config_metadata.all_job_names)
@@ -112,6 +117,26 @@ def parse_args(
112
117
  required=False,
113
118
  )
114
119
 
120
+ parser.add_argument(
121
+ "-f",
122
+ "--modified-files-only",
123
+ dest="check_modified_files_only",
124
+ help="only use files that have changed",
125
+ action=argparse.BooleanOptionalAction,
126
+ default=False,
127
+ required=False,
128
+ )
129
+
130
+ parser.add_argument(
131
+ "-h",
132
+ "--git-head-files-only",
133
+ dest="check_head_files_only",
134
+ help="fast run of files",
135
+ action=argparse.BooleanOptionalAction,
136
+ default=False,
137
+ required=False,
138
+ )
139
+
115
140
  parser.add_argument(
116
141
  "--procs",
117
142
  "-j",
@@ -206,9 +231,9 @@ def _validate_filters(
206
231
  for name, name_list in (("--jobs", args.jobs), ("--not-jobs", args.jobs_excluded)):
207
232
  for job_name in name_list:
208
233
  if job_name not in config_metadata.all_job_names:
209
- log(
234
+ error(
210
235
  (
211
- f"ERROR: invalid job-name '{job_name}' for {name}, "
236
+ f"invalid job-name '{job_name}' for {name}, "
212
237
  f"choose from one of {printable_set(config_metadata.all_job_names)}"
213
238
  )
214
239
  )
@@ -218,9 +243,9 @@ def _validate_filters(
218
243
  for name, tag_list in (("--tags", args.tags), ("--not-tags", args.tags_excluded)):
219
244
  for tag in tag_list:
220
245
  if tag not in config_metadata.all_job_tags:
221
- log(
246
+ error(
222
247
  (
223
- f"ERROR: invalid tag '{tag}' for {name}, "
248
+ f"invalid tag '{tag}' for {name}, "
224
249
  f"choose from one of {printable_set(config_metadata.all_job_tags)}"
225
250
  )
226
251
  )
@@ -233,9 +258,9 @@ def _validate_filters(
233
258
  ):
234
259
  for phase in phase_list:
235
260
  if phase not in config_metadata.all_job_phases:
236
- log(
261
+ error(
237
262
  (
238
- f"ERROR: invalid phase '{phase}' for {name}, "
263
+ f"invalid phase '{phase}' for {name}, "
239
264
  f"choose from one of {printable_set(config_metadata.all_job_phases)}"
240
265
  )
241
266
  )
@@ -5,9 +5,9 @@ import typing
5
5
  import yaml
6
6
  from packaging.version import Version
7
7
 
8
- from runem.log import log
8
+ from runem.log import error, log
9
9
  from runem.runem_version import get_runem_version
10
- from runem.types import Config, GlobalConfig, GlobalSerialisedConfig
10
+ from runem.types import Config, GlobalConfig, GlobalSerialisedConfig, UserConfigMetadata
11
11
 
12
12
  CFG_FILE_YAML = pathlib.Path(".runem.yml")
13
13
 
@@ -40,20 +40,53 @@ def _search_up_multiple_dirs_for_file(
40
40
  return None
41
41
 
42
42
 
43
- def _find_cfg() -> pathlib.Path:
44
- """Searches up from the cwd for a .runem.yml config file."""
43
+ def _find_config_file(
44
+ config_filename: typing.Union[str, pathlib.Path]
45
+ ) -> typing.Tuple[typing.Optional[pathlib.Path], typing.Tuple[pathlib.Path, ...]]:
46
+ """Searches up from the cwd for the given config file-name."""
45
47
  start_dirs = (pathlib.Path(".").absolute(),)
46
48
  cfg_candidate: typing.Optional[pathlib.Path] = _search_up_multiple_dirs_for_file(
47
- start_dirs, CFG_FILE_YAML
49
+ start_dirs, config_filename
48
50
  )
51
+ return cfg_candidate, start_dirs
52
+
53
+
54
+ def _find_project_cfg() -> pathlib.Path:
55
+ """Searches up from the cwd for the project .runem.yml config file."""
56
+ cfg_candidate: typing.Optional[pathlib.Path]
57
+ start_dirs: typing.Tuple[pathlib.Path, ...]
58
+ cfg_candidate, start_dirs = _find_config_file(config_filename=CFG_FILE_YAML)
59
+
49
60
  if cfg_candidate:
50
61
  return cfg_candidate
51
62
 
52
63
  # error out and exit as we currently require the cfg file as it lists jobs.
53
- log(f"ERROR: Config not found! Looked from {start_dirs}")
64
+ error(f"Config not found! Looked from {start_dirs}")
54
65
  sys.exit(1)
55
66
 
56
67
 
68
+ def _find_local_configs() -> typing.List[pathlib.Path]:
69
+ """Searches for all user-configs and returns the found ones.
70
+
71
+ TODO: add some priorities to the files, such that
72
+ - .runem.local.yml has lowest priority
73
+ - $HOME/.runem.user.yml is applied after .local
74
+ - .runem.user.yml overloads all others
75
+ """
76
+ local_configs: typing.List[pathlib.Path] = []
77
+ for config_filename in (".runem.local.yml", ".runem.user.yml"):
78
+ cfg_candidate: typing.Optional[pathlib.Path]
79
+ cfg_candidate, _ = _find_config_file(config_filename)
80
+ if cfg_candidate:
81
+ local_configs.append(cfg_candidate)
82
+
83
+ user_home_config: pathlib.Path = pathlib.Path("~/.runem.user.yml")
84
+ if user_home_config.exists():
85
+ local_configs.append(user_home_config)
86
+
87
+ return local_configs
88
+
89
+
57
90
  def _conform_global_config_types(
58
91
  all_config: Config,
59
92
  ) -> typing.Tuple[Config, typing.Optional[GlobalConfig]]:
@@ -77,9 +110,8 @@ def _conform_global_config_types(
77
110
  return all_config, global_config
78
111
 
79
112
 
80
- def load_config() -> typing.Tuple[Config, pathlib.Path]:
81
- """Finds and loads the .runem.yml file."""
82
- cfg_filepath: pathlib.Path = _find_cfg()
113
+ def load_and_parse_config(cfg_filepath: pathlib.Path) -> Config:
114
+ """For the given config file pass, project or user, load it & parse/conform it."""
83
115
  with cfg_filepath.open("r+", encoding="utf-8") as config_file_handle:
84
116
  all_config = yaml.full_load(config_file_handle)
85
117
 
@@ -104,5 +136,22 @@ def load_config() -> typing.Tuple[Config, pathlib.Path]:
104
136
  )
105
137
  )
106
138
  sys.exit(1)
139
+ return conformed_config
140
+
141
+
142
+ def load_project_config() -> typing.Tuple[Config, pathlib.Path]:
143
+ """Finds and loads the .runem.yml file for the current project."""
144
+ cfg_filepath: pathlib.Path = _find_project_cfg()
145
+ conformed_config: Config = load_and_parse_config(cfg_filepath)
107
146
 
108
147
  return conformed_config, cfg_filepath
148
+
149
+
150
+ def load_user_configs() -> UserConfigMetadata:
151
+ """Returns the user-local configs, that extend/override runem behaviour."""
152
+ user_configs: typing.List[typing.Tuple[Config, pathlib.Path]] = []
153
+ user_config_paths: typing.List[pathlib.Path] = _find_local_configs()
154
+ for config_path in user_config_paths:
155
+ user_config: Config = load_and_parse_config(config_path)
156
+ user_configs.append((user_config, config_path))
157
+ return user_configs
@@ -1,5 +1,6 @@
1
1
  import argparse
2
2
  import pathlib
3
+ import typing
3
4
 
4
5
  from runem.informative_dict import InformativeDict
5
6
  from runem.types import (
@@ -13,6 +14,9 @@ from runem.types import (
13
14
  TagFileFilters,
14
15
  )
15
16
 
17
+ if typing.TYPE_CHECKING: # pragma: no cover
18
+ from runem.hook_manager import HookManager
19
+
16
20
 
17
21
  class ConfigMetadata:
18
22
  """Full metadata about what can and should be run."""
@@ -20,6 +24,7 @@ class ConfigMetadata:
20
24
  phases: OrderedPhases # the phases and orders to run them in
21
25
  options_config: OptionConfigs # the options to add to the cli and pass to jobs
22
26
  file_filters: TagFileFilters # which files to get for which tag
27
+ hook_manager: "HookManager" # the hooks register for the run
23
28
  jobs: PhaseGroupedJobs # the jobs to be run ordered by phase
24
29
  all_job_names: JobNames # the set of job-names
25
30
  all_job_phases: JobPhases # the set of job-phases (should be subset of 'phases')
@@ -39,6 +44,7 @@ class ConfigMetadata:
39
44
  phases: OrderedPhases,
40
45
  options_config: OptionConfigs,
41
46
  file_filters: TagFileFilters,
47
+ hook_manager: "HookManager",
42
48
  jobs: PhaseGroupedJobs,
43
49
  all_job_names: JobNames,
44
50
  all_job_phases: JobPhases,
@@ -48,6 +54,8 @@ class ConfigMetadata:
48
54
  self.phases = phases
49
55
  self.options_config = options_config
50
56
  self.file_filters = file_filters
57
+ # initialise all the registered call-back hooks
58
+ self.hook_manager = hook_manager
51
59
  self.jobs = jobs
52
60
  self.all_job_names = all_job_names
53
61
  self.all_job_phases = all_job_phases