Skip to content

Commit

Permalink
Merge branch 'componentscommand' of https://github.com/mirpedrol/tools
Browse files Browse the repository at this point in the history
…into componentscommand
  • Loading branch information
mirpedrol committed Nov 8, 2022
2 parents 5d598f2 + 4eae12d commit 47dacd5
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/create-lint-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
version: ${{ matrix.NXF_VER }}

# Install the Prettier linting tools
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3

- name: Install Prettier
run: npm install -g prettier
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:

- name: Upload log file artifact
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: nf-core-log-file
path: log.txt
2 changes: 1 addition & 1 deletion .github/workflows/create-test-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Upload log file artifact
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: nf-core-log-file
path: log.txt
6 changes: 3 additions & 3 deletions .github/workflows/fix-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }}

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3

- name: Install Prettier
run: npm install -g prettier @prettier/plugin-php
Expand All @@ -39,11 +39,11 @@ jobs:
options: "--color"

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: python-isort
uses: isort/isort-action@v0.1.0
uses: isort/isort-action@v1.0.0
with:
isortVersion: "latest"
requirementsFiles: "requirements.txt requirements-dev.txt"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3

- name: Install editorconfig-checker
run: npm install -g editorconfig-checker
Expand All @@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3

- name: Install Prettier
run: npm install -g prettier
Expand Down Expand Up @@ -77,11 +77,11 @@ jobs:
uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: python-isort
uses: isort/isort-action@v0.1.0
uses: isort/isort-action@v1.1.0
with:
isortVersion: "latest"
requirementsFiles: "requirements.txt requirements-dev.txt"
4 changes: 2 additions & 2 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
else
curl -O https://nf-co.re/pipeline_names.json
fi
echo "::set-output name=matrix::$(cat pipeline_names.json)"
echo "name=matrix::$(cat pipeline_names.json)" >> $GITHUB_OUTPUT
sync:
needs: get-pipelines
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Upload sync log file artifact
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: sync_log_${{ matrix.pipeline }}
path: sync_log_${{ matrix.pipeline }}.txt
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
- Run tests with Python 3.11 ([#1970](https://github.com/nf-core/tools/pull/1970))
- 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"]
4 changes: 2 additions & 2 deletions nf_core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
organization's specification based on a template.
"""
import configparser
import imghdr
import logging
import os
import random
Expand All @@ -13,6 +12,7 @@
import time
from pathlib import Path

import filetype
import git
import jinja2
import questionary
Expand Down Expand Up @@ -492,7 +492,7 @@ def download_pipeline_logo(self, url, img_fn):
with open(img_fn, "wb") as fh:
fh.write(r.content)
# Check that the file looks valid
image_type = imghdr.what(img_fn)
image_type = filetype.guess(img_fn).extension
if image_type != "png":
log.error(f"Logo from the website didn't look like an image: '{image_type}'")
continue
Expand Down
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/.github/workflows/fix-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }}

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3

- name: Install Prettier
run: npm install -g prettier @prettier/plugin-php
Expand All @@ -34,9 +34,9 @@ jobs:
id: prettier_status
run: |
if prettier --check ${GITHUB_WORKSPACE}; then
echo "::set-output name=result::pass"
echo "name=result::pass" >> $GITHUB_OUTPUT
else
echo "::set-output name=result::fail"
echo "name=result::fail" >> $GITHUB_OUTPUT
fi
- name: Run 'prettier --write'
Expand Down
6 changes: 3 additions & 3 deletions nf_core/pipeline-template/.github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3

- name: Install editorconfig-checker
run: npm install -g editorconfig-checker
Expand All @@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3

- name: Install Prettier
run: npm install -g prettier
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:

- name: Upload linting log file artifact
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: linting-logs
path: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Get PR number
id: pr_number
run: echo "::set-output name=pr_number::$(cat linting-logs/PR_number.txt)"
run: echo "name=pr_number::$(cat linting-logs/PR_number.txt)" >> $GITHUB_OUTPUT

- name: Post PR comment
uses: marocchino/sticky-pull-request-comment@v2
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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
click
filetype
galaxy-tool-util
GitPython
jinja2
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 47dacd5

Please sign in to comment.