Skip to content

Commit

Permalink
Merge branch 'dev' into empty-file-stub
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol authored Dec 14, 2023
2 parents 471107b + e2b66c0 commit 40ee3b2
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 29 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ jobs:
id: conditions
run: echo "run-tests=${{ github.ref == 'refs/heads/master' || (matrix.runner == 'ubuntu-20.04' && matrix.python-version == '3.8') }}" >> $GITHUB_ENV

- name: Check out source-code repository
uses: actions/checkout@v4
if: ${{ env.run-tests == 'true' }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
if: ${{ env.run-tests == 'true' }}
outputs:
python-version: ${{ matrix.python-version }}
runner: ${{ matrix.runner }}
Expand Down Expand Up @@ -97,7 +87,7 @@ jobs:
path: |
/usr/local/bin/nf-test
/home/runner/.nf-test/nf-test.jar
key: ${{ runner.os }}-${{ env.NFTEST_VER }}-nftest
key: ${{ runner.os }}-nftest-${{ env.date }}

- name: Install nf-test
if: steps.cache-software.outputs.cache-hit != 'true'
Expand Down
3 changes: 3 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ tasks:
python -m pip install -r requirements-dev.txt
pre-commit install --install-hooks
nextflow self-update
- name: unset JAVA_TOOL_OPTIONS
command: |
unset JAVA_TOOL_OPTIONS
vscode:
extensions: # based on nf-core.nf-core-extensionpack
- codezombiech.gitignore # Language support for .gitignore files
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fancier syntax highlighting for example samplesheets in the usage.md template ([#2503](https://github.com/nf-core/tools/pull/2503))
- Use closure for multiqc ext.args ([#2509](https://github.com/nf-core/tools/pull/2509))
- Fix how the modules template references the conda environment file ([#2540](https://github.com/nf-core/tools/pull/2540))
- Unset env variable JAVA_TOOL_OPTIONS in gitpod ([#2569](https://github.com/nf-core/tools/pull/2569))

### Download

Expand Down Expand Up @@ -42,6 +43,7 @@
- Add mypy to pre-commit config for the tools repo ([#2545](https://github.com/nf-core/tools/pull/2545))
- Use Path objects for ComponentCreate and update the structure of components templates ([#2551](https://github.com/nf-core/tools/pull/2551)).
- GitPod base image: swap tool installation back to `conda` from `mamba` ([#2566](https://github.com/nf-core/tools/pull/2566)).
- Unset env variable JAVA_TOOL_OPTIONS in gitpod ([#2569](https://github.com/nf-core/tools/pull/2569))

# [v2.10 - Nickel Ostrich](https://github.com/nf-core/tools/releases/tag/2.10) + [2023-09-25]

Expand Down
2 changes: 2 additions & 0 deletions nf_core/components/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def install(self, component, silent=False):
self.install_included_components(component_dir)

if not silent:
modules_json.load()
modules_json.dump(run_prettier=True)
# Print include statement
component_name = "_".join(component.upper().split("/"))
log.info(f"Use the following statement to include this {self.component_type[:-1]}:")
Expand Down
33 changes: 19 additions & 14 deletions nf_core/components/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,20 +288,21 @@ def update(self, component=None, silent=False, updated=None, check_diff_exist=Tr
updated.append(component)
recursive_update = True
modules_to_update, subworkflows_to_update = self.get_components_to_update(component)
if not silent and not self.update_all and len(modules_to_update + subworkflows_to_update) > 0:
log.warning(
f"All modules and subworkflows linked to the updated {self.component_type[:-1]} will be {'asked for update' if self.show_diff else 'automatically updated'}.\n"
"It is advised to keep all your modules and subworkflows up to date.\n"
"It is not guaranteed that a subworkflow will continue working as expected if all modules/subworkflows used in it are not up to date.\n"
)
if self.update_deps:
recursive_update = True
else:
recursive_update = questionary.confirm(
"Would you like to continue updating all modules and subworkflows?",
default=True,
style=nf_core.utils.nfcore_question_style,
).unsafe_ask()
if not silent and len(modules_to_update + subworkflows_to_update) > 0:
if not self.update_all:
log.warning(
f"All modules and subworkflows linked to the updated {self.component_type[:-1]} will be {'asked for update' if self.show_diff else 'automatically updated'}.\n"
"It is advised to keep all your modules and subworkflows up to date.\n"
"It is not guaranteed that a subworkflow will continue working as expected if all modules/subworkflows used in it are not up to date.\n"
)
if self.update_deps:
recursive_update = True
else:
recursive_update = questionary.confirm(
"Would you like to continue updating all modules and subworkflows?",
default=True,
style=nf_core.utils.nfcore_question_style,
).unsafe_ask()
if recursive_update and len(modules_to_update + subworkflows_to_update) > 0:
# Update linked components
self.update_linked_components(modules_to_update, subworkflows_to_update, updated)
Expand All @@ -323,8 +324,12 @@ def update(self, component=None, silent=False, updated=None, check_diff_exist=Tr
)
elif not all_patches_successful and not silent:
log.info(f"Updates complete. Please apply failed patch{plural_es(components_info)} manually.")
self.modules_json.load()
self.modules_json.dump(run_prettier=True)
elif not silent:
log.info("Updates complete :sparkles:")
self.modules_json.load()
self.modules_json.dump(run_prettier=True)

return exit_value

Expand Down
11 changes: 8 additions & 3 deletions nf_core/modules/modules_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import shutil
import tempfile
from pathlib import Path
from typing import Union

import git
import questionary
Expand Down Expand Up @@ -41,7 +42,7 @@ def __init__(self, pipeline_dir):
self.modules_dir = Path(self.dir, "modules")
self.subworkflows_dir = Path(self.dir, "subworkflows")
self.modules_json_path = Path(self.dir, "modules.json")
self.modules_json = None
self.modules_json: Union(dict, None) = None
self.pipeline_modules = None
self.pipeline_subworkflows = None
self.pipeline_components = None
Expand Down Expand Up @@ -1035,13 +1036,17 @@ def get_component_branch(self, component_type, component, repo_url, install_dir)
)
return branch

def dump(self):
def dump(self, run_prettier: bool = False):
"""
Sort the modules.json, and write it to file
"""
# Sort the modules.json
self.modules_json["repos"] = nf_core.utils.sort_dictionary(self.modules_json["repos"])
dump_json_with_prettier(self.modules_json_path, self.modules_json)
if run_prettier:
dump_json_with_prettier(self.modules_json_path, self.modules_json)
else:
with open(self.modules_json_path, "w") as fh:
json.dump(self.modules_json, fh, indent=4)

def resolve_missing_installation(self, missing_installation, component_type):
missing_but_in_mod_json = [
Expand Down
4 changes: 3 additions & 1 deletion nf_core/pipeline-template/.gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ tasks:
command: |
pre-commit install --install-hooks
nextflow self-update
- name: unset JAVA_TOOL_OPTIONS
command: |
unset JAVA_TOOL_OPTIONS
vscode:
extensions: # based on nf-core.nf-core-extensionpack
- codezombiech.gitignore # Language support for .gitignore files
Expand Down

0 comments on commit 40ee3b2

Please sign in to comment.