Skip to content

Commit

Permalink
Merge branch 'dev' into componentscommand
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol authored Nov 8, 2022
2 parents d2da8e6 + 3d0c0cc commit 4eae12d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Bump promoted Python version from 3.7 to 3.8 ([#1971](https://github.com/nf-core/tools/pull/1971))
- Fix incorrect file deletion in `nf-core launch` when `--params_in` has the same name as `--params_out`
- Updated GitHub actions ([#1998](https://github.com/nf-core/tools/pull/1998), [#2001](https://github.com/nf-core/tools/pull/2001))
- Track from where modules and subworkflows are installed ([#1999](https://github.com/nf-core/tools/pull/1999))
- Substitute ModulesCommand and SubworkflowsCommand by ComponentsCommand ([#2000](https://github.com/nf-core/tools/pull/2000))

### Modules
Expand Down
2 changes: 1 addition & 1 deletion nf_core/components/components_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ def clean_modules_json(component, component_type, modules_repo, modules_json):
f"Removing {component_type[:-1]} '{modules_repo.repo_path}/{component}' from repo '{repo_to_remove}' from modules.json"
)
modules_json.remove_entry(component_type, component, repo_to_remove, modules_repo.repo_path)
return component_values["installed"]
return component_values["installed_by"]
28 changes: 14 additions & 14 deletions nf_core/modules/modules_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def determine_module_branches_and_shas(self, install_dir, remote_url, modules):
repo_entry[module] = {
"branch": modules_repo.branch,
"git_sha": correct_commit_sha,
"installed": "modules",
"installed_by": "modules",
}

# Clean up the modules we were unable to find the sha for
Expand Down Expand Up @@ -481,8 +481,8 @@ def check_up_to_date(self):
If a module/subworkflow is installed but the entry in 'modules.json' is missing we iterate through
the commit log in the remote to try to determine the SHA.
Check that we have the "installed" value in 'modules.json', otherwise add it.
Assume that the modules/subworkflows were installed by and nf-core command (don't track installed by subworkflows).
Check that we have the "installed_by" value in 'modules.json', otherwise add it.
Assume that the modules/subworkflows were installed by an nf-core command (don't track installed by subworkflows).
"""
try:
self.load()
Expand Down Expand Up @@ -517,13 +517,13 @@ def check_up_to_date(self):
if len(subworkflows_missing_from_modules_json) > 0:
self.resolve_missing_from_modules_json(subworkflows_missing_from_modules_json, "subworkflows")

# If the "installed" value is not present for modules/subworkflows, add it.
# If the "installed_by" value is not present for modules/subworkflows, add it.
for repo, repo_content in self.modules_json["repos"].items():
for component_type, dir_content in repo_content.items():
for install_dir, installed_components in dir_content.items():
for component, component_features in installed_components.items():
if "installed" not in component_features:
self.modules_json["repos"][repo][component_type][install_dir][component]["installed"] = [
if "installed_by" not in component_features:
self.modules_json["repos"][repo][component_type][install_dir][component]["installed_by"] = [
component_type
]

Expand Down Expand Up @@ -572,12 +572,12 @@ def update(self, modules_repo, module_name, module_version, installed_by, instal
repo_modules_entry[module_name]["git_sha"] = module_version
repo_modules_entry[module_name]["branch"] = branch
try:
if installed_by not in repo_modules_entry[module_name]["installed"]:
repo_modules_entry[module_name]["installed"].append(installed_by)
if installed_by not in repo_modules_entry[module_name]["installed_by"]:
repo_modules_entry[module_name]["installed_by"].append(installed_by)
except KeyError:
repo_modules_entry[module_name]["installed"] = [installed_by]
repo_modules_entry[module_name]["installed_by"] = [installed_by]
finally:
repo_modules_entry[module_name]["installed"].extend(installed_by_log)
repo_modules_entry[module_name]["installed_by"].extend(installed_by_log)

# Sort the 'modules.json' repo entries
self.modules_json["repos"] = nf_core.utils.sort_dictionary(self.modules_json["repos"])
Expand Down Expand Up @@ -616,12 +616,12 @@ def update_subworkflow(
repo_subworkflows_entry[subworkflow_name]["git_sha"] = subworkflow_version
repo_subworkflows_entry[subworkflow_name]["branch"] = branch
try:
if installed_by not in repo_subworkflows_entry[subworkflow_name]["installed"]:
repo_subworkflows_entry[subworkflow_name]["installed"].append(installed_by)
if installed_by not in repo_subworkflows_entry[subworkflow_name]["installed_by"]:
repo_subworkflows_entry[subworkflow_name]["installed_by"].append(installed_by)
except KeyError:
repo_subworkflows_entry[subworkflow_name]["installed"] = [installed_by]
repo_subworkflows_entry[subworkflow_name]["installed_by"] = [installed_by]
finally:
repo_subworkflows_entry[subworkflow_name]["installed"].extend(installed_by_log)
repo_subworkflows_entry[subworkflow_name]["installed_by"].extend(installed_by_log)

# Sort the 'modules.json' repo entries
self.modules_json["repos"] = nf_core.utils.sort_dictionary(self.modules_json["repos"])
Expand Down
6 changes: 3 additions & 3 deletions nf_core/pipeline-template/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"custom/dumpsoftwareversions": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed": ["modules"]
"installed_by": ["modules"]
},
"fastqc": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed": ["modules"]
"installed_by": ["modules"]
},
"multiqc": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed": ["modules"]
"installed_by": ["modules"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/modules_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_mod_json_update(self):
NF_CORE_MODULES_DEFAULT_BRANCH
== mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"]["nf-core"]["MODULE_NAME"]["branch"]
)
assert "modules" in mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"]["nf-core"]["MODULE_NAME"]["installed"]
assert "modules" in mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"]["nf-core"]["MODULE_NAME"]["installed_by"]


def test_mod_json_create(self):
Expand Down

0 comments on commit 4eae12d

Please sign in to comment.