runem 0.0.3__py3-none-any.whl → 0.0.5__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.
runem/py.typed ADDED
File without changes
runem/run_command.py CHANGED
@@ -37,7 +37,7 @@ def run_command( # noqa: C901 # pylint: disable=too-many-branches
37
37
  valid_exit_ids = (0,)
38
38
 
39
39
  # create a new env with overrides
40
- run_env = {"LANG_DO_PRINTS": "False"}
40
+ run_env: typing.Dict[str, str] = {"LANG_DO_PRINTS": "False"}
41
41
 
42
42
  if verbose:
43
43
  run_env = {"LANG_DO_PRINTS": "True"}
@@ -58,28 +58,28 @@ def run_command( # noqa: C901 # pylint: disable=too-many-branches
58
58
  if env_overrides:
59
59
  env_overrides_dict = env_overrides
60
60
  # merge the overrides into the env
61
- run_env = {**run_env, **os.environ.copy(), **env_overrides_dict}
61
+ run_env = {
62
+ **run_env,
63
+ **os.environ.copy(),
64
+ **env_overrides_dict,
65
+ }
66
+
67
+ run_env_param: typing.Optional[typing.Dict[str, str]] = None
68
+ if run_env:
69
+ run_env_param = run_env
62
70
 
63
71
  if verbose:
64
72
  print("lursight: test: " + "=" * TERMINAL_WIDTH)
65
73
 
66
74
  process: subprocess.CompletedProcess
67
75
  try:
68
- if run_env:
69
- process = subprocess.run(
70
- cmd,
71
- check=False, # Do NOT throw on non-zero exit
72
- env=run_env,
73
- stdout=subprocess.PIPE,
74
- stderr=subprocess.STDOUT,
75
- ) # raise on non-zero
76
- else:
77
- process = subprocess.run(
78
- cmd,
79
- check=False, # Do NOT throw on non-zero exit
80
- stdout=subprocess.PIPE,
81
- stderr=subprocess.STDOUT,
82
- ) # raise on non-zero
76
+ process = subprocess.run(
77
+ cmd,
78
+ check=False, # Do NOT throw on non-zero exit
79
+ env=run_env_param,
80
+ stdout=subprocess.PIPE,
81
+ stderr=subprocess.STDOUT,
82
+ ) # raise on non-zero
83
83
  if process.returncode not in valid_exit_ids:
84
84
  valid_exit_strs = ",".join([str(exit_code) for exit_code in valid_exit_ids])
85
85
  raise RuntimeError(
runem/runem.py CHANGED
@@ -910,10 +910,11 @@ def _plot_times(
910
910
  overall_run_time: timedelta,
911
911
  phase_run_oder: OrderedPhases,
912
912
  timing_data: TimingDataPhase,
913
- ):
913
+ ) -> timedelta:
914
914
  """Prints a report to terminal on how well we performed."""
915
915
  labels: typing.List[str] = []
916
916
  times: typing.List[float] = []
917
+ job_time_sum: timedelta = timedelta() # init to 0
917
918
  for phase in phase_run_oder:
918
919
  # print(f"Phase '{phase}' jobs took:")
919
920
  phase_total_time: float = 0.0
@@ -923,6 +924,7 @@ def _plot_times(
923
924
  continue
924
925
  labels.append(f"│├{phase}.{label}")
925
926
  times.append(job_time.total_seconds())
927
+ job_time_sum += job_time
926
928
  phase_total_time += job_time.total_seconds()
927
929
  labels.insert(phase_start_idx, f"├{phase} (total)")
928
930
  times.insert(phase_start_idx, phase_total_time)
@@ -940,6 +942,9 @@ def _plot_times(
940
942
  for label, time in zip(labels, times):
941
943
  print(f"{label}: {time}s")
942
944
 
945
+ time_saved: timedelta = job_time_sum - overall_run_time
946
+ return time_saved
947
+
943
948
 
944
949
  def _main( # noqa: C901 # pylint: disable=too-many-branches,too-many-statements
945
950
  argv: typing.List[str],
@@ -1004,8 +1009,8 @@ def _main( # noqa: C901 # pylint: disable=too-many-branches,too-many-statements
1004
1009
  continue
1005
1010
  print(
1006
1011
  (
1007
- f"Running '{phase}' with {num_concurrent_procs} concurrent "
1008
- f"processes across {len(jobs)} jobs"
1012
+ f"Running '{phase}' with {num_concurrent_procs} workers "
1013
+ f"processesing {len(jobs)} jobs"
1009
1014
  )
1010
1015
  )
1011
1016
  with multiprocessing.Pool(processes=num_concurrent_procs) as pool:
@@ -1034,12 +1039,17 @@ def timed_main(argv: typing.List[str]) -> None:
1034
1039
  phase_run_oder, job_times = _main(argv)
1035
1040
  end = timer()
1036
1041
  time_taken: timedelta = timedelta(seconds=end - start)
1037
- _plot_times(
1042
+ time_saved: timedelta = _plot_times(
1038
1043
  overall_run_time=time_taken,
1039
1044
  phase_run_oder=phase_run_oder,
1040
1045
  timing_data=job_times,
1041
1046
  )
1042
- print(f"DONE: ran in: {time_taken.total_seconds()}s")
1047
+ print(
1048
+ (
1049
+ f"DONE: runem took: {time_taken.total_seconds()}s, "
1050
+ f"saving you {time_saved.total_seconds()}s"
1051
+ )
1052
+ )
1043
1053
 
1044
1054
 
1045
1055
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -31,7 +31,7 @@ Requires-Dist: types-setuptools ; extra == 'test'
31
31
 
32
32
  # Run 'em: Run your developer-local tasks faster
33
33
 
34
- ## Overview
34
+ ## 1. Overview
35
35
 
36
36
  `runem` (run 'em) is a utility designed to optimise the process of running developer jobs concurrently.
37
37
 
@@ -40,21 +40,26 @@ Job definitions are declarative and simple and the reports show how long each jo
40
40
  The name "runem" is derived from the fusion of "run" and "them," encapsulating the essence of executing tasks seamlessly.
41
41
 
42
42
  - [Run 'em: Run your developer-local tasks faster](#run-em-run-your-developer-local-tasks-faster)
43
- - [Overview](#overview)
44
- - [Features](#features)
45
- - [Installation](#installation)
46
- - [Usage](#usage)
47
- - [1. Basic Usage](#1-basic-usage)
48
- - [2. Using Help to get an Overview of Your Jobs](#2-using-help-to-get-an-overview-of-your-jobs)
49
- - [3. Configuration](#3-configuration)
50
- - [3.1. `config` - Run 'em global config](#31-config---run-em-global-config)
51
- - [3.2. `job` - Job config](#32-job---job-config)
43
+ - [1. Overview](#1-overview)
44
+ - [2. Features](#2-features)
45
+ - [3. Installation](#3-installation)
46
+ - [4. Basic Usage](#4-basic-usage)
47
+ - [4.1. Tag filters](#41-tag-filters)
48
+ - [4.1.1. Run jobs only with the 'lint' tag:](#411-run-jobs-only-with-the-lint-tag)
49
+ - [4.1.2. If you want to lint all code _except_ nodejs code (and you have the apprpriate tags):](#412-if-you-want-to-lint-all-code-except-nodejs-code-and-you-have-the-apprpriate-tags)
50
+ - [4.2. phase filters](#42-phase-filters)
51
+ - [4.2.1 Focus on a phase](#421-focus-on-a-phase)
52
+ - [4.2.2 Exclude slow phases temporarily](#422-exclude-slow-phases-temporarily)
53
+ - [5. Using Help to get an Overview of Your Jobs](#5-using-help-to-get-an-overview-of-your-jobs)
54
+ - [6. Configuration](#6-configuration)
55
+ - [6.1. `config` - Run 'em global config](#61-config---run-em-global-config)
56
+ - [6.2. `job` - Job config](#62-job---job-config)
52
57
  - [Contributing to and supporting runem](#contributing-to-and-supporting-runem)
53
58
  - [Development](#development)
54
59
  - [Sponsor](#sponsor)
55
60
 
56
61
 
57
- ## Features
62
+ ## 2. Features
58
63
 
59
64
  - **Tagged Jobs:** Use tagging to define which type of jobs you want to run, be it `pre-commit`, `lint`, `test` or in multi-project codebases to split between running `python`, `node.js` or `c++` jobs, depending on the context you are working in!
60
65
 
@@ -62,22 +67,69 @@ The name "runem" is derived from the fusion of "run" and "them," encapsulating t
62
67
 
63
68
  - **Data-Driven Test Management:** Drive your tests with data, making it easy to adapt and scale your testing suite to various scenarios, allowing you to execute, track, and analyze your dev-ops suite with ease.
64
69
 
65
- ## Installation
70
+ ## 3. Installation
66
71
 
67
72
  ```bash
68
73
  pip install runem
69
74
  ```
70
- ## Usage
71
75
 
72
- ### 1. Basic Usage
76
+ ## 4. Basic Usage
73
77
 
74
78
  ```bash
75
- $ python -m runem
79
+ $ runem [--tags tag1,tag2,tag3] [--not-tags tag1,tag2,tag3] \
80
+ [--phases phaseX, phaseY] \
81
+ [--MY-OPTION] [--not-MY-OPTION]
76
82
  #or
77
- $ runem
83
+ $ python -m runem [--tags tag1,tag2,tag3] [--not-tags tag1,tag2,tag3] \
84
+ [--phases phaseX, phaseY] \
85
+ [--MY-OPTION] [--not-MY-OPTION]
78
86
  ```
79
87
 
80
- ### 2. Using Help to get an Overview of Your Jobs
88
+ ### 4.1. Tag filters
89
+ You can control which types of jobs to run via tag. Just tag the job in the config and then from the command-line you can add `--tags` or `--not-tags` to refine exactly which jobs will be run.
90
+
91
+ To run only run jobs that have the `python` tag (for example, you define the tags) you would do the following:
92
+
93
+ ```bash
94
+ runem --tags python
95
+ ```
96
+
97
+ #### 4.1.1. Run jobs only with the 'lint' tag:
98
+
99
+ ```bash
100
+ runem --tags lint
101
+ ```
102
+
103
+ #### 4.1.2. If you want to lint all code _except_ nodejs code (and you have the apprpriate tags):
104
+
105
+ ```bash
106
+ runem --tags lint --not-tags deprecated
107
+ ```
108
+
109
+ ### 4.2. phase filters
110
+
111
+ Sometimes you know you just want to run a specific phase to iterate quickly within that phase-context.
112
+
113
+ #### 4.2.1 Focus on a phase
114
+
115
+ For example you might want to run the 'reformat' phase as you're preparing a commit and are just made cosmetic changes e.g. updating the docs.
116
+
117
+ ```bash
118
+ runem --phase reformat
119
+ ```
120
+
121
+ #### 4.2.2 Exclude slow phases temporarily
122
+
123
+ Or you are tightly iterating on the 'test' phase coverage and do not care about formating as long as you can see your coverage results ASAP, but everything that comes after that stage. So if you have 4 stages `bootstrap`, `pre-run`, `reformat`, `test` and `verify` you can exlude the slower reformat-stage with the following and everything else will run
124
+
125
+ ```bash
126
+ runem --not-phase pre-run reformat
127
+ ```
128
+
129
+ **Note:** The `--tags` and `--not-tags` options can be used in combination to further refine task execution based on your requirements.
130
+
131
+
132
+ ## 5. Using Help to get an Overview of Your Jobs
81
133
 
82
134
  The `--help` switch will show you a full list of all the configured job-tasks, the tags and the override options, describing how to configure a specific run.
83
135
  ```bash
@@ -166,7 +218,7 @@ job-param overrides:
166
218
  ```
167
219
  </details>
168
220
 
169
- ### 3. Configuration
221
+ ## 6. Configuration
170
222
 
171
223
  `runem` searches for `.runem.yml` and will pre-load the command-line options with
172
224
 
@@ -175,7 +227,7 @@ Configuration is Yaml and consists of two main configurations, `config` and `job
175
227
  - `config` describes how the jobs should be run.
176
228
  - each `job` entry descibe a job-task, such and running unit-tests, linting or running any other type of command.
177
229
 
178
- #### 3.1. `config` - Run 'em global config
230
+ ### 6.1. `config` - Run 'em global config
179
231
 
180
232
  - **phases:**
181
233
  - *Description:* Specifies the different phases of the testing process, in the order they are to be run. Each job will be run under a specific phase.
@@ -195,7 +247,7 @@ Configuration is Yaml and consists of two main configurations, `config` and `job
195
247
  - **desc:** Provides a description of the option.
196
248
  - **alias:** (Optional) Provides an alias for the option if specified.
197
249
 
198
- #### 3.2. `job` - Job config
250
+ ### 6.2. `job` - Job config
199
251
  - **job:**
200
252
  - *Description:* Represents a specific job task that is to be run asynchorounsly.
201
253
  - *Fields:*
@@ -261,6 +313,7 @@ Configuration is Yaml and consists of two main configurations, `config` and `job
261
313
  - subproject4
262
314
  - pretty
263
315
 
316
+
264
317
  ---
265
318
  # Contributing to and supporting runem
266
319
 
@@ -0,0 +1,14 @@
1
+ runem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ runem/__main__.py,sha256=dsOiVZegpfK9JOs5n7UmbX5iwwbj7iFkEbLoVeEgAn4,136
3
+ runem/base.py,sha256=EZfR7FIlwEdU9Vfe47Wk2DOO8GQqpKxxLNKp6YHueZ4,316
4
+ runem/cli.py,sha256=YFwon1P7uSpAYNuJxe2f0wo0HpI3OYTQ-UBWx6xU1iY,145
5
+ runem/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ runem/run_command.py,sha256=HycJUwalnItL9gVtIjrg2QyxW0lLcnEUdbmCRkbxFS4,3700
7
+ runem/runem.py,sha256=tLhVEZVdmhV6HjMPrBu03-kSB_0A3JWDHothrhW1BWE,33885
8
+ scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ runem-0.0.5.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
10
+ runem-0.0.5.dist-info/METADATA,sha256=h0sa0E1DWzu6_ij0-PChRm5uZQ03ebGY7MunqI8_K1c,14962
11
+ runem-0.0.5.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
12
+ runem-0.0.5.dist-info/entry_points.txt,sha256=nu0g_vBeuPihYtimbtlNusxWovylMppvJ8UxdJlJfvM,46
13
+ runem-0.0.5.dist-info/top_level.txt,sha256=rd8MZEjuPdjwXuLZlbdZEg8_WGxrY1c8M36uHjNjbNk,14
14
+ runem-0.0.5.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- runem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- runem/__main__.py,sha256=dsOiVZegpfK9JOs5n7UmbX5iwwbj7iFkEbLoVeEgAn4,136
3
- runem/base.py,sha256=EZfR7FIlwEdU9Vfe47Wk2DOO8GQqpKxxLNKp6YHueZ4,316
4
- runem/cli.py,sha256=YFwon1P7uSpAYNuJxe2f0wo0HpI3OYTQ-UBWx6xU1iY,145
5
- runem/run_command.py,sha256=JVQXalGCSmMY6YB5bgHLkKEODCxi5fnE4UyGpoEcImg,3826
6
- runem/runem.py,sha256=JY216pvzaGEo7FGmuam4dEb9QGmmGGfXbQbLPYNV4f4,33580
7
- scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- runem-0.0.3.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
9
- runem-0.0.3.dist-info/METADATA,sha256=0U7X2MmzZO9aDCkj_MsGId7FAYggtvKKXpbHoI1x1Nc,12674
10
- runem-0.0.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
11
- runem-0.0.3.dist-info/entry_points.txt,sha256=nu0g_vBeuPihYtimbtlNusxWovylMppvJ8UxdJlJfvM,46
12
- runem-0.0.3.dist-info/top_level.txt,sha256=rd8MZEjuPdjwXuLZlbdZEg8_WGxrY1c8M36uHjNjbNk,14
13
- runem-0.0.3.dist-info/RECORD,,
File without changes
File without changes