From 8cd60e189f306796ec5e1235886c7934b8a01e6f Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 27 Oct 2020 10:58:09 +0100 Subject: [PATCH 01/51] Version 1.12dev bump --- CHANGELOG.md | 11 +++++++++++ setup.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d91c1f5cb..617c1f29d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # nf-core/tools: Changelog +## v1.12dev + +### Tools helper code + +### Template + +### Linting + +### Other + + ## [v1.11 - Iron Tiger](https://github.com/nf-core/tools/releases/tag/1.11) - [2020-10-27] ### Template diff --git a/setup.py b/setup.py index afe3ae7db..16c80531b 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages import sys -version = "1.11" +version = "1.12dev" with open("README.md") as f: readme = f.read() From 26dc763495f72e8f1a80c8395c22af4425d8b3cc Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 27 Oct 2020 11:00:34 +0100 Subject: [PATCH 02/51] too many newlines\! --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 617c1f29d..5e07164df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ ### Other - ## [v1.11 - Iron Tiger](https://github.com/nf-core/tools/releases/tag/1.11) - [2020-10-27] ### Template From 2f4194a2d6a5e3ec26d0bddeeeac15cd87d06f89 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Nov 2020 12:16:58 +0100 Subject: [PATCH 03/51] Logging - force colours if certain env vars are set. --- nf_core/__main__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 6eebbe881..a1d7f726f 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -28,13 +28,18 @@ # Submodules should all traverse back to this log = logging.getLogger() +# Should we force coloured output from Rich? +rich_force_colors = None +if os.getenv("GITHUB_ACTIONS") or os.getenv("FORCE_COLOR") or os.getenv("PY_COLORS"): + rich_force_colors = True + def run_nf_core(): # Set up the rich traceback rich.traceback.install(width=200, word_wrap=True) # Print nf-core header to STDERR - stderr = rich.console.Console(file=sys.stderr) + stderr = rich.console.Console(file=sys.stderr, force_terminal=rich_force_colors) stderr.print("\n[green]{},--.[grey39]/[green],-.".format(" " * 42), highlight=False) stderr.print("[blue] ___ __ __ __ ___ [green]/,-._.--~\\", highlight=False) stderr.print("[blue] |\ | |__ __ / ` / \ |__) |__ [yellow] } {", highlight=False) @@ -114,7 +119,7 @@ def nf_core_cli(verbose, log_file): log.addHandler( rich.logging.RichHandler( level=logging.DEBUG if verbose else logging.INFO, - console=rich.console.Console(file=sys.stderr), + console=rich.console.Console(file=sys.stderr, force_terminal=rich_force_colors), show_time=False, markup=True, ) From 29ce8b36c3af82524d5d6a941c7c5167bf4ce739 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Nov 2020 12:23:54 +0100 Subject: [PATCH 04/51] Add to utils function, apply to lint and launch console functions --- nf_core/__main__.py | 9 ++------- nf_core/launch.py | 2 +- nf_core/lint.py | 2 +- nf_core/utils.py | 9 +++++++++ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index a1d7f726f..ec3c1aa2a 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -28,18 +28,13 @@ # Submodules should all traverse back to this log = logging.getLogger() -# Should we force coloured output from Rich? -rich_force_colors = None -if os.getenv("GITHUB_ACTIONS") or os.getenv("FORCE_COLOR") or os.getenv("PY_COLORS"): - rich_force_colors = True - def run_nf_core(): # Set up the rich traceback rich.traceback.install(width=200, word_wrap=True) # Print nf-core header to STDERR - stderr = rich.console.Console(file=sys.stderr, force_terminal=rich_force_colors) + stderr = rich.console.Console(file=sys.stderr, force_terminal=nf_core.utils.rich_force_colors()) stderr.print("\n[green]{},--.[grey39]/[green],-.".format(" " * 42), highlight=False) stderr.print("[blue] ___ __ __ __ ___ [green]/,-._.--~\\", highlight=False) stderr.print("[blue] |\ | |__ __ / ` / \ |__) |__ [yellow] } {", highlight=False) @@ -119,7 +114,7 @@ def nf_core_cli(verbose, log_file): log.addHandler( rich.logging.RichHandler( level=logging.DEBUG if verbose else logging.INFO, - console=rich.console.Console(file=sys.stderr, force_terminal=rich_force_colors), + console=rich.console.Console(file=sys.stderr, force_terminal=nf_core.utils.rich_force_colors()), show_time=False, markup=True, ) diff --git a/nf_core/launch.py b/nf_core/launch.py index 488d19c22..162cf5062 100644 --- a/nf_core/launch.py +++ b/nf_core/launch.py @@ -640,7 +640,7 @@ def validate_pattern(val): def print_param_header(self, param_id, param_obj): if "description" not in param_obj and "help_text" not in param_obj: return - console = Console() + console = Console(nf_core.utils.rich_force_colors()) console.print("\n") console.print(param_obj.get("title", param_id), style="bold") if "description" in param_obj: diff --git a/nf_core/lint.py b/nf_core/lint.py index 9b62da320..1fb0aeac6 100755 --- a/nf_core/lint.py +++ b/nf_core/lint.py @@ -1307,7 +1307,7 @@ def check_schema_params(self): def print_results(self, show_passed=False): log.debug("Printing final results") - console = Console() + console = Console(force_terminal=nf_core.utils.rich_force_colors()) # Helper function to format test links nicely def format_result(test_results, table): diff --git a/nf_core/utils.py b/nf_core/utils.py index c0eb461e3..f09c4bd3c 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -43,6 +43,15 @@ def check_if_outdated(current_version=None, remote_version=None, source_url="htt return (is_outdated, current_version, remote_version) +def rich_force_colors(): + """ + Check if any environment variables are set to force Rich to use coloured output + """ + if os.getenv("GITHUB_ACTIONS") or os.getenv("FORCE_COLOR") or os.getenv("PY_COLORS"): + return True + return None + + def fetch_wf_config(wf_path): """Uses Nextflow to retrieve the the configuration variables from a Nextflow workflow. From d2ee7b69fba6b4d47874bed83a9adb17da644762 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Nov 2020 12:26:04 +0100 Subject: [PATCH 05/51] Add tests for new utils function --- tests/test_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 9c73919ad..f4874506b 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -4,6 +4,7 @@ import nf_core.utils +import os import unittest @@ -39,3 +40,15 @@ def test_check_if_outdated_5(self): remote_version = "1.11" is_outdated, current, remote = nf_core.utils.check_if_outdated(current_version, remote_version) assert is_outdated + + def test_rich_force_colours_false(self): + os.environ.pop("GITHUB_ACTIONS", None) + os.environ.pop("FORCE_COLOR", None) + os.environ.pop("PY_COLORS", None) + assert nf_core.utils.rich_force_colors() is None + + def test_rich_force_colours_true(self): + os.environ["GITHUB_ACTIONS"] = True + os.environ.pop("FORCE_COLOR", None) + os.environ.pop("PY_COLORS", None) + assert nf_core.utils.rich_force_colors() is True From e9d7c86cf18ebbec0918b751a1f87beffe282e1c Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Nov 2020 12:33:25 +0100 Subject: [PATCH 06/51] Fix new utils test --- tests/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index f4874506b..b533abb7a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -48,7 +48,7 @@ def test_rich_force_colours_false(self): assert nf_core.utils.rich_force_colors() is None def test_rich_force_colours_true(self): - os.environ["GITHUB_ACTIONS"] = True + os.environ["GITHUB_ACTIONS"] = "1" os.environ.pop("FORCE_COLOR", None) os.environ.pop("PY_COLORS", None) assert nf_core.utils.rich_force_colors() is True From cfe7ce5481329ed8b7a0754d81e596eecc931251 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Nov 2020 13:06:04 +0100 Subject: [PATCH 07/51] Missed a function argument name --- nf_core/launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/launch.py b/nf_core/launch.py index 162cf5062..8d64a612b 100644 --- a/nf_core/launch.py +++ b/nf_core/launch.py @@ -640,7 +640,7 @@ def validate_pattern(val): def print_param_header(self, param_id, param_obj): if "description" not in param_obj and "help_text" not in param_obj: return - console = Console(nf_core.utils.rich_force_colors()) + console = Console(force_terminal=nf_core.utils.rich_force_colors()) console.print("\n") console.print(param_obj.get("title", param_id), style="bold") if "description" in param_obj: From 99bf59234ddba8591cbeb2b1dc6cb93a48b994ad Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Nov 2020 13:06:40 +0100 Subject: [PATCH 08/51] Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e07164df..362b1dda6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Linting +* Updated code to display colours in GitHub Actions log output + ### Other ## [v1.11 - Iron Tiger](https://github.com/nf-core/tools/releases/tag/1.11) - [2020-10-27] From c77ccb3591ed404329cd7ebbef09ac84beffff98 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 5 Nov 2020 13:34:57 +0100 Subject: [PATCH 09/51] Get GitHub issue templates working again --- .github/ISSUE_TEMPLATE/bug_report.md | 44 +++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 8 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 32 ++++++++++++++ CHANGELOG.md | 2 + .../.github/ISSUE_TEMPLATE/bug_report.md | 7 ++- .../.github/ISSUE_TEMPLATE/config.yml | 8 ++++ .../.github/ISSUE_TEMPLATE/feature_request.md | 6 +++ 7 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..9023381e9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,44 @@ +--- +name: Bug report +about: Report something that is broken or incorrect +labels: bug +--- + + + +## Description of the bug + + + +## Steps to reproduce + +Steps to reproduce the behaviour: + +1. Command line: +2. See error: + +## Expected behaviour + + + +## System + +- Hardware: +- Executor: +- OS: +- Version + +## Nextflow Installation + +- Version: + +## Additional context + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..2a0317913 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Join nf-core + url: https://nf-co.re/join + about: Please join the nf-core community here + - name: "Slack #tools channel" + url: https://nfcore.slack.com/channels/tools + about: Discussion about the nf-core/tools package diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..8c4e9237f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,32 @@ +--- +name: Feature request +about: Suggest an idea for the nf-core website +labels: enhancement +--- + + + +## Is your feature request related to a problem? Please describe + + + + + +## Describe the solution you'd like + + + +## Describe alternatives you've considered + + + +## Additional context + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 362b1dda6..ee558c03c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Template +* Updated GitHub issue templates, which had stopped working + ### Linting * Updated code to display colours in GitHub Actions log output diff --git a/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/bug_report.md b/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/bug_report.md index 30a5ef8b4..6f384d628 100644 --- a/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/bug_report.md +++ b/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,15 @@ +--- +name: Bug report +about: Report something that is broken or incorrect +labels: bug +--- + diff --git a/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/config.yml b/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..c812ac10f --- /dev/null +++ b/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Join nf-core + url: https://nf-co.re/join + about: Please join the nf-core community here + - name: "Slack #{{ cookiecutter.short_name }} channel" + url: https://nfcore.slack.com/channels/{{ cookiecutter.short_name }} + about: Discussion about the {{ cookiecutter.name }} pipeline diff --git a/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/feature_request.md b/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/feature_request.md index 199fb5d52..27176dcc5 100644 --- a/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/feature_request.md +++ b/nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,3 +1,9 @@ +--- +name: Feature request +about: Suggest an idea for the nf-core website +labels: enhancement +--- + - Executor: - OS: -- Version +- Version of nf-core/tools: +- Python version: ## Nextflow Installation