runem 0.0.13__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,26 @@ 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]
7
27
  - Merge branch 'feat/better_module_find_error_msg' [Frank Harrison]
8
28
  - Feat(better-module-msg): improves the information given when loading a
9
29
  job address. [Frank Harrison]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.13
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:
@@ -719,26 +729,16 @@ def get_test_function(job_config: JobConfig, cfg_filepath: pathlib.Path) -> JobF
719
729
  )
720
730
  ) from err
721
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
+
722
737
  module_name = module_file_path.stem.replace(" ", "_").replace("-", "_")
723
738
 
724
- try:
725
- function = _get_test_function(
726
- cfg_filepath, module_name, module_file_path, function_to_load
727
- )
728
- except FunctionNotFound:
729
- print(
730
- (
731
- f"WARNING: job: '{job_config['label']}': Failed to find "
732
- f"function file {job_config['addr']['file']}"
733
- )
734
- )
735
- # re-write the file entry in the job
736
- job_config["addr"]["file"] = __file__
737
- module_file_path = pathlib.Path(job_config["addr"]["file"])
738
- # the follow may throw if the fun isn't in this file, as intended
739
- function = _get_test_function(
740
- cfg_filepath, module_name, module_file_path, function_to_load
741
- )
739
+ function = _get_test_function(
740
+ cfg_filepath, module_name, module_file_path, function_to_load
741
+ )
742
742
 
743
743
  # re-write the job-config file-path for the module with the one that worked
744
744
  job_config["addr"]["file"] = str(module_file_path)
@@ -804,6 +804,10 @@ def filter_jobs(
804
804
  verbose: bool,
805
805
  ) -> PhaseGroupedJobs:
806
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()
807
811
  filtered_jobs: PhaseGroupedJobs = defaultdict(list)
808
812
  for phase in config_metadata.phases:
809
813
  if phase not in phases_to_run:
@@ -825,7 +829,7 @@ def filter_jobs(
825
829
  print(
826
830
  (
827
831
  f"will run {len(filtered_jobs[phase])} jobs "
828
- f"for phase '{phase}' with tags '{tags_to_run}'"
832
+ f"for phase '{phase}'"
829
833
  )
830
834
  )
831
835
  print(f"\t{[job['label'] for job in filtered_jobs[phase]]}")
@@ -1021,6 +1025,9 @@ def _main( # noqa: C901 # pylint: disable=too-many-branches,too-many-statements
1021
1025
  if args.verbose:
1022
1026
  print(f"loaded config from {cfg_filepath}")
1023
1027
 
1028
+ # first anchor the cwd to the config-file, so that git ls-files works
1029
+ os.chdir(cfg_filepath.parent)
1030
+
1024
1031
  file_lists: FilePathListLookup = _find_files(config_metadata)
1025
1032
  assert file_lists
1026
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.13
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.13
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