From 8713291289e2cea9c3f0d5b0c136b7e7e3ae6a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Tue, 3 May 2022 16:11:39 +0200 Subject: [PATCH 01/24] add isort workflow --- .github/workflows/isort.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/isort.yml diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml new file mode 100644 index 000000000..5ff0446fa --- /dev/null +++ b/.github/workflows/isort.yml @@ -0,0 +1,27 @@ +name: Run isort +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out source-code repository + uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip -r requirements-dev.txt + pip install -e . + + - name: Install isort + run: pip install isort + + - uses: jamescurtin/isort-action@master + with: + configuration: "--profile black" + requirementsFiles: "requirements.txt requirements-dev.txt" From c741cd159bae660c4b3bf4c801c0939b7337a150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Thu, 5 May 2022 14:34:19 +0200 Subject: [PATCH 02/24] add isort to lint-code workflow --- .github/workflows/isort.yml | 27 --------------------------- .github/workflows/lint-code.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/isort.yml diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml deleted file mode 100644 index 5ff0446fa..000000000 --- a/.github/workflows/isort.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Run isort -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out source-code repository - uses: actions/checkout@v2 - - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip -r requirements-dev.txt - pip install -e . - - - name: Install isort - run: pip install isort - - - uses: jamescurtin/isort-action@master - with: - configuration: "--profile black" - requirementsFiles: "requirements.txt requirements-dev.txt" diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 2f6f046cb..d422cee0a 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -58,3 +58,29 @@ jobs: Thanks again for your contribution! repo-token: ${{ secrets.GITHUB_TOKEN }} allow-repeats: false + + Isort: + runs-on: ubuntu-latest + steps: + - name: Check out source-code repository + uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip -r requirements-dev.txt + pip install -e . + + - name: Install isort + run: pip install isort + + - name: python-isort + uses: isort/isort-action@v0.1.0 + with: + isortVersion: "latest" + configuration: "--profile black" + requirementsFiles: "requirements.txt requirements-dev.txt" From 153c0e0190b93e4fc9b068a7b7a8197fb7e4aeb5 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Tue, 17 May 2022 16:04:13 +0200 Subject: [PATCH 03/24] run isort --- docs/api/make_lint_md.py | 1 + nf_core/__main__.py | 5 +- nf_core/bump_version.py | 4 +- nf_core/create.py | 9 +-- nf_core/download.py | 15 +++-- nf_core/launch.py | 12 ++-- nf_core/licences.py | 5 +- nf_core/lint/__init__.py | 13 ++-- nf_core/lint/actions_awsfulltest.py | 1 + nf_core/lint/actions_awstest.py | 1 + nf_core/lint/actions_ci.py | 1 + nf_core/lint/actions_schema_validation.py | 9 +-- nf_core/lint/merge_markers.py | 4 +- nf_core/lint/modules_json.py | 1 + nf_core/lint/multiqc_config.py | 1 + nf_core/lint/nextflow_config.py | 4 +- nf_core/lint/pipeline_todos.py | 4 +- nf_core/lint/schema_description.py | 1 + nf_core/lint/schema_lint.py | 4 +- nf_core/lint_utils.py | 3 +- nf_core/list.py | 5 +- nf_core/modules/__init__.py | 14 ++-- nf_core/modules/bump_versions.py | 12 ++-- nf_core/modules/create.py | 13 ++-- nf_core/modules/info.py | 7 +- nf_core/modules/install.py | 7 +- nf_core/modules/lint/__init__.py | 24 +++---- nf_core/modules/lint/main_nf.py | 1 + nf_core/modules/lint/meta_yml.py | 1 - nf_core/modules/lint/module_changes.py | 2 + nf_core/modules/lint/module_tests.py | 3 +- nf_core/modules/lint/module_todos.py | 1 + nf_core/modules/lint/module_version.py | 7 +- nf_core/modules/list.py | 3 +- nf_core/modules/module_utils.py | 8 +-- nf_core/modules/modules_command.py | 11 ++-- nf_core/modules/modules_repo.py | 8 ++- nf_core/modules/remove.py | 6 +- nf_core/modules/test_yml_builder.py | 8 +-- nf_core/modules/update.py | 8 ++- .../bin/check_samplesheet.py | 1 - .../templates/dumpsoftwareversions.py | 3 +- nf_core/schema.py | 13 ++-- nf_core/sync.py | 7 +- nf_core/utils.py | 17 ++--- setup.py | 2 +- tests/lint/actions_awsfulltest.py | 2 + tests/lint/actions_awstest.py | 2 + tests/lint/actions_ci.py | 2 + tests/lint/actions_schema_validation.py | 2 + tests/lint/files_exist.py | 2 + tests/lint/files_unchanged.py | 5 +- tests/lint/merge_markers.py | 2 + tests/lint/nextflow_config.py | 7 +- tests/modules/bump_versions.py | 1 + tests/modules/create.py | 1 + tests/modules/create_test_yml.py | 1 + tests/modules/install.py | 3 +- tests/modules/list.py | 3 +- tests/test_bump_version.py | 1 + tests/test_cli.py | 7 +- tests/test_create.py | 3 +- tests/test_download.py | 15 +++-- tests/test_launch.py | 9 +-- tests/test_licenses.py | 3 +- tests/test_lint.py | 58 +++++++---------- tests/test_list.py | 10 +-- tests/test_modules.py | 65 +++++++------------ tests/test_schema.py | 13 ++-- tests/test_sync.py | 11 ++-- tests/test_utils.py | 15 +++-- 71 files changed, 286 insertions(+), 247 deletions(-) diff --git a/docs/api/make_lint_md.py b/docs/api/make_lint_md.py index a6ec98a94..1ed3f8b0c 100644 --- a/docs/api/make_lint_md.py +++ b/docs/api/make_lint_md.py @@ -2,6 +2,7 @@ import fnmatch import os + import nf_core.lint import nf_core.modules.lint diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 8affd23bf..7a1a472a2 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1,15 +1,16 @@ #!/usr/bin/env python """ nf-core: Helper tools for use with nf-core Nextflow pipelines. """ -from rich import print import logging import os import re +import sys + import rich.console import rich.logging import rich.traceback import rich_click as click -import sys +from rich import print import nf_core import nf_core.bump_version diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index 420fd24e7..18333ab24 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -6,8 +6,10 @@ import logging import os import re -import rich.console import sys + +import rich.console + import nf_core.utils log = logging.getLogger(__name__) diff --git a/nf_core/create.py b/nf_core/create.py index 3fa3baeda..a4dff8641 100644 --- a/nf_core/create.py +++ b/nf_core/create.py @@ -2,19 +2,20 @@ """Creates a nf-core pipeline matching the current organization's specification based on a template. """ -from genericpath import exists -import git import imghdr -import jinja2 import logging import os import pathlib import random -import requests import shutil import sys import time +import git +import jinja2 +import requests +from genericpath import exists + import nf_core log = logging.getLogger(__name__) diff --git a/nf_core/download.py b/nf_core/download.py index f45e45252..f826e6b82 100644 --- a/nf_core/download.py +++ b/nf_core/download.py @@ -3,22 +3,23 @@ from __future__ import print_function -from io import BytesIO -import logging +import concurrent.futures import hashlib +import logging import os -import questionary import re -import requests -import requests_cache import shutil import subprocess import sys import tarfile -import concurrent.futures +from io import BytesIO +from zipfile import ZipFile + +import questionary +import requests +import requests_cache import rich import rich.progress -from zipfile import ZipFile import nf_core import nf_core.list diff --git a/nf_core/launch.py b/nf_core/launch.py index 3bf257ff0..2e7533a8c 100644 --- a/nf_core/launch.py +++ b/nf_core/launch.py @@ -2,21 +2,23 @@ """ Launch a pipeline, interactively collecting params """ from __future__ import print_function -from rich.console import Console -from rich.markdown import Markdown -from rich.prompt import Confirm import copy import json import logging import os -import questionary import re import subprocess import webbrowser + +import questionary import requests +from rich.console import Console +from rich.markdown import Markdown +from rich.prompt import Confirm -import nf_core.schema, nf_core.utils +import nf_core.schema +import nf_core.utils log = logging.getLogger(__name__) diff --git a/nf_core/licences.py b/nf_core/licences.py index 045dd0c60..d338ce255 100644 --- a/nf_core/licences.py +++ b/nf_core/licences.py @@ -3,14 +3,15 @@ from __future__ import print_function -import logging import json +import logging import os import re + import requests -import yaml import rich.console import rich.table +import yaml import nf_core.utils diff --git a/nf_core/lint/__init__.py b/nf_core/lint/__init__.py index a0dad185b..a5c882986 100644 --- a/nf_core/lint/__init__.py +++ b/nf_core/lint/__init__.py @@ -5,20 +5,21 @@ the nf-core community guidelines. """ -from rich.markdown import Markdown -from rich.table import Table -from rich.panel import Panel import datetime -import git import json import logging import re + +import git import rich import rich.progress +from rich.markdown import Markdown +from rich.panel import Panel +from rich.table import Table -import nf_core.utils import nf_core.lint_utils import nf_core.modules.lint +import nf_core.utils from nf_core import __version__ from nf_core.lint_utils import console @@ -158,9 +159,9 @@ class PipelineLint(nf_core.utils.Pipeline): from .pipeline_name_conventions import pipeline_name_conventions from .pipeline_todos import pipeline_todos from .readme import readme + from .schema_description import schema_description from .schema_lint import schema_lint from .schema_params import schema_params - from .schema_description import schema_description from .template_strings import template_strings from .version_consistency import version_consistency diff --git a/nf_core/lint/actions_awsfulltest.py b/nf_core/lint/actions_awsfulltest.py index c81302ec6..43b878524 100644 --- a/nf_core/lint/actions_awsfulltest.py +++ b/nf_core/lint/actions_awsfulltest.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os + import yaml diff --git a/nf_core/lint/actions_awstest.py b/nf_core/lint/actions_awstest.py index 32ac1ea86..216db08c1 100644 --- a/nf_core/lint/actions_awstest.py +++ b/nf_core/lint/actions_awstest.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os + import yaml diff --git a/nf_core/lint/actions_ci.py b/nf_core/lint/actions_ci.py index 89d9becd0..efa0ad5b2 100644 --- a/nf_core/lint/actions_ci.py +++ b/nf_core/lint/actions_ci.py @@ -2,6 +2,7 @@ import os import re + import yaml diff --git a/nf_core/lint/actions_schema_validation.py b/nf_core/lint/actions_schema_validation.py index 2d2671933..86ed2e95a 100644 --- a/nf_core/lint/actions_schema_validation.py +++ b/nf_core/lint/actions_schema_validation.py @@ -1,12 +1,13 @@ #!/usr/bin/env python -import logging -import yaml +import glob import json -import jsonschema +import logging import os -import glob + +import jsonschema import requests +import yaml def actions_schema_validation(self): diff --git a/nf_core/lint/merge_markers.py b/nf_core/lint/merge_markers.py index fe1c6e2a1..75fbf931b 100644 --- a/nf_core/lint/merge_markers.py +++ b/nf_core/lint/merge_markers.py @@ -1,9 +1,9 @@ #!/usr/bin/env python +import fnmatch +import io import logging import os -import io -import fnmatch import nf_core.utils diff --git a/nf_core/lint/modules_json.py b/nf_core/lint/modules_json.py index 4c5923d50..6e6ddd6d1 100644 --- a/nf_core/lint/modules_json.py +++ b/nf_core/lint/modules_json.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from logging import warn + from nf_core.modules.modules_command import ModuleCommand diff --git a/nf_core/lint/multiqc_config.py b/nf_core/lint/multiqc_config.py index 36c3647fd..932b7f8c6 100644 --- a/nf_core/lint/multiqc_config.py +++ b/nf_core/lint/multiqc_config.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os + import yaml diff --git a/nf_core/lint/nextflow_config.py b/nf_core/lint/nextflow_config.py index b1c3f4f92..91ba88889 100644 --- a/nf_core/lint/nextflow_config.py +++ b/nf_core/lint/nextflow_config.py @@ -1,8 +1,8 @@ #!/usr/bin/env python -import re -import os import logging +import os +import re log = logging.getLogger(__name__) diff --git a/nf_core/lint/pipeline_todos.py b/nf_core/lint/pipeline_todos.py index d0d491b3a..4023a83ef 100644 --- a/nf_core/lint/pipeline_todos.py +++ b/nf_core/lint/pipeline_todos.py @@ -1,9 +1,9 @@ #!/usr/bin/env python +import fnmatch +import io import logging import os -import io -import fnmatch log = logging.getLogger(__name__) diff --git a/nf_core/lint/schema_description.py b/nf_core/lint/schema_description.py index f1377053e..ccf78f3c6 100644 --- a/nf_core/lint/schema_description.py +++ b/nf_core/lint/schema_description.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from logging import warn + import nf_core.schema diff --git a/nf_core/lint/schema_lint.py b/nf_core/lint/schema_lint.py index 686aca3dd..672233fd3 100644 --- a/nf_core/lint/schema_lint.py +++ b/nf_core/lint/schema_lint.py @@ -1,9 +1,11 @@ #!/usr/bin/env python import logging -import nf_core.schema + import jsonschema +import nf_core.schema + def schema_lint(self): """Pipeline schema syntax diff --git a/nf_core/lint_utils.py b/nf_core/lint_utils.py index 757a244ed..b1802039b 100644 --- a/nf_core/lint_utils.py +++ b/nf_core/lint_utils.py @@ -1,7 +1,8 @@ +import logging + import rich from rich.console import Console from rich.table import Table -import logging import nf_core.utils diff --git a/nf_core/list.py b/nf_core/list.py index 19b0d81e5..055db301f 100644 --- a/nf_core/list.py +++ b/nf_core/list.py @@ -2,14 +2,15 @@ """Lists available nf-core pipelines and versions.""" from __future__ import print_function -from collections import OrderedDict import datetime -import git import json import logging import os import re +from collections import OrderedDict + +import git import requests import rich.console import rich.table diff --git a/nf_core/modules/__init__.py b/nf_core/modules/__init__.py index f833d5256..244abc7bb 100644 --- a/nf_core/modules/__init__.py +++ b/nf_core/modules/__init__.py @@ -1,11 +1,11 @@ -from .modules_repo import ModulesRepo +from .bump_versions import ModuleVersionBumper from .create import ModuleCreate -from .test_yml_builder import ModulesTestYmlBuilder +from .info import ModuleInfo +from .install import ModuleInstall from .lint import ModuleLint -from .bump_versions import ModuleVersionBumper -from .module_utils import ModuleException from .list import ModuleList -from .install import ModuleInstall -from .update import ModuleUpdate +from .module_utils import ModuleException +from .modules_repo import ModulesRepo from .remove import ModuleRemove -from .info import ModuleInfo +from .test_yml_builder import ModulesTestYmlBuilder +from .update import ModuleUpdate diff --git a/nf_core/modules/bump_versions.py b/nf_core/modules/bump_versions.py index 7e28556e2..05eb4c881 100644 --- a/nf_core/modules/bump_versions.py +++ b/nf_core/modules/bump_versions.py @@ -5,20 +5,22 @@ from __future__ import print_function + import logging -import questionary import os import re + +import questionary import rich from rich.console import Console -from rich.table import Table from rich.markdown import Markdown -import rich -from nf_core.utils import rich_force_colors +from rich.table import Table -import nf_core.utils import nf_core.modules.module_utils +import nf_core.utils from nf_core.modules.nfcore_module import NFCoreModule +from nf_core.utils import rich_force_colors + from .modules_command import ModuleCommand log = logging.getLogger(__name__) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index f44eeb9e1..48bffd134 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -4,22 +4,23 @@ """ from __future__ import print_function -from packaging.version import parse as parse_version import glob -import jinja2 import json import logging -import nf_core import os -import questionary import re -import rich import subprocess + +import jinja2 +import questionary +import rich import yaml +from packaging.version import parse as parse_version -import nf_core.utils +import nf_core import nf_core.modules.module_utils +import nf_core.utils log = logging.getLogger(__name__) diff --git a/nf_core/modules/info.py b/nf_core/modules/info.py index 88a178546..7ba30caa4 100644 --- a/nf_core/modules/info.py +++ b/nf_core/modules/info.py @@ -1,18 +1,19 @@ import base64 import logging import os + import requests import yaml - from rich import box -from rich.text import Text from rich.console import Group from rich.markdown import Markdown from rich.panel import Panel from rich.table import Table +from rich.text import Text +from .module_utils import (get_installed_modules, get_module_git_log, + get_repo_type, module_exist_in_repo) from .modules_command import ModuleCommand -from .module_utils import get_repo_type, get_installed_modules, get_module_git_log, module_exist_in_repo from .modules_repo import ModulesRepo log = logging.getLogger(__name__) diff --git a/nf_core/modules/install.py b/nf_core/modules/install.py index 673e1d7f4..8a1b87ed1 100644 --- a/nf_core/modules/install.py +++ b/nf_core/modules/install.py @@ -1,12 +1,13 @@ +import logging import os + import questionary -import logging -import nf_core.utils import nf_core.modules.module_utils +import nf_core.utils -from .modules_command import ModuleCommand from .module_utils import get_module_git_log, module_exist_in_repo +from .modules_command import ModuleCommand log = logging.getLogger(__name__) diff --git a/nf_core/modules/lint/__init__.py b/nf_core/modules/lint/__init__.py index e81eea7f8..5aafd464a 100644 --- a/nf_core/modules/lint/__init__.py +++ b/nf_core/modules/lint/__init__.py @@ -8,30 +8,30 @@ """ from __future__ import print_function + +import json import logging -from nf_core.modules.modules_command import ModuleCommand import operator import os -import questionary import re +import sys + +import questionary import requests import rich import yaml -import json -from rich.table import Table from rich.markdown import Markdown from rich.panel import Panel -import rich -from nf_core.utils import rich_force_colors -from nf_core.lint.pipeline_todos import pipeline_todos -import sys +from rich.table import Table -import nf_core.utils import nf_core.modules.module_utils - +import nf_core.utils +from nf_core.lint.pipeline_todos import pipeline_todos +from nf_core.lint_utils import console +from nf_core.modules.modules_command import ModuleCommand from nf_core.modules.modules_repo import ModulesRepo from nf_core.modules.nfcore_module import NFCoreModule -from nf_core.lint_utils import console +from nf_core.utils import rich_force_colors log = logging.getLogger(__name__) @@ -63,9 +63,9 @@ class ModuleLint(ModuleCommand): from .main_nf import main_nf from .meta_yml import meta_yml from .module_changes import module_changes + from .module_deprecations import module_deprecations from .module_tests import module_tests from .module_todos import module_todos - from .module_deprecations import module_deprecations from .module_version import module_version def __init__(self, dir): diff --git a/nf_core/modules/lint/main_nf.py b/nf_core/modules/lint/main_nf.py index abc9e48dc..7d2babcdc 100644 --- a/nf_core/modules/lint/main_nf.py +++ b/nf_core/modules/lint/main_nf.py @@ -4,6 +4,7 @@ """ import re + import nf_core diff --git a/nf_core/modules/lint/meta_yml.py b/nf_core/modules/lint/meta_yml.py index 3c59c774d..46c11a222 100644 --- a/nf_core/modules/lint/meta_yml.py +++ b/nf_core/modules/lint/meta_yml.py @@ -2,7 +2,6 @@ from operator import imod - import yaml diff --git a/nf_core/modules/lint/module_changes.py b/nf_core/modules/lint/module_changes.py index b77b54c3f..014ed754e 100644 --- a/nf_core/modules/lint/module_changes.py +++ b/nf_core/modules/lint/module_changes.py @@ -2,8 +2,10 @@ Check whether the content of a module has changed compared to the original repository """ import os + import requests import rich + from nf_core.modules.lint import LintResult diff --git a/nf_core/modules/lint/module_tests.py b/nf_core/modules/lint/module_tests.py index b616daa37..208165a88 100644 --- a/nf_core/modules/lint/module_tests.py +++ b/nf_core/modules/lint/module_tests.py @@ -1,8 +1,9 @@ """ Lint the tests of a module in nf-core/modules """ -import os import logging +import os + import yaml log = logging.getLogger(__name__) diff --git a/nf_core/modules/lint/module_todos.py b/nf_core/modules/lint/module_todos.py index 33b35415b..90af44987 100644 --- a/nf_core/modules/lint/module_todos.py +++ b/nf_core/modules/lint/module_todos.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import logging + from nf_core.lint.pipeline_todos import pipeline_todos log = logging.getLogger(__name__) diff --git a/nf_core/modules/lint/module_version.py b/nf_core/modules/lint/module_version.py index 29d732749..64b481771 100644 --- a/nf_core/modules/lint/module_version.py +++ b/nf_core/modules/lint/module_version.py @@ -3,14 +3,15 @@ Verify that a module has a correct entry in the modules.json file """ +import json import logging import os -import json import re -import questionary -import nf_core import sys +import questionary + +import nf_core import nf_core.modules.module_utils log = logging.getLogger(__name__) diff --git a/nf_core/modules/list.py b/nf_core/modules/list.py index 743670908..537f3bd62 100644 --- a/nf_core/modules/list.py +++ b/nf_core/modules/list.py @@ -1,7 +1,8 @@ import json +import logging from os import pipe + import rich -import logging import nf_core.modules.module_utils diff --git a/nf_core/modules/module_utils.py b/nf_core/modules/module_utils.py index fcd5a421f..6429ffc06 100644 --- a/nf_core/modules/module_utils.py +++ b/nf_core/modules/module_utils.py @@ -1,12 +1,12 @@ +import datetime import glob import json +import logging import os + +import questionary import requests -import logging import rich -import datetime -import questionary - import nf_core.utils diff --git a/nf_core/modules/modules_command.py b/nf_core/modules/modules_command.py index a60291fcf..964873bcb 100644 --- a/nf_core/modules/modules_command.py +++ b/nf_core/modules/modules_command.py @@ -1,15 +1,16 @@ -from posixpath import dirname -from nf_core import modules -import os -import glob -import shutil import copy +import glob import json import logging +import os +import shutil +from posixpath import dirname + import yaml import nf_core.modules.module_utils import nf_core.utils +from nf_core import modules from nf_core.modules.modules_repo import ModulesRepo log = logging.getLogger(__name__) diff --git a/nf_core/modules/modules_repo.py b/nf_core/modules/modules_repo.py index a625a0db0..a79e5ddff 100644 --- a/nf_core/modules/modules_repo.py +++ b/nf_core/modules/modules_repo.py @@ -1,8 +1,10 @@ -import os -import requests import base64 -import sys import logging +import os +import sys + +import requests + import nf_core.utils log = logging.getLogger(__name__) diff --git a/nf_core/modules/remove.py b/nf_core/modules/remove.py index 996966e7e..0d1b8e9be 100644 --- a/nf_core/modules/remove.py +++ b/nf_core/modules/remove.py @@ -1,9 +1,9 @@ -import os -import sys import json -import questionary import logging +import os +import sys +import questionary import nf_core.utils diff --git a/nf_core/modules/test_yml_builder.py b/nf_core/modules/test_yml_builder.py index d210cf350..1111ac6e1 100644 --- a/nf_core/modules/test_yml_builder.py +++ b/nf_core/modules/test_yml_builder.py @@ -5,7 +5,6 @@ """ from __future__ import print_function -from rich.syntax import Syntax import errno import gzip @@ -13,19 +12,20 @@ import logging import operator import os -import questionary import re -import rich import shlex import subprocess import tempfile + +import questionary +import rich import yaml +from rich.syntax import Syntax import nf_core.utils from .modules_repo import ModulesRepo - log = logging.getLogger(__name__) diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index 1967ac55a..5d4af3cf2 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -4,18 +4,20 @@ import json import logging import os -import questionary import shutil import tempfile + +import questionary from questionary import question from rich.console import Console from rich.syntax import Syntax -import nf_core.utils import nf_core.modules.module_utils +import nf_core.utils +from .module_utils import (get_installed_modules, get_module_git_log, + module_exist_in_repo) from .modules_command import ModuleCommand -from .module_utils import get_installed_modules, get_module_git_log, module_exist_in_repo from .modules_repo import ModulesRepo log = logging.getLogger(__name__) diff --git a/nf_core/pipeline-template/bin/check_samplesheet.py b/nf_core/pipeline-template/bin/check_samplesheet.py index 5473b624c..19dac3814 100755 --- a/nf_core/pipeline-template/bin/check_samplesheet.py +++ b/nf_core/pipeline-template/bin/check_samplesheet.py @@ -11,7 +11,6 @@ from collections import Counter from pathlib import Path - logger = logging.getLogger() diff --git a/nf_core/pipeline-template/modules/nf-core/modules/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py b/nf_core/pipeline-template/modules/nf-core/modules/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py index d13903925..ab8f4f15c 100644 --- a/nf_core/pipeline-template/modules/nf-core/modules/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py +++ b/nf_core/pipeline-template/modules/nf-core/modules/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py @@ -1,9 +1,10 @@ #!/usr/bin/env python -import yaml import platform from textwrap import dedent +import yaml + def _make_versions_html(versions): html = [ diff --git a/nf_core/schema.py b/nf_core/schema.py index e26a46ba6..9a34ab31a 100644 --- a/nf_core/schema.py +++ b/nf_core/schema.py @@ -2,20 +2,21 @@ """ Code to deal with pipeline JSON Schema """ from __future__ import print_function -from rich.prompt import Confirm import copy -import copy -import jinja2 import json -import jsonschema import logging -import markdown import os import webbrowser + +import jinja2 +import jsonschema +import markdown import yaml +from rich.prompt import Confirm -import nf_core.list, nf_core.utils +import nf_core.list +import nf_core.utils log = logging.getLogger(__name__) diff --git a/nf_core/sync.py b/nf_core/sync.py index fb1d9f4db..1f3731db6 100644 --- a/nf_core/sync.py +++ b/nf_core/sync.py @@ -2,17 +2,18 @@ """Synchronise a pipeline TEMPLATE branch with the template. """ -import git import json import logging import os import random import re +import shutil +import time + +import git import requests import requests_cache import rich -import shutil -import time import nf_core import nf_core.create diff --git a/nf_core/utils.py b/nf_core/utils.py index 34660d431..c204ebb94 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -2,30 +2,31 @@ """ Common utility functions for the nf-core python package. """ -import nf_core - -from distutils import version import datetime import errno -import git import hashlib import json import logging import mimetypes import os -import prompt_toolkit -import questionary import re -import requests -import requests_cache import shlex import subprocess import sys import time +from distutils import version + +import git +import prompt_toolkit +import questionary +import requests +import requests_cache import yaml from rich.live import Live from rich.spinner import Spinner +import nf_core + log = logging.getLogger(__name__) # Custom style for questionary diff --git a/setup.py b/setup.py index 90949a1dd..c52ffdbf3 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from setuptools import setup, find_packages +from setuptools import find_packages, setup version = "2.3.2" diff --git a/tests/lint/actions_awsfulltest.py b/tests/lint/actions_awsfulltest.py index 293cb0845..234628227 100644 --- a/tests/lint/actions_awsfulltest.py +++ b/tests/lint/actions_awsfulltest.py @@ -1,7 +1,9 @@ #!/usr/bin/env python import os + import yaml + import nf_core.lint diff --git a/tests/lint/actions_awstest.py b/tests/lint/actions_awstest.py index d42d9b3b5..45d7e66c3 100644 --- a/tests/lint/actions_awstest.py +++ b/tests/lint/actions_awstest.py @@ -1,7 +1,9 @@ #!/usr/bin/env python import os + import yaml + import nf_core.lint diff --git a/tests/lint/actions_ci.py b/tests/lint/actions_ci.py index 332908997..81eb26f22 100644 --- a/tests/lint/actions_ci.py +++ b/tests/lint/actions_ci.py @@ -1,7 +1,9 @@ #!/usr/bin/env python import os + import yaml + import nf_core.lint diff --git a/tests/lint/actions_schema_validation.py b/tests/lint/actions_schema_validation.py index 78e563c2a..ab2652219 100644 --- a/tests/lint/actions_schema_validation.py +++ b/tests/lint/actions_schema_validation.py @@ -1,7 +1,9 @@ #!/usr/bin/env python import os + import yaml + import nf_core.lint diff --git a/tests/lint/files_exist.py b/tests/lint/files_exist.py index fdba06f04..d104feb43 100644 --- a/tests/lint/files_exist.py +++ b/tests/lint/files_exist.py @@ -1,7 +1,9 @@ #!/usr/bin/env python import os + import yaml + import nf_core.lint diff --git a/tests/lint/files_unchanged.py b/tests/lint/files_unchanged.py index d890c217e..41949cb37 100644 --- a/tests/lint/files_unchanged.py +++ b/tests/lint/files_unchanged.py @@ -1,7 +1,8 @@ -import pytest +import os import shutil import tempfile -import os + +import pytest import nf_core.lint diff --git a/tests/lint/merge_markers.py b/tests/lint/merge_markers.py index 939919d7e..23d5f52a0 100644 --- a/tests/lint/merge_markers.py +++ b/tests/lint/merge_markers.py @@ -1,7 +1,9 @@ #!/usr/bin/env python import os + import yaml + import nf_core.lint diff --git a/tests/lint/nextflow_config.py b/tests/lint/nextflow_config.py index 229586372..68e746a5c 100644 --- a/tests/lint/nextflow_config.py +++ b/tests/lint/nextflow_config.py @@ -1,8 +1,9 @@ -import pytest -import unittest -import tempfile import os import shutil +import tempfile +import unittest + +import pytest import nf_core.create import nf_core.lint diff --git a/tests/modules/bump_versions.py b/tests/modules/bump_versions.py index df891cd4c..388b6be42 100644 --- a/tests/modules/bump_versions.py +++ b/tests/modules/bump_versions.py @@ -1,5 +1,6 @@ import os import re + import pytest import nf_core.modules diff --git a/tests/modules/create.py b/tests/modules/create.py index b095d825e..6c1767b13 100644 --- a/tests/modules/create.py +++ b/tests/modules/create.py @@ -1,4 +1,5 @@ import os + import pytest import nf_core.modules diff --git a/tests/modules/create_test_yml.py b/tests/modules/create_test_yml.py index 1666cd764..dfb5fb5c6 100644 --- a/tests/modules/create_test_yml.py +++ b/tests/modules/create_test_yml.py @@ -1,4 +1,5 @@ import os + import pytest import nf_core.modules diff --git a/tests/modules/install.py b/tests/modules/install.py index e4c94f6bd..920aac729 100644 --- a/tests/modules/install.py +++ b/tests/modules/install.py @@ -1,6 +1,7 @@ -import pytest import os +import pytest + from ..utils import with_temporary_folder diff --git a/tests/modules/list.py b/tests/modules/list.py index 4cf996e82..43de29390 100644 --- a/tests/modules/list.py +++ b/tests/modules/list.py @@ -1,6 +1,7 @@ -import nf_core.modules from rich.console import Console +import nf_core.modules + def test_modules_list_remote(self): """Test listing available modules""" diff --git a/tests/test_bump_version.py b/tests/test_bump_version.py index 1697fcfd0..6146885aa 100644 --- a/tests/test_bump_version.py +++ b/tests/test_bump_version.py @@ -2,6 +2,7 @@ """Some tests covering the bump_version code. """ import os + import yaml import nf_core.bump_version diff --git a/tests/test_cli.py b/tests/test_cli.py index 474314b8e..4bfc59140 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2,11 +2,12 @@ """ Tests covering the command-line code. """ -import nf_core.__main__ +import unittest -from click.testing import CliRunner import mock -import unittest +from click.testing import CliRunner + +import nf_core.__main__ @mock.patch("nf_core.__main__.nf_core_cli") diff --git a/tests/test_create.py b/tests/test_create.py index cce494b52..366060840 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -2,9 +2,10 @@ """Some tests covering the pipeline creation sub command. """ import os -import nf_core.create import unittest +import nf_core.create + from .utils import with_temporary_folder diff --git a/tests/test_download.py b/tests/test_download.py index 2dcc7b8cc..95b3cca75 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -2,19 +2,20 @@ """Tests for the download subcommand of nf-core tools """ -import nf_core.create -import nf_core.utils -from nf_core.download import DownloadWorkflow - import hashlib -import mock import os -import pytest import shutil import tempfile import unittest -from .utils import with_temporary_folder, with_temporary_file +import mock +import pytest + +import nf_core.create +import nf_core.utils +from nf_core.download import DownloadWorkflow + +from .utils import with_temporary_file, with_temporary_folder class DownloadTest(unittest.TestCase): diff --git a/tests/test_launch.py b/tests/test_launch.py index 6cc4d0371..e2661dac7 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -2,16 +2,17 @@ """ Tests covering the pipeline launch code. """ -import nf_core.launch - import json -import mock import os import shutil import tempfile import unittest -from .utils import with_temporary_folder, with_temporary_file +import mock + +import nf_core.launch + +from .utils import with_temporary_file, with_temporary_folder class TestLaunch(unittest.TestCase): diff --git a/tests/test_licenses.py b/tests/test_licenses.py index 59ea08f7f..0cbead848 100644 --- a/tests/test_licenses.py +++ b/tests/test_licenses.py @@ -3,9 +3,10 @@ """ import json import os -import pytest import tempfile import unittest + +import pytest from rich.console import Console import nf_core.create diff --git a/tests/test_lint.py b/tests/test_lint.py index 8a12fea27..789028e59 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -3,14 +3,15 @@ """ import fnmatch import json -import mock import os -import pytest -import requests import shutil import subprocess import tempfile import unittest + +import mock +import pytest +import requests import yaml import nf_core.create @@ -187,47 +188,32 @@ def test_sphinx_md_files(self): ####################### # SPECIFIC LINT TESTS # ####################### - from .lint.actions_awsfulltest import ( - test_actions_awsfulltest_warn, - test_actions_awsfulltest_pass, - test_actions_awsfulltest_fail, - ) - from .lint.actions_awstest import test_actions_awstest_pass, test_actions_awstest_fail - from .lint.files_exist import ( - test_files_exist_missing_config, - test_files_exist_missing_main, - test_files_exist_depreciated_file, - test_files_exist_pass, - ) - from .lint.actions_ci import ( - test_actions_ci_pass, - test_actions_ci_fail_wrong_nf, - test_actions_ci_fail_wrong_docker_ver, - test_actions_ci_fail_wrong_trigger, - ) - + from .lint.actions_awsfulltest import (test_actions_awsfulltest_fail, + test_actions_awsfulltest_pass, + test_actions_awsfulltest_warn) + from .lint.actions_awstest import (test_actions_awstest_fail, + test_actions_awstest_pass) + from .lint.actions_ci import (test_actions_ci_fail_wrong_docker_ver, + test_actions_ci_fail_wrong_nf, + test_actions_ci_fail_wrong_trigger, + test_actions_ci_pass) from .lint.actions_schema_validation import ( test_actions_schema_validation_missing_jobs, - test_actions_schema_validation_missing_on, - ) - + test_actions_schema_validation_missing_on) + from .lint.files_exist import (test_files_exist_depreciated_file, + test_files_exist_missing_config, + test_files_exist_missing_main, + test_files_exist_pass) + from .lint.files_unchanged import (test_files_unchanged_fail, + test_files_unchanged_pass) from .lint.merge_markers import test_merge_markers_found - + from .lint.modules_json import test_modules_json_pass from .lint.nextflow_config import ( - test_nextflow_config_example_pass, test_nextflow_config_bad_name_fail, test_nextflow_config_dev_in_release_mode_failed, - ) - - from .lint.files_unchanged import ( - test_files_unchanged_pass, - test_files_unchanged_fail, - ) - + test_nextflow_config_example_pass) from .lint.version_consistency import test_version_consistency - from .lint.modules_json import test_modules_json_pass - # TODO nf-core: Assess and strip out if no longer required for DSL2 diff --git a/tests/test_list.py b/tests/test_list.py index 082c7ffff..6b4bded59 100644 --- a/tests/test_list.py +++ b/tests/test_list.py @@ -2,17 +2,17 @@ """ Tests covering the workflow listing code. """ -import nf_core.list - import json -import mock import os -import pytest import time import unittest +from datetime import datetime + +import mock +import pytest from rich.console import Console -from datetime import datetime +import nf_core.list class TestLint(unittest.TestCase): diff --git a/tests/test_modules.py b/tests/test_modules.py index cfa3408e6..e4a85993e 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -2,13 +2,13 @@ """ Tests covering the modules commands """ -import nf_core.modules - import os import shutil import tempfile import unittest +import nf_core.modules + def create_modules_repo_dummy(tmp_dir): """Create a dummy copy of the nf-core/modules repo""" @@ -71,45 +71,30 @@ def test_modulesrepo_class(self): # Test of the individual modules commands. # ############################################ - from .modules.list import ( - test_modules_list_remote, - test_modules_list_pipeline, - test_modules_install_and_list_pipeline, - ) - - from .modules.install import ( - test_modules_install_nopipeline, - test_modules_install_emptypipeline, - test_modules_install_nomodule, - test_modules_install_trimgalore, - test_modules_install_trimgalore_twice, - ) - - from .modules.remove import ( - test_modules_remove_trimgalore, - test_modules_remove_trimgalore_uninstalled, - ) - - from .modules.lint import test_modules_lint_trimgalore, test_modules_lint_empty, test_modules_lint_new_modules - - from .modules.create import ( - test_modules_create_succeed, - test_modules_create_fail_exists, - test_modules_create_nfcore_modules, - test_modules_create_nfcore_modules_subtool, - ) - - from .modules.create_test_yml import ( - test_modules_custom_yml_dumper, - test_modules_test_file_dict, - test_modules_create_test_yml_get_md5, - test_modules_create_test_yml_entry_points, - test_modules_create_test_yml_check_inputs, - ) - from .modules.bump_versions import ( - test_modules_bump_versions_single_module, test_modules_bump_versions_all_modules, test_modules_bump_versions_fail, test_modules_bump_versions_fail_unknown_version, - ) + test_modules_bump_versions_single_module) + from .modules.create import (test_modules_create_fail_exists, + test_modules_create_nfcore_modules, + test_modules_create_nfcore_modules_subtool, + test_modules_create_succeed) + from .modules.create_test_yml import ( + test_modules_create_test_yml_check_inputs, + test_modules_create_test_yml_entry_points, + test_modules_create_test_yml_get_md5, test_modules_custom_yml_dumper, + test_modules_test_file_dict) + from .modules.install import (test_modules_install_emptypipeline, + test_modules_install_nomodule, + test_modules_install_nopipeline, + test_modules_install_trimgalore, + test_modules_install_trimgalore_twice) + from .modules.lint import (test_modules_lint_empty, + test_modules_lint_new_modules, + test_modules_lint_trimgalore) + from .modules.list import (test_modules_install_and_list_pipeline, + test_modules_list_pipeline, + test_modules_list_remote) + from .modules.remove import (test_modules_remove_trimgalore, + test_modules_remove_trimgalore_uninstalled) diff --git a/tests/test_schema.py b/tests/test_schema.py index acda08769..14eb1f32d 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -2,19 +2,20 @@ """ Tests covering the pipeline schema code. """ -import nf_core.schema - -import click import json -import mock import os -import pytest -import requests import shutil import tempfile import unittest + +import click +import mock +import pytest +import requests import yaml +import nf_core.schema + from .utils import with_temporary_file, with_temporary_folder diff --git a/tests/test_sync.py b/tests/test_sync.py index 68c96e292..f0e2b7297 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -2,17 +2,18 @@ """ Tests covering the sync command """ -import nf_core.create -import nf_core.sync - -import git import json -import mock import os import shutil import tempfile import unittest +import git +import mock + +import nf_core.create +import nf_core.sync + from .utils import with_temporary_folder diff --git a/tests/test_utils.py b/tests/test_utils.py index b62a8c979..dd2d38b56 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -2,17 +2,18 @@ """ Tests covering for utility functions. """ -import nf_core.create -import nf_core.list -import nf_core.utils +import os +import shutil +import tempfile +import unittest import mock -import os import pytest import requests -import tempfile -import unittest -import shutil + +import nf_core.create +import nf_core.list +import nf_core.utils from .utils import with_temporary_folder From 281e550c95a9ba158ab00216c8cf0d99ce36cbf2 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Tue, 17 May 2022 16:33:59 +0200 Subject: [PATCH 04/24] run isort --- nf_core/__main__.py | 5 ++- nf_core/lint/__init__.py | 15 +++---- nf_core/list.py | 5 ++- nf_core/modules/__init__.py | 18 ++++----- nf_core/modules/module_test.py | 8 ++-- nf_core/modules/module_utils.py | 8 ++-- nf_core/modules/modules_repo.py | 3 +- nf_core/modules/mulled.py | 5 +-- nf_core/sync.py | 5 ++- nf_core/utils.py | 19 ++++----- tests/modules/module_test.py | 1 + tests/test_modules.py | 72 +++++++++++++-------------------- 12 files changed, 77 insertions(+), 87 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 0c010ae9a..dc3580f29 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1,14 +1,15 @@ #!/usr/bin/env python """ nf-core: Helper tools for use with nf-core Nextflow pipelines. """ -from rich import print import logging import os import re +import sys + import rich.console import rich.logging import rich.traceback import rich_click as click -import sys +from rich import print import nf_core import nf_core.bump_version diff --git a/nf_core/lint/__init__.py b/nf_core/lint/__init__.py index 97293d2a2..ad0b09c7b 100644 --- a/nf_core/lint/__init__.py +++ b/nf_core/lint/__init__.py @@ -5,21 +5,22 @@ the nf-core community guidelines. """ -from rich.markdown import Markdown -from rich.table import Table -from rich.panel import Panel -from rich.console import group import datetime -import git import json import logging import re + +import git import rich import rich.progress +from rich.console import group +from rich.markdown import Markdown +from rich.panel import Panel +from rich.table import Table -import nf_core.utils import nf_core.lint_utils import nf_core.modules.lint +import nf_core.utils from nf_core import __version__ from nf_core.lint_utils import console @@ -159,9 +160,9 @@ class PipelineLint(nf_core.utils.Pipeline): from .pipeline_name_conventions import pipeline_name_conventions from .pipeline_todos import pipeline_todos from .readme import readme + from .schema_description import schema_description from .schema_lint import schema_lint from .schema_params import schema_params - from .schema_description import schema_description from .template_strings import template_strings from .version_consistency import version_consistency diff --git a/nf_core/list.py b/nf_core/list.py index 4cadadfe8..01fccdf28 100644 --- a/nf_core/list.py +++ b/nf_core/list.py @@ -3,12 +3,13 @@ from __future__ import print_function -from datetime import datetime -import git import json import logging import os import re +from datetime import datetime + +import git import requests import rich.console import rich.table diff --git a/nf_core/modules/__init__.py b/nf_core/modules/__init__.py index 29110461b..3dd49e3a4 100644 --- a/nf_core/modules/__init__.py +++ b/nf_core/modules/__init__.py @@ -1,13 +1,13 @@ -from .modules_repo import ModulesRepo +from .bump_versions import ModuleVersionBumper from .create import ModuleCreate -from .test_yml_builder import ModulesTestYmlBuilder +from .info import ModuleInfo +from .install import ModuleInstall from .lint import ModuleLint -from .bump_versions import ModuleVersionBumper -from .module_utils import ModuleException from .list import ModuleList -from .install import ModuleInstall -from .update import ModuleUpdate -from .remove import ModuleRemove -from .info import ModuleInfo -from .mulled import MulledImageNameGenerator from .module_test import ModulesTest +from .module_utils import ModuleException +from .modules_repo import ModulesRepo +from .mulled import MulledImageNameGenerator +from .remove import ModuleRemove +from .test_yml_builder import ModulesTestYmlBuilder +from .update import ModuleUpdate diff --git a/nf_core/modules/module_test.py b/nf_core/modules/module_test.py index 35658dd26..8e137f07a 100644 --- a/nf_core/modules/module_test.py +++ b/nf_core/modules/module_test.py @@ -4,15 +4,17 @@ """ import logging -import questionary import os -import pytest import sys -import rich from pathlib import Path from shutil import which +import pytest +import questionary +import rich + import nf_core.utils + from .modules_repo import ModulesRepo log = logging.getLogger(__name__) diff --git a/nf_core/modules/module_utils.py b/nf_core/modules/module_utils.py index 23c5ec526..501d4b7d8 100644 --- a/nf_core/modules/module_utils.py +++ b/nf_core/modules/module_utils.py @@ -1,11 +1,11 @@ +import datetime import glob import json -import os import logging -import rich -import datetime -import questionary +import os +import questionary +import rich import nf_core.utils diff --git a/nf_core/modules/modules_repo.py b/nf_core/modules/modules_repo.py index b4faba3cb..81c517a94 100644 --- a/nf_core/modules/modules_repo.py +++ b/nf_core/modules/modules_repo.py @@ -1,6 +1,7 @@ -import os import base64 import logging +import os + from nf_core.utils import gh_api log = logging.getLogger(__name__) diff --git a/nf_core/modules/mulled.py b/nf_core/modules/mulled.py index 9a34ef335..fc1d1a355 100644 --- a/nf_core/modules/mulled.py +++ b/nf_core/modules/mulled.py @@ -3,12 +3,11 @@ import logging import re -from packaging.version import Version, InvalidVersion -from typing import Iterable, Tuple, List +from typing import Iterable, List, Tuple import requests from galaxy.tool_util.deps.mulled.util import build_target, v2_image_name - +from packaging.version import InvalidVersion, Version log = logging.getLogger(__name__) diff --git a/nf_core/sync.py b/nf_core/sync.py index 7ce4f0fa6..9bd706ffd 100644 --- a/nf_core/sync.py +++ b/nf_core/sync.py @@ -2,14 +2,15 @@ """Synchronise a pipeline TEMPLATE branch with the template. """ -import git import json import logging import os +import shutil + +import git import requests import requests_cache import rich -import shutil import nf_core import nf_core.create diff --git a/nf_core/utils.py b/nf_core/utils.py index 4cb64e6b0..1b5e9726e 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -2,32 +2,33 @@ """ Common utility functions for the nf-core python package. """ -import nf_core - -from distutils import version import datetime import errno -import git import hashlib import json import logging import mimetypes import os -import prompt_toolkit -import questionary import random import re -import requests -import requests_cache -import rich import shlex import subprocess import sys import time +from distutils import version + +import git +import prompt_toolkit +import questionary +import requests +import requests_cache +import rich import yaml from rich.live import Live from rich.spinner import Spinner +import nf_core + log = logging.getLogger(__name__) # Custom style for questionary diff --git a/tests/modules/module_test.py b/tests/modules/module_test.py index a4559ffde..40035c272 100644 --- a/tests/modules/module_test.py +++ b/tests/modules/module_test.py @@ -1,5 +1,6 @@ """Test the 'modules test' command which runs module pytests.""" import os + import pytest import nf_core.modules diff --git a/tests/test_modules.py b/tests/test_modules.py index b12333b51..03049901c 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -2,13 +2,13 @@ """ Tests covering the modules commands """ -import nf_core.modules - import os import shutil import tempfile import unittest +import nf_core.modules + def create_modules_repo_dummy(tmp_dir): """Create a dummy copy of the nf-core/modules repo""" @@ -71,50 +71,32 @@ def test_modulesrepo_class(self): # Test of the individual modules commands. # ############################################ - from .modules.list import ( - test_modules_list_remote, - test_modules_list_pipeline, - test_modules_install_and_list_pipeline, - ) - - from .modules.install import ( - test_modules_install_nopipeline, - test_modules_install_emptypipeline, - test_modules_install_nomodule, - test_modules_install_trimgalore, - test_modules_install_trimgalore_twice, - ) - - from .modules.remove import ( - test_modules_remove_trimgalore, - test_modules_remove_trimgalore_uninstalled, - ) - - from .modules.lint import test_modules_lint_trimgalore, test_modules_lint_empty, test_modules_lint_new_modules - - from .modules.create import ( - test_modules_create_succeed, - test_modules_create_fail_exists, - test_modules_create_nfcore_modules, - test_modules_create_nfcore_modules_subtool, - ) - - from .modules.create_test_yml import ( - test_modules_custom_yml_dumper, - test_modules_test_file_dict, - test_modules_create_test_yml_get_md5, - test_modules_create_test_yml_entry_points, - test_modules_create_test_yml_check_inputs, - ) - from .modules.bump_versions import ( - test_modules_bump_versions_single_module, test_modules_bump_versions_all_modules, test_modules_bump_versions_fail, test_modules_bump_versions_fail_unknown_version, - ) - - from .modules.module_test import ( - test_modules_test_check_inputs, - test_modules_test_no_name_no_prompts, - ) + test_modules_bump_versions_single_module) + from .modules.create import (test_modules_create_fail_exists, + test_modules_create_nfcore_modules, + test_modules_create_nfcore_modules_subtool, + test_modules_create_succeed) + from .modules.create_test_yml import ( + test_modules_create_test_yml_check_inputs, + test_modules_create_test_yml_entry_points, + test_modules_create_test_yml_get_md5, test_modules_custom_yml_dumper, + test_modules_test_file_dict) + from .modules.install import (test_modules_install_emptypipeline, + test_modules_install_nomodule, + test_modules_install_nopipeline, + test_modules_install_trimgalore, + test_modules_install_trimgalore_twice) + from .modules.lint import (test_modules_lint_empty, + test_modules_lint_new_modules, + test_modules_lint_trimgalore) + from .modules.list import (test_modules_install_and_list_pipeline, + test_modules_list_pipeline, + test_modules_list_remote) + from .modules.module_test import (test_modules_test_check_inputs, + test_modules_test_no_name_no_prompts) + from .modules.remove import (test_modules_remove_trimgalore, + test_modules_remove_trimgalore_uninstalled) From 4a0550193aa7a36f6a108fa3267a18771df1d32e Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Tue, 17 May 2022 16:36:29 +0200 Subject: [PATCH 05/24] fix isort with black --- nf_core/modules/info.py | 8 ++++-- nf_core/modules/update.py | 7 +++-- tests/test_lint.py | 46 +++++++++++++++++++----------- tests/test_modules.py | 59 ++++++++++++++++++++++++--------------- 4 files changed, 77 insertions(+), 43 deletions(-) diff --git a/nf_core/modules/info.py b/nf_core/modules/info.py index 7ba30caa4..6d33c091f 100644 --- a/nf_core/modules/info.py +++ b/nf_core/modules/info.py @@ -11,8 +11,12 @@ from rich.table import Table from rich.text import Text -from .module_utils import (get_installed_modules, get_module_git_log, - get_repo_type, module_exist_in_repo) +from .module_utils import ( + get_installed_modules, + get_module_git_log, + get_repo_type, + module_exist_in_repo, +) from .modules_command import ModuleCommand from .modules_repo import ModulesRepo diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index 5d4af3cf2..cb758c6f3 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -15,8 +15,11 @@ import nf_core.modules.module_utils import nf_core.utils -from .module_utils import (get_installed_modules, get_module_git_log, - module_exist_in_repo) +from .module_utils import ( + get_installed_modules, + get_module_git_log, + module_exist_in_repo, +) from .modules_command import ModuleCommand from .modules_repo import ModulesRepo diff --git a/tests/test_lint.py b/tests/test_lint.py index 789028e59..e764b8147 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -188,30 +188,42 @@ def test_sphinx_md_files(self): ####################### # SPECIFIC LINT TESTS # ####################### - from .lint.actions_awsfulltest import (test_actions_awsfulltest_fail, - test_actions_awsfulltest_pass, - test_actions_awsfulltest_warn) - from .lint.actions_awstest import (test_actions_awstest_fail, - test_actions_awstest_pass) - from .lint.actions_ci import (test_actions_ci_fail_wrong_docker_ver, - test_actions_ci_fail_wrong_nf, - test_actions_ci_fail_wrong_trigger, - test_actions_ci_pass) + from .lint.actions_awsfulltest import ( + test_actions_awsfulltest_fail, + test_actions_awsfulltest_pass, + test_actions_awsfulltest_warn, + ) + from .lint.actions_awstest import ( + test_actions_awstest_fail, + test_actions_awstest_pass, + ) + from .lint.actions_ci import ( + test_actions_ci_fail_wrong_docker_ver, + test_actions_ci_fail_wrong_nf, + test_actions_ci_fail_wrong_trigger, + test_actions_ci_pass, + ) from .lint.actions_schema_validation import ( test_actions_schema_validation_missing_jobs, - test_actions_schema_validation_missing_on) - from .lint.files_exist import (test_files_exist_depreciated_file, - test_files_exist_missing_config, - test_files_exist_missing_main, - test_files_exist_pass) - from .lint.files_unchanged import (test_files_unchanged_fail, - test_files_unchanged_pass) + test_actions_schema_validation_missing_on, + ) + from .lint.files_exist import ( + test_files_exist_depreciated_file, + test_files_exist_missing_config, + test_files_exist_missing_main, + test_files_exist_pass, + ) + from .lint.files_unchanged import ( + test_files_unchanged_fail, + test_files_unchanged_pass, + ) from .lint.merge_markers import test_merge_markers_found from .lint.modules_json import test_modules_json_pass from .lint.nextflow_config import ( test_nextflow_config_bad_name_fail, test_nextflow_config_dev_in_release_mode_failed, - test_nextflow_config_example_pass) + test_nextflow_config_example_pass, + ) from .lint.version_consistency import test_version_consistency diff --git a/tests/test_modules.py b/tests/test_modules.py index 03049901c..db04c5530 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -75,28 +75,43 @@ def test_modulesrepo_class(self): test_modules_bump_versions_all_modules, test_modules_bump_versions_fail, test_modules_bump_versions_fail_unknown_version, - test_modules_bump_versions_single_module) - from .modules.create import (test_modules_create_fail_exists, - test_modules_create_nfcore_modules, - test_modules_create_nfcore_modules_subtool, - test_modules_create_succeed) + test_modules_bump_versions_single_module, + ) + from .modules.create import ( + test_modules_create_fail_exists, + test_modules_create_nfcore_modules, + test_modules_create_nfcore_modules_subtool, + test_modules_create_succeed, + ) from .modules.create_test_yml import ( test_modules_create_test_yml_check_inputs, test_modules_create_test_yml_entry_points, - test_modules_create_test_yml_get_md5, test_modules_custom_yml_dumper, - test_modules_test_file_dict) - from .modules.install import (test_modules_install_emptypipeline, - test_modules_install_nomodule, - test_modules_install_nopipeline, - test_modules_install_trimgalore, - test_modules_install_trimgalore_twice) - from .modules.lint import (test_modules_lint_empty, - test_modules_lint_new_modules, - test_modules_lint_trimgalore) - from .modules.list import (test_modules_install_and_list_pipeline, - test_modules_list_pipeline, - test_modules_list_remote) - from .modules.module_test import (test_modules_test_check_inputs, - test_modules_test_no_name_no_prompts) - from .modules.remove import (test_modules_remove_trimgalore, - test_modules_remove_trimgalore_uninstalled) + test_modules_create_test_yml_get_md5, + test_modules_custom_yml_dumper, + test_modules_test_file_dict, + ) + from .modules.install import ( + test_modules_install_emptypipeline, + test_modules_install_nomodule, + test_modules_install_nopipeline, + test_modules_install_trimgalore, + test_modules_install_trimgalore_twice, + ) + from .modules.lint import ( + test_modules_lint_empty, + test_modules_lint_new_modules, + test_modules_lint_trimgalore, + ) + from .modules.list import ( + test_modules_install_and_list_pipeline, + test_modules_list_pipeline, + test_modules_list_remote, + ) + from .modules.module_test import ( + test_modules_test_check_inputs, + test_modules_test_no_name_no_prompts, + ) + from .modules.remove import ( + test_modules_remove_trimgalore, + test_modules_remove_trimgalore_uninstalled, + ) From a8bebd830afdc4648e0061153fe1cabc40fdf8d8 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 19 May 2022 15:07:30 +0200 Subject: [PATCH 06/24] apply review comments, move configuration to pyproject.toml --- .github/workflows/lint-code.yml | 4 +- nf_core/modules/info.py | 10 ++--- nf_core/modules/install.py | 3 +- nf_core/modules/mulled.py | 10 +++-- nf_core/modules/update.py | 8 ++-- pyproject.toml | 5 +++ setup.py | 3 +- tests/test_download.py | 3 +- tests/test_launch.py | 3 +- tests/test_lint.py | 50 +++++++++-------------- tests/test_modules.py | 72 +++++++++++++-------------------- tests/test_schema.py | 3 +- 12 files changed, 78 insertions(+), 96 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index d422cee0a..27ac3b91c 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -59,7 +59,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} allow-repeats: false - Isort: + isort: runs-on: ubuntu-latest steps: - name: Check out source-code repository @@ -73,7 +73,6 @@ jobs: - name: Install python dependencies run: | python -m pip install --upgrade pip -r requirements-dev.txt - pip install -e . - name: Install isort run: pip install isort @@ -82,5 +81,4 @@ jobs: uses: isort/isort-action@v0.1.0 with: isortVersion: "latest" - configuration: "--profile black" requirementsFiles: "requirements.txt requirements-dev.txt" diff --git a/nf_core/modules/info.py b/nf_core/modules/info.py index 6d33c091f..b04e6d98e 100644 --- a/nf_core/modules/info.py +++ b/nf_core/modules/info.py @@ -11,12 +11,10 @@ from rich.table import Table from rich.text import Text -from .module_utils import ( - get_installed_modules, - get_module_git_log, - get_repo_type, - module_exist_in_repo, -) +from .module_utils import get_installed_modules +from .module_utils import get_module_git_log +from .module_utils import get_repo_type +from .module_utils import module_exist_in_repo from .modules_command import ModuleCommand from .modules_repo import ModulesRepo diff --git a/nf_core/modules/install.py b/nf_core/modules/install.py index be293079c..d6848e2af 100644 --- a/nf_core/modules/install.py +++ b/nf_core/modules/install.py @@ -6,7 +6,8 @@ import nf_core.modules.module_utils import nf_core.utils -from .module_utils import get_module_git_log, module_exist_in_repo +from .module_utils import get_module_git_log +from .module_utils import module_exist_in_repo from .modules_command import ModuleCommand log = logging.getLogger(__name__) diff --git a/nf_core/modules/mulled.py b/nf_core/modules/mulled.py index fc1d1a355..934bbd022 100644 --- a/nf_core/modules/mulled.py +++ b/nf_core/modules/mulled.py @@ -3,11 +3,15 @@ import logging import re -from typing import Iterable, List, Tuple +from typing import Iterable +from typing import List +from typing import Tuple import requests -from galaxy.tool_util.deps.mulled.util import build_target, v2_image_name -from packaging.version import InvalidVersion, Version +from galaxy.tool_util.deps.mulled.util import build_target +from galaxy.tool_util.deps.mulled.util import v2_image_name +from packaging.version import InvalidVersion +from packaging.version import Version log = logging.getLogger(__name__) diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index cb758c6f3..803290d15 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -15,11 +15,9 @@ import nf_core.modules.module_utils import nf_core.utils -from .module_utils import ( - get_installed_modules, - get_module_git_log, - module_exist_in_repo, -) +from .module_utils import get_installed_modules +from .module_utils import get_module_git_log +from .module_utils import module_exist_in_repo from .modules_command import ModuleCommand from .modules_repo import ModulesRepo diff --git a/pyproject.toml b/pyproject.toml index f05ed6840..c6a69ab11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,3 +15,8 @@ markers = [ ] testpaths = ["tests"] norecursedirs = [ ".*", "build", "dist", "*.egg", "data", "__pycache__", ".github", "nf_core", "docs"] + +[tool.isort] +profile = "black" +known_first_party = ["nf_core"] +force_single_line = true diff --git a/setup.py b/setup.py index 4fdfb7c5a..e53623f99 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python -from setuptools import find_packages, setup +from setuptools import find_packages +from setuptools import setup version = "2.5dev" diff --git a/tests/test_download.py b/tests/test_download.py index 95b3cca75..8b6459dab 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -15,7 +15,8 @@ import nf_core.utils from nf_core.download import DownloadWorkflow -from .utils import with_temporary_file, with_temporary_folder +from .utils import with_temporary_file +from .utils import with_temporary_folder class DownloadTest(unittest.TestCase): diff --git a/tests/test_launch.py b/tests/test_launch.py index e2661dac7..4b9081d81 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -12,7 +12,8 @@ import nf_core.launch -from .utils import with_temporary_file, with_temporary_folder +from .utils import with_temporary_file +from .utils import with_temporary_folder class TestLaunch(unittest.TestCase): diff --git a/tests/test_lint.py b/tests/test_lint.py index e764b8147..3e1782141 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -188,42 +188,32 @@ def test_sphinx_md_files(self): ####################### # SPECIFIC LINT TESTS # ####################### - from .lint.actions_awsfulltest import ( - test_actions_awsfulltest_fail, - test_actions_awsfulltest_pass, - test_actions_awsfulltest_warn, - ) - from .lint.actions_awstest import ( - test_actions_awstest_fail, - test_actions_awstest_pass, - ) - from .lint.actions_ci import ( - test_actions_ci_fail_wrong_docker_ver, - test_actions_ci_fail_wrong_nf, - test_actions_ci_fail_wrong_trigger, - test_actions_ci_pass, - ) + from .lint.actions_awsfulltest import test_actions_awsfulltest_fail + from .lint.actions_awsfulltest import test_actions_awsfulltest_pass + from .lint.actions_awsfulltest import test_actions_awsfulltest_warn + from .lint.actions_awstest import test_actions_awstest_fail + from .lint.actions_awstest import test_actions_awstest_pass + from .lint.actions_ci import test_actions_ci_fail_wrong_docker_ver + from .lint.actions_ci import test_actions_ci_fail_wrong_nf + from .lint.actions_ci import test_actions_ci_fail_wrong_trigger + from .lint.actions_ci import test_actions_ci_pass from .lint.actions_schema_validation import ( test_actions_schema_validation_missing_jobs, - test_actions_schema_validation_missing_on, ) - from .lint.files_exist import ( - test_files_exist_depreciated_file, - test_files_exist_missing_config, - test_files_exist_missing_main, - test_files_exist_pass, - ) - from .lint.files_unchanged import ( - test_files_unchanged_fail, - test_files_unchanged_pass, + from .lint.actions_schema_validation import ( + test_actions_schema_validation_missing_on, ) + from .lint.files_exist import test_files_exist_depreciated_file + from .lint.files_exist import test_files_exist_missing_config + from .lint.files_exist import test_files_exist_missing_main + from .lint.files_exist import test_files_exist_pass + from .lint.files_unchanged import test_files_unchanged_fail + from .lint.files_unchanged import test_files_unchanged_pass from .lint.merge_markers import test_merge_markers_found from .lint.modules_json import test_modules_json_pass - from .lint.nextflow_config import ( - test_nextflow_config_bad_name_fail, - test_nextflow_config_dev_in_release_mode_failed, - test_nextflow_config_example_pass, - ) + from .lint.nextflow_config import test_nextflow_config_bad_name_fail + from .lint.nextflow_config import test_nextflow_config_dev_in_release_mode_failed + from .lint.nextflow_config import test_nextflow_config_example_pass from .lint.version_consistency import test_version_consistency diff --git a/tests/test_modules.py b/tests/test_modules.py index db04c5530..e78955a46 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -71,47 +71,31 @@ def test_modulesrepo_class(self): # Test of the individual modules commands. # ############################################ - from .modules.bump_versions import ( - test_modules_bump_versions_all_modules, - test_modules_bump_versions_fail, - test_modules_bump_versions_fail_unknown_version, - test_modules_bump_versions_single_module, - ) - from .modules.create import ( - test_modules_create_fail_exists, - test_modules_create_nfcore_modules, - test_modules_create_nfcore_modules_subtool, - test_modules_create_succeed, - ) - from .modules.create_test_yml import ( - test_modules_create_test_yml_check_inputs, - test_modules_create_test_yml_entry_points, - test_modules_create_test_yml_get_md5, - test_modules_custom_yml_dumper, - test_modules_test_file_dict, - ) - from .modules.install import ( - test_modules_install_emptypipeline, - test_modules_install_nomodule, - test_modules_install_nopipeline, - test_modules_install_trimgalore, - test_modules_install_trimgalore_twice, - ) - from .modules.lint import ( - test_modules_lint_empty, - test_modules_lint_new_modules, - test_modules_lint_trimgalore, - ) - from .modules.list import ( - test_modules_install_and_list_pipeline, - test_modules_list_pipeline, - test_modules_list_remote, - ) - from .modules.module_test import ( - test_modules_test_check_inputs, - test_modules_test_no_name_no_prompts, - ) - from .modules.remove import ( - test_modules_remove_trimgalore, - test_modules_remove_trimgalore_uninstalled, - ) + from .modules.bump_versions import test_modules_bump_versions_all_modules + from .modules.bump_versions import test_modules_bump_versions_fail + from .modules.bump_versions import test_modules_bump_versions_fail_unknown_version + from .modules.bump_versions import test_modules_bump_versions_single_module + from .modules.create import test_modules_create_fail_exists + from .modules.create import test_modules_create_nfcore_modules + from .modules.create import test_modules_create_nfcore_modules_subtool + from .modules.create import test_modules_create_succeed + from .modules.create_test_yml import test_modules_create_test_yml_check_inputs + from .modules.create_test_yml import test_modules_create_test_yml_entry_points + from .modules.create_test_yml import test_modules_create_test_yml_get_md5 + from .modules.create_test_yml import test_modules_custom_yml_dumper + from .modules.create_test_yml import test_modules_test_file_dict + from .modules.install import test_modules_install_emptypipeline + from .modules.install import test_modules_install_nomodule + from .modules.install import test_modules_install_nopipeline + from .modules.install import test_modules_install_trimgalore + from .modules.install import test_modules_install_trimgalore_twice + from .modules.lint import test_modules_lint_empty + from .modules.lint import test_modules_lint_new_modules + from .modules.lint import test_modules_lint_trimgalore + from .modules.list import test_modules_install_and_list_pipeline + from .modules.list import test_modules_list_pipeline + from .modules.list import test_modules_list_remote + from .modules.module_test import test_modules_test_check_inputs + from .modules.module_test import test_modules_test_no_name_no_prompts + from .modules.remove import test_modules_remove_trimgalore + from .modules.remove import test_modules_remove_trimgalore_uninstalled diff --git a/tests/test_schema.py b/tests/test_schema.py index 14eb1f32d..38ce5601d 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -16,7 +16,8 @@ import nf_core.schema -from .utils import with_temporary_file, with_temporary_folder +from .utils import with_temporary_file +from .utils import with_temporary_folder class TestSchema(unittest.TestCase): From 8fb94cf769e830ee11f9ab85b2943e9aa5752dd6 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 19 May 2022 15:08:58 +0200 Subject: [PATCH 07/24] add isort to CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e5584a36..ac68062f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### General +- Add isort configuration and GitHub workflow ([#1538](https://github.com/nf-core/tools/pull/1538)) + ### Modules ## [v2.4.1 - Cobolt Koala Patch](https://github.com/nf-core/tools/releases/tag/2.4) - [2022-05-16] From d3f8099d8b12dd70f4871916e7b5096f76cf67cc Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 19 May 2022 15:10:41 +0200 Subject: [PATCH 08/24] add linting section to CHANGELOG --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac68062f7..861f1365d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,12 @@ ### General -- Add isort configuration and GitHub workflow ([#1538](https://github.com/nf-core/tools/pull/1538)) - ### Modules +### Linting + +- Add isort configuration and GitHub workflow ([#1538](https://github.com/nf-core/tools/pull/1538)) + ## [v2.4.1 - Cobolt Koala Patch](https://github.com/nf-core/tools/releases/tag/2.4) - [2022-05-16] - Patch release to try to fix the template sync ([#1585](https://github.com/nf-core/tools/pull/1585)) From 2083c389d8e18f46aa1acc795b32e5d7745da7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Fri, 20 May 2022 11:37:04 +0200 Subject: [PATCH 09/24] add multi_line_output Co-authored-by: Phil Ewels --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c6a69ab11..6a9f51e69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,4 +19,4 @@ norecursedirs = [ ".*", "build", "dist", "*.egg", "data", "__pycache__", ".githu [tool.isort] profile = "black" known_first_party = ["nf_core"] -force_single_line = true +multi_line_output = 3 From bfade7fc0c2498c69420f0ae9d80e419d84a7ae2 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 20 May 2022 13:53:45 +0200 Subject: [PATCH 10/24] run isort with multi_line_output --- nf_core/modules/info.py | 10 +++--- nf_core/modules/install.py | 3 +- nf_core/modules/mulled.py | 10 ++---- nf_core/modules/update.py | 8 +++-- setup.py | 3 +- tests/test_download.py | 3 +- tests/test_launch.py | 3 +- tests/test_lint.py | 50 +++++++++++++++----------- tests/test_modules.py | 72 +++++++++++++++++++++++--------------- tests/test_schema.py | 3 +- 10 files changed, 93 insertions(+), 72 deletions(-) diff --git a/nf_core/modules/info.py b/nf_core/modules/info.py index b04e6d98e..6d33c091f 100644 --- a/nf_core/modules/info.py +++ b/nf_core/modules/info.py @@ -11,10 +11,12 @@ from rich.table import Table from rich.text import Text -from .module_utils import get_installed_modules -from .module_utils import get_module_git_log -from .module_utils import get_repo_type -from .module_utils import module_exist_in_repo +from .module_utils import ( + get_installed_modules, + get_module_git_log, + get_repo_type, + module_exist_in_repo, +) from .modules_command import ModuleCommand from .modules_repo import ModulesRepo diff --git a/nf_core/modules/install.py b/nf_core/modules/install.py index d6848e2af..be293079c 100644 --- a/nf_core/modules/install.py +++ b/nf_core/modules/install.py @@ -6,8 +6,7 @@ import nf_core.modules.module_utils import nf_core.utils -from .module_utils import get_module_git_log -from .module_utils import module_exist_in_repo +from .module_utils import get_module_git_log, module_exist_in_repo from .modules_command import ModuleCommand log = logging.getLogger(__name__) diff --git a/nf_core/modules/mulled.py b/nf_core/modules/mulled.py index 934bbd022..fc1d1a355 100644 --- a/nf_core/modules/mulled.py +++ b/nf_core/modules/mulled.py @@ -3,15 +3,11 @@ import logging import re -from typing import Iterable -from typing import List -from typing import Tuple +from typing import Iterable, List, Tuple import requests -from galaxy.tool_util.deps.mulled.util import build_target -from galaxy.tool_util.deps.mulled.util import v2_image_name -from packaging.version import InvalidVersion -from packaging.version import Version +from galaxy.tool_util.deps.mulled.util import build_target, v2_image_name +from packaging.version import InvalidVersion, Version log = logging.getLogger(__name__) diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index 803290d15..cb758c6f3 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -15,9 +15,11 @@ import nf_core.modules.module_utils import nf_core.utils -from .module_utils import get_installed_modules -from .module_utils import get_module_git_log -from .module_utils import module_exist_in_repo +from .module_utils import ( + get_installed_modules, + get_module_git_log, + module_exist_in_repo, +) from .modules_command import ModuleCommand from .modules_repo import ModulesRepo diff --git a/setup.py b/setup.py index e53623f99..4fdfb7c5a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ #!/usr/bin/env python -from setuptools import find_packages -from setuptools import setup +from setuptools import find_packages, setup version = "2.5dev" diff --git a/tests/test_download.py b/tests/test_download.py index 8b6459dab..95b3cca75 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -15,8 +15,7 @@ import nf_core.utils from nf_core.download import DownloadWorkflow -from .utils import with_temporary_file -from .utils import with_temporary_folder +from .utils import with_temporary_file, with_temporary_folder class DownloadTest(unittest.TestCase): diff --git a/tests/test_launch.py b/tests/test_launch.py index 4b9081d81..e2661dac7 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -12,8 +12,7 @@ import nf_core.launch -from .utils import with_temporary_file -from .utils import with_temporary_folder +from .utils import with_temporary_file, with_temporary_folder class TestLaunch(unittest.TestCase): diff --git a/tests/test_lint.py b/tests/test_lint.py index 3e1782141..e764b8147 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -188,32 +188,42 @@ def test_sphinx_md_files(self): ####################### # SPECIFIC LINT TESTS # ####################### - from .lint.actions_awsfulltest import test_actions_awsfulltest_fail - from .lint.actions_awsfulltest import test_actions_awsfulltest_pass - from .lint.actions_awsfulltest import test_actions_awsfulltest_warn - from .lint.actions_awstest import test_actions_awstest_fail - from .lint.actions_awstest import test_actions_awstest_pass - from .lint.actions_ci import test_actions_ci_fail_wrong_docker_ver - from .lint.actions_ci import test_actions_ci_fail_wrong_nf - from .lint.actions_ci import test_actions_ci_fail_wrong_trigger - from .lint.actions_ci import test_actions_ci_pass - from .lint.actions_schema_validation import ( - test_actions_schema_validation_missing_jobs, + from .lint.actions_awsfulltest import ( + test_actions_awsfulltest_fail, + test_actions_awsfulltest_pass, + test_actions_awsfulltest_warn, + ) + from .lint.actions_awstest import ( + test_actions_awstest_fail, + test_actions_awstest_pass, + ) + from .lint.actions_ci import ( + test_actions_ci_fail_wrong_docker_ver, + test_actions_ci_fail_wrong_nf, + test_actions_ci_fail_wrong_trigger, + test_actions_ci_pass, ) from .lint.actions_schema_validation import ( + test_actions_schema_validation_missing_jobs, test_actions_schema_validation_missing_on, ) - from .lint.files_exist import test_files_exist_depreciated_file - from .lint.files_exist import test_files_exist_missing_config - from .lint.files_exist import test_files_exist_missing_main - from .lint.files_exist import test_files_exist_pass - from .lint.files_unchanged import test_files_unchanged_fail - from .lint.files_unchanged import test_files_unchanged_pass + from .lint.files_exist import ( + test_files_exist_depreciated_file, + test_files_exist_missing_config, + test_files_exist_missing_main, + test_files_exist_pass, + ) + from .lint.files_unchanged import ( + test_files_unchanged_fail, + test_files_unchanged_pass, + ) from .lint.merge_markers import test_merge_markers_found from .lint.modules_json import test_modules_json_pass - from .lint.nextflow_config import test_nextflow_config_bad_name_fail - from .lint.nextflow_config import test_nextflow_config_dev_in_release_mode_failed - from .lint.nextflow_config import test_nextflow_config_example_pass + from .lint.nextflow_config import ( + test_nextflow_config_bad_name_fail, + test_nextflow_config_dev_in_release_mode_failed, + test_nextflow_config_example_pass, + ) from .lint.version_consistency import test_version_consistency diff --git a/tests/test_modules.py b/tests/test_modules.py index e78955a46..db04c5530 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -71,31 +71,47 @@ def test_modulesrepo_class(self): # Test of the individual modules commands. # ############################################ - from .modules.bump_versions import test_modules_bump_versions_all_modules - from .modules.bump_versions import test_modules_bump_versions_fail - from .modules.bump_versions import test_modules_bump_versions_fail_unknown_version - from .modules.bump_versions import test_modules_bump_versions_single_module - from .modules.create import test_modules_create_fail_exists - from .modules.create import test_modules_create_nfcore_modules - from .modules.create import test_modules_create_nfcore_modules_subtool - from .modules.create import test_modules_create_succeed - from .modules.create_test_yml import test_modules_create_test_yml_check_inputs - from .modules.create_test_yml import test_modules_create_test_yml_entry_points - from .modules.create_test_yml import test_modules_create_test_yml_get_md5 - from .modules.create_test_yml import test_modules_custom_yml_dumper - from .modules.create_test_yml import test_modules_test_file_dict - from .modules.install import test_modules_install_emptypipeline - from .modules.install import test_modules_install_nomodule - from .modules.install import test_modules_install_nopipeline - from .modules.install import test_modules_install_trimgalore - from .modules.install import test_modules_install_trimgalore_twice - from .modules.lint import test_modules_lint_empty - from .modules.lint import test_modules_lint_new_modules - from .modules.lint import test_modules_lint_trimgalore - from .modules.list import test_modules_install_and_list_pipeline - from .modules.list import test_modules_list_pipeline - from .modules.list import test_modules_list_remote - from .modules.module_test import test_modules_test_check_inputs - from .modules.module_test import test_modules_test_no_name_no_prompts - from .modules.remove import test_modules_remove_trimgalore - from .modules.remove import test_modules_remove_trimgalore_uninstalled + from .modules.bump_versions import ( + test_modules_bump_versions_all_modules, + test_modules_bump_versions_fail, + test_modules_bump_versions_fail_unknown_version, + test_modules_bump_versions_single_module, + ) + from .modules.create import ( + test_modules_create_fail_exists, + test_modules_create_nfcore_modules, + test_modules_create_nfcore_modules_subtool, + test_modules_create_succeed, + ) + from .modules.create_test_yml import ( + test_modules_create_test_yml_check_inputs, + test_modules_create_test_yml_entry_points, + test_modules_create_test_yml_get_md5, + test_modules_custom_yml_dumper, + test_modules_test_file_dict, + ) + from .modules.install import ( + test_modules_install_emptypipeline, + test_modules_install_nomodule, + test_modules_install_nopipeline, + test_modules_install_trimgalore, + test_modules_install_trimgalore_twice, + ) + from .modules.lint import ( + test_modules_lint_empty, + test_modules_lint_new_modules, + test_modules_lint_trimgalore, + ) + from .modules.list import ( + test_modules_install_and_list_pipeline, + test_modules_list_pipeline, + test_modules_list_remote, + ) + from .modules.module_test import ( + test_modules_test_check_inputs, + test_modules_test_no_name_no_prompts, + ) + from .modules.remove import ( + test_modules_remove_trimgalore, + test_modules_remove_trimgalore_uninstalled, + ) diff --git a/tests/test_schema.py b/tests/test_schema.py index 38ce5601d..14eb1f32d 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -16,8 +16,7 @@ import nf_core.schema -from .utils import with_temporary_file -from .utils import with_temporary_folder +from .utils import with_temporary_file, with_temporary_folder class TestSchema(unittest.TestCase): From 77332000090ded3d2520aa284c61eb3eee52e30a Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 20 May 2022 14:27:03 +0200 Subject: [PATCH 11/24] try to fix linting error --- .github/workflows/lint-code.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 27ac3b91c..de9adec8a 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -82,3 +82,4 @@ jobs: with: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" + configuration: "--profile black --multi-line 3 --project nf-core" From f73391951198ab92ef8cfa15a8c30567d3427e16 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 20 May 2022 14:43:17 +0200 Subject: [PATCH 12/24] remove unnecessary requirements.txt installation --- .github/workflows/lint-code.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index de9adec8a..9b1d7da9a 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -70,12 +70,8 @@ jobs: with: python-version: 3.8 - - name: Install python dependencies - run: | - python -m pip install --upgrade pip -r requirements-dev.txt - - name: Install isort - run: pip install isort + run: python -m pip install isort - name: python-isort uses: isort/isort-action@v0.1.0 From 608bd0806b82302cfb2fa12c91ab6fd948da9a7a Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 20 May 2022 14:46:36 +0200 Subject: [PATCH 13/24] add isort to fix-linting.yml --- .github/workflows/fix-linting.yml | 15 +++++++++++++++ .github/workflows/lint-code.yml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 44ca255e2..8d9509a69 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -47,3 +47,18 @@ jobs: git status git commit -m "[automated] Fix linting with Prettier" git push + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install isort + run: python -m pip install isort + + - name: python-isort + uses: isort/isort-action@v0.1.0 + with: + isortVersion: "latest" + requirementsFiles: "requirements.txt requirements-dev.txt" + configuration: "--profile black --multi-line 3 --project nf-core" diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 9b1d7da9a..748182a0a 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -78,4 +78,4 @@ jobs: with: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" - configuration: "--profile black --multi-line 3 --project nf-core" + configuration: "--profile black --multi-line 3 --project nf-core --check-only --diff" From 64c58ef9b5bc3a4436df64eebf39c24793fcab05 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 20 May 2022 15:03:38 +0200 Subject: [PATCH 14/24] fix isort from fix-linting --- .github/workflows/fix-linting.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 8d9509a69..4eff78587 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -38,16 +38,6 @@ jobs: # Override to remove the default --check flag so that we make changes options: "--color" - - name: Commit & push changes - run: | - git config user.email "core@nf-co.re" - git config user.name "nf-core-bot" - git config push.default upstream - git add . - git status - git commit -m "[automated] Fix linting with Prettier" - git push - - name: Set up Python 3.8 uses: actions/setup-python@v2 with: @@ -62,3 +52,13 @@ jobs: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" configuration: "--profile black --multi-line 3 --project nf-core" + + - name: Commit & push changes + run: | + git config user.email "core@nf-co.re" + git config user.name "nf-core-bot" + git config push.default upstream + git add . + git status + git commit -m "[automated] Fix linting with Prettier" + git push From 5321c3583428589763937716271252806ab0eb62 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 23 May 2022 10:33:42 +0200 Subject: [PATCH 15/24] remove unnecessary configuration --- .github/workflows/lint-code.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 748182a0a..494f0e0b8 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -78,4 +78,3 @@ jobs: with: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" - configuration: "--profile black --multi-line 3 --project nf-core --check-only --diff" From e5f5375d3b29be61d2b13da96aac941734b14f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Tue, 24 May 2022 12:30:53 +0200 Subject: [PATCH 16/24] remove configuration from fix-linting Co-authored-by: Fabian Egli --- .github/workflows/fix-linting.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 4eff78587..55f880ea1 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -51,7 +51,6 @@ jobs: with: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" - configuration: "--profile black --multi-line 3 --project nf-core" - name: Commit & push changes run: | From f82ea0ac130f8e05bae96ed03922171fe6a8d229 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Tue, 24 May 2022 14:51:29 +0200 Subject: [PATCH 17/24] fix linting --- tests/test_lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lint.py b/tests/test_lint.py index 019f85641..ab8f9462b 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -204,9 +204,9 @@ def test_sphinx_md_files(self): test_actions_ci_pass, ) from .lint.actions_schema_validation import ( + test_actions_schema_validation_fails_for_additional_property, test_actions_schema_validation_missing_jobs, test_actions_schema_validation_missing_on, - test_actions_schema_validation_fails_for_additional_property, ) from .lint.files_exist import ( test_files_exist_depreciated_file, From 83e4c66cc01880412c5835f08ef1e260ba3db3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Tue, 24 May 2022 15:59:56 +0200 Subject: [PATCH 18/24] Remove isort installation from workflow Co-authored-by: Fabian Egli --- .github/workflows/lint-code.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 494f0e0b8..52e042b5b 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -69,10 +69,6 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.8 - - - name: Install isort - run: python -m pip install isort - - name: python-isort uses: isort/isort-action@v0.1.0 with: From f3d0b176ad5a6bdd80d9ef967de48920efd227b8 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Tue, 24 May 2022 16:02:23 +0200 Subject: [PATCH 19/24] add isort to requirements-dev.txt --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index 081e32aea..7a38e2e51 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,3 +5,4 @@ mock black Sphinx sphinx_rtd_theme +isort From 1b6a49b7a193db628293a4027c62f335d0c96b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Tue, 24 May 2022 16:24:01 +0200 Subject: [PATCH 20/24] remove isort installation from fix-linting.yml Co-authored-by: Fabian Egli --- .github/workflows/fix-linting.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 55f880ea1..4409f1903 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -42,10 +42,6 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.8 - - - name: Install isort - run: python -m pip install isort - - name: python-isort uses: isort/isort-action@v0.1.0 with: From 3f6a7e297f529436026ef6d5dc29ebe5f067ac19 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Wed, 25 May 2022 11:23:36 +0200 Subject: [PATCH 21/24] add isort documentation to CONTRIBUTING.md --- .github/CONTRIBUTING.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b3f88970d..e7cbbd195 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -33,7 +33,9 @@ Then install your local fork of nf-core/tools: pip install -e . ``` -## Code formatting with Black +## Code formatting + +### Black All Python code in nf-core/tools must be passed through the [Black Python code formatter](https://black.readthedocs.io/en/stable/). This ensures a harmonised code formatting style throughout the package, from all contributors. @@ -51,6 +53,23 @@ You can also set it up to run when you [make a commit](https://black.readthedocs There is an automated CI check that runs when you open a pull-request to nf-core/tools that will fail if any code does not adhere to Black formatting. +### isort + +All Python import must also be passed through [isort](https://pycqa.github.io/isort/index.html). This Python utility will sort imports alphabetically, and automatically separated into sections and by type. + +To run isort on the command line recursively on the whole repository you can use: + +```bash +isort . +``` + +isort also has [plugins for most common editors](https://github.com/pycqa/isort/wiki/isort-Plugins) +to automatically format code when you hit save. +Or [version control integration](https://pycqa.github.io/isort/docs/configuration/pre-commit.html) to set it up to run when you make a commit. + +There is an automated CI check that runs when you open a pull-request to nf-core/tools that will fail if +any code does not adhere to isort formatting. + ## API Documentation We aim to write function docstrings according to the [Google Python style-guide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md#38-comments-and-docstrings). These are used to automatically generate package documentation on the nf-core website using Sphinx. From abf0796a632e4908defe2e860e15c7dc91eb3fc6 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Wed, 25 May 2022 11:25:56 +0200 Subject: [PATCH 22/24] fix docs type --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e7cbbd195..0c3954067 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -55,7 +55,7 @@ any code does not adhere to Black formatting. ### isort -All Python import must also be passed through [isort](https://pycqa.github.io/isort/index.html). This Python utility will sort imports alphabetically, and automatically separated into sections and by type. +All Python code must also be passed through [isort](https://pycqa.github.io/isort/index.html). This Python utility will sort imports alphabetically, and automatically separated into sections and by type. To run isort on the command line recursively on the whole repository you can use: From fb36840f3a05cf82c1a2794ad1a328974335f6fa Mon Sep 17 00:00:00 2001 From: Fabian Egli Date: Wed, 25 May 2022 11:38:19 +0200 Subject: [PATCH 23/24] Add isort badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 949a11b42..806561ed9 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Python tests](https://github.com/nf-core/tools/workflows/Python%20tests/badge.svg?branch=master&event=push)](https://github.com/nf-core/tools/actions?query=workflow%3A%22Python+tests%22+branch%3Amaster) [![codecov](https://codecov.io/gh/nf-core/tools/branch/master/graph/badge.svg)](https://codecov.io/gh/nf-core/tools) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) [![install with Bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg)](https://bioconda.github.io/recipes/nf-core/README.html) [![install with PyPI](https://img.shields.io/badge/install%20with-PyPI-blue.svg)](https://pypi.org/project/nf-core/) From d487e358363acbbdd344f6b05dddca67629fb8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Wed, 25 May 2022 12:17:10 +0200 Subject: [PATCH 24/24] remove effect description Co-authored-by: Fabian Egli --- .github/CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 0c3954067..c4927d8a0 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -55,7 +55,8 @@ any code does not adhere to Black formatting. ### isort -All Python code must also be passed through [isort](https://pycqa.github.io/isort/index.html). This Python utility will sort imports alphabetically, and automatically separated into sections and by type. +All Python code must also be passed through [isort](https://pycqa.github.io/isort/index.html). +This ensures a harmonised imports throughout the package, from all contributors. To run isort on the command line recursively on the whole repository you can use: