runem 0.0.12__tar.gz → 0.0.14__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.
@@ -4,6 +4,34 @@ Changelog
4
4
 
5
5
  (unreleased)
6
6
  ------------
7
+ - Merge branch 'fix/working_from_non-root_dirs' [Frank Harrison]
8
+ - Chore(logs): reduces duplicate log out for tag-filters. [Frank
9
+ Harrison]
10
+ - Fixup: fixes the labels used for some jobs after simplifying params.
11
+ [Frank Harrison]
12
+ - Fix(git-ls-files): chdir to the cfg dir so git-ls-files picks up all
13
+ file. [Frank Harrison]
14
+
15
+ .... of course this assumes that the file is next to the .git directory
16
+ - Fix(job.addr): anchors the function-module lookup to the cfg file.
17
+ [Frank Harrison]
18
+
19
+ This should now be much more consistent.
20
+ - Fix(job.addr): removes deprecated code for hooks in main runem file.
21
+ [Frank Harrison]
22
+
23
+
24
+ 0.0.13 (2023-11-29)
25
+ -------------------
26
+ - Release: version 0.0.13 🚀 [Frank Harrison]
27
+ - Merge branch 'feat/better_module_find_error_msg' [Frank Harrison]
28
+ - Feat(better-module-msg): improves the information given when loading a
29
+ job address. [Frank Harrison]
30
+
31
+
32
+ 0.0.12 (2023-11-29)
33
+ -------------------
34
+ - Release: version 0.0.12 🚀 [Frank Harrison]
7
35
  - Merge branch 'chore/format_yml' [Frank Harrison]
8
36
  - Chore(format-yml): reformats the .runem.yml file. [Frank Harrison]
9
37
  - Chore(format-yml): adds yml files to the prettier command. [Frank
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.12
3
+ Version: 0.0.14
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -0,0 +1 @@
1
+ 0.0.14
@@ -651,13 +651,22 @@ def _get_test_function(
651
651
  function_to_load: str,
652
652
  ) -> JobFunction:
653
653
  """Given a job-description dynamically loads the test-function so we can call it."""
654
+
655
+ # first locate the module relative to the config file
656
+ abs_module_file_path: pathlib.Path = (
657
+ cfg_filepath.parent / module_file_path
658
+ ).absolute()
659
+
654
660
  # load the function
655
661
  module_spec = importlib.util.spec_from_file_location(
656
- function_to_load, module_file_path
662
+ function_to_load, abs_module_file_path
657
663
  )
658
664
  if not module_spec:
659
665
  raise FunctionNotFound(
660
- f"unable to load '${function_to_load}' from '{module_file_path}"
666
+ (
667
+ f"unable to load '${function_to_load}' from '{str(module_file_path)} "
668
+ f"relative to '{str(cfg_filepath)}"
669
+ )
661
670
  )
662
671
 
663
672
  module = importlib.util.module_from_spec(module_spec)
@@ -671,7 +680,7 @@ def _get_test_function(
671
680
  raise FunctionNotFound(
672
681
  (
673
682
  f"ERROR! Check that function '{function_to_load}' "
674
- f"exists in '{module_file_path}' as expected in "
683
+ f"exists in '{str(module_file_path)}' as expected in "
675
684
  f"your config at '{str(cfg_filepath)}"
676
685
  )
677
686
  ) from err
@@ -683,6 +692,7 @@ def _find_job_module(cfg_filepath: pathlib.Path, module_file_path: str) -> pathl
683
692
  module_path: pathlib.Path = pathlib.Path(module_file_path)
684
693
 
685
694
  module_path_cands = [
695
+ module_path,
686
696
  module_path.absolute(),
687
697
  (cfg_filepath.parent / module_file_path).absolute(),
688
698
  ]
@@ -697,7 +707,7 @@ def _find_job_module(cfg_filepath: pathlib.Path, module_file_path: str) -> pathl
697
707
  )
698
708
  )
699
709
  module_path = module_path.absolute()
700
- return module_path.relative_to(pathlib.Path(".").absolute())
710
+ return module_path.relative_to(cfg_filepath.parent.absolute())
701
711
 
702
712
 
703
713
  def get_test_function(job_config: JobConfig, cfg_filepath: pathlib.Path) -> JobFunction:
@@ -706,29 +716,29 @@ def get_test_function(job_config: JobConfig, cfg_filepath: pathlib.Path) -> JobF
706
716
  Also re-address the job-config.
707
717
  """
708
718
  function_to_load: str = job_config["addr"]["function"]
709
- module_file_path: pathlib.Path = _find_job_module(
710
- cfg_filepath, job_config["addr"]["file"]
711
- )
712
- module_name = module_file_path.stem.replace(" ", "_").replace("-", "_")
713
-
714
719
  try:
715
- function = _get_test_function(
716
- cfg_filepath, module_name, module_file_path, function_to_load
720
+ module_file_path: pathlib.Path = _find_job_module(
721
+ cfg_filepath, job_config["addr"]["file"]
717
722
  )
718
- except FunctionNotFound:
719
- print(
723
+ except FunctionNotFound as err:
724
+ raise FunctionNotFound(
720
725
  (
721
- f"WARNING: job: '{job_config['label']}': Failed to find "
722
- f"function file {job_config['addr']['file']}"
726
+ f"Whilst loading job '{job_config['label']}' runem failed to find "
727
+ f"job.addr.file '{job_config['addr']['file']}' looking for "
728
+ f"job.addr.function '{function_to_load}'"
723
729
  )
724
- )
725
- # re-write the file entry in the job
726
- job_config["addr"]["file"] = __file__
727
- module_file_path = pathlib.Path(job_config["addr"]["file"])
728
- # the follow may throw if the fun isn't in this file, as intended
729
- function = _get_test_function(
730
- cfg_filepath, module_name, module_file_path, function_to_load
731
- )
730
+ ) from err
731
+
732
+ anchored_file_path = cfg_filepath.parent / module_file_path
733
+ assert (
734
+ anchored_file_path.exists()
735
+ ), f"{module_file_path} not found at {anchored_file_path}!"
736
+
737
+ module_name = module_file_path.stem.replace(" ", "_").replace("-", "_")
738
+
739
+ function = _get_test_function(
740
+ cfg_filepath, module_name, module_file_path, function_to_load
741
+ )
732
742
 
733
743
  # re-write the job-config file-path for the module with the one that worked
734
744
  job_config["addr"]["file"] = str(module_file_path)
@@ -794,6 +804,10 @@ def filter_jobs(
794
804
  verbose: bool,
795
805
  ) -> PhaseGroupedJobs:
796
806
  """Filters the jobs to match requested tags."""
807
+ print(f"filtering for tags {tags_to_run}", end="")
808
+ if tags_to_avoid:
809
+ print("excluding jobs with tags {tags_to_avoid}", end="")
810
+ print()
797
811
  filtered_jobs: PhaseGroupedJobs = defaultdict(list)
798
812
  for phase in config_metadata.phases:
799
813
  if phase not in phases_to_run:
@@ -815,7 +829,7 @@ def filter_jobs(
815
829
  print(
816
830
  (
817
831
  f"will run {len(filtered_jobs[phase])} jobs "
818
- f"for phase '{phase}' with tags '{tags_to_run}'"
832
+ f"for phase '{phase}'"
819
833
  )
820
834
  )
821
835
  print(f"\t{[job['label'] for job in filtered_jobs[phase]]}")
@@ -1011,6 +1025,9 @@ def _main( # noqa: C901 # pylint: disable=too-many-branches,too-many-statements
1011
1025
  if args.verbose:
1012
1026
  print(f"loaded config from {cfg_filepath}")
1013
1027
 
1028
+ # first anchor the cwd to the config-file, so that git ls-files works
1029
+ os.chdir(cfg_filepath.parent)
1030
+
1014
1031
  file_lists: FilePathListLookup = _find_files(config_metadata)
1015
1032
  assert file_lists
1016
1033
  print(f"found {len(file_lists)} batches, ", end="")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.12
3
+ Version: 0.0.14
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -1 +0,0 @@
1
- 0.0.12
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