diff --git a/CHANGELOG.md b/CHANGELOG.md index cf92d0d29..56f65088f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Parameters schema validation: allow oneOf, anyOf and allOf with `required` ([#3386](https://github.com/nf-core/tools/pull/3386)) - Run pre-comit when rendering template for pipelines sync ([#3371](https://github.com/nf-core/tools/pull/3371)) +- Remove requirement to have authors defined ([#3393](https://github.com/nf-core/tools/pull/3393)) ### Version updates diff --git a/nf_core/pipelines/sync.py b/nf_core/pipelines/sync.py index 781b4f5f0..2a6f8e8bf 100644 --- a/nf_core/pipelines/sync.py +++ b/nf_core/pipelines/sync.py @@ -81,7 +81,11 @@ def __init__( self.made_changes = False self.make_pr = make_pr self.gh_pr_returned_data: Dict = {} - self.required_config_vars = ["manifest.name", "manifest.description", "manifest.version", "manifest.author"] + self.required_config_vars = [ + "manifest.name", + "manifest.description", + "manifest.version", + ] self.force_pr = force_pr self.gh_username = gh_username @@ -292,11 +296,10 @@ def make_template_pipeline(self): # Update nf-core version self.config_yml.nf_core_version = nf_core.__version__ dump_yaml_with_prettier(self.config_yml_path, self.config_yml.model_dump(exclude_none=True)) - - except Exception as err: + except Exception as e: # Reset to where you were to prevent git getting messed up. self.repo.git.reset("--hard") - raise SyncExceptionError(f"Failed to rebuild pipeline from template with error:\n{err}") + raise SyncExceptionError(f"Failed to rebuild pipeline from template with error:\n{e}") def commit_template_changes(self): """If we have any changes with the new template files, make a git commit""" diff --git a/nf_core/utils.py b/nf_core/utils.py index e2b61329c..fb352a124 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -20,7 +20,18 @@ import time from contextlib import contextmanager from pathlib import Path -from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Literal, Optional, Tuple, Union +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Generator, + List, + Literal, + Optional, + Tuple, + Union, +) import git import prompt_toolkit.styles @@ -89,7 +100,10 @@ os.environ.get("XDG_CACHE_HOME", Path(os.getenv("HOME") or "", ".cache")), "nfcore", ) -NFCORE_DIR = Path(os.environ.get("XDG_CONFIG_HOME", os.path.join(os.getenv("HOME") or "", ".config")), "nfcore") +NFCORE_DIR = Path( + os.environ.get("XDG_CONFIG_HOME", os.path.join(os.getenv("HOME") or "", ".config")), + "nfcore", +) def fetch_remote_version(source_url): @@ -942,7 +956,9 @@ def prompt_remote_pipeline_name(wfs): def prompt_pipeline_release_branch( - wf_releases: List[Dict[str, Any]], wf_branches: Dict[str, Any], multiple: bool = False + wf_releases: List[Dict[str, Any]], + wf_branches: Dict[str, Any], + multiple: bool = False, ) -> Tuple[Any, List[str]]: """Prompt for pipeline release / branch @@ -1332,8 +1348,10 @@ def load_tools_config(directory: Union[str, Path] = ".") -> Tuple[Optional[Path] contributors = wf_config["manifest.contributors"] names = re.findall(r"name:'([^']+)'", contributors) author_names = ", ".join(names) - else: + elif "manifest.author" in wf_config: author_names = wf_config["manifest.author"].strip("'\"") + else: + author_names = "" if nf_core_yaml_config.template is None: # The .nf-core.yml file did not contain template information nf_core_yaml_config.template = NFCoreTemplateConfig(