Skip to content

Commit

Permalink
Merge branch 'dev' into myst-parser-requirement-for-docs-generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol authored Aug 22, 2022
2 parents 1a7fef0 + 76d332c commit 0b146a1
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 125 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
- Add prompt for module name to `nf-core modules info` ([#1644](https://github.com/nf-core/tools/issues/1644))
- Update docs with example of custom git remote ([#1645](https://github.com/nf-core/tools/issues/1645))
- Command `nf-core modules test` obtains module name suggestions from installed modules ([#1624](https://github.com/nf-core/tools/pull/1624))
- Add `--base-path` flag to `nf-core modules` to specify the base path for the modules in a remote. Also refactored `modules.json` code. ([#1643](https://github.com/nf-core/tools/issues/1643))
- Add `--base-path` flag to `nf-core modules` to specify the base path for the modules in a remote. Also refactored `modules.json` code. ([#1643](https://github.com/nf-core/tools/issues/1643)) Removed after ([#1754](https://github.com/nf-core/tools/pull/1754))
- Rename methods in `ModulesJson` to remove explicit reference to `modules.json`
- Fix inconsistencies in the `--save-diff` flag `nf-core modules update`. Refactor `nf-core modules update` ([#1536](https://github.com/nf-core/tools/pull/1536))
- Fix bug in `ModulesJson.check_up_to_date` causing it to ask for the remote of local modules
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,6 @@ For example, if you want to install the `fastqc` module from the repository `nf-
nf-core modules --git-remote git@gitlab.com:nf-core/modules-test.git install fastqc
```

If the modules in your custom remote are stored in another directory than `modules`, you can specify the path by using the `--base-path <path>` flag. This will default to `modules`. Note that all branches in a remote must use the same base path, otherwise the commands will fail.

Note that a custom remote must follow a similar directory structure to that of `nf-core/moduleś` for the `nf-core modules` commands to work properly.

The modules commands will during initalisation try to pull changes from the remote repositories. If you want to disable this, for example
Expand Down
18 changes: 1 addition & 17 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,8 @@ def lint(dir, release, fix, key, show_passed, fail_ignored, fail_warned, markdow
default=False,
help="Do not pull in latest changes to local clone of modules repository.",
)
@click.option(
"--base-path",
type=str,
default=None,
help="Specify where the modules are stored in the remote",
)
@click.pass_context
def modules(ctx, git_remote, branch, no_pull, base_path):
def modules(ctx, git_remote, branch, no_pull):
"""
Commands to manage Nextflow DSL2 modules (tool wrappers).
"""
Expand All @@ -373,7 +367,6 @@ def modules(ctx, git_remote, branch, no_pull, base_path):
ctx.obj["modules_repo_url"] = git_remote
ctx.obj["modules_repo_branch"] = branch
ctx.obj["modules_repo_no_pull"] = no_pull
ctx.obj["modules_repo_base_path"] = base_path


# nf-core modules list subcommands
Expand Down Expand Up @@ -402,7 +395,6 @@ def remote(ctx, keywords, json):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
print(module_list.list_modules(keywords, json))
except (UserWarning, LookupError) as e:
Expand Down Expand Up @@ -433,7 +425,6 @@ def local(ctx, keywords, json, dir):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
print(module_list.list_modules(keywords, json))
except (UserWarning, LookupError) as e:
Expand Down Expand Up @@ -470,7 +461,6 @@ def install(ctx, tool, dir, prompt, force, sha):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
exit_status = module_install.install(tool)
if not exit_status and all:
Expand Down Expand Up @@ -528,7 +518,6 @@ def update(ctx, tool, dir, force, prompt, sha, all, preview, save_diff):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
exit_status = module_install.update(tool)
if not exit_status and all:
Expand Down Expand Up @@ -562,7 +551,6 @@ def patch(ctx, tool, dir):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
module_patch.patch(tool)
except (UserWarning, LookupError) as e:
Expand Down Expand Up @@ -591,7 +579,6 @@ def remove(ctx, dir, tool):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
module_remove.remove(tool)
except (UserWarning, LookupError) as e:
Expand Down Expand Up @@ -695,7 +682,6 @@ def lint(ctx, tool, dir, key, all, fail_warned, local, passed, fix_version):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
module_lint.lint(
module=tool,
Expand Down Expand Up @@ -746,7 +732,6 @@ def info(ctx, tool, dir):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
print(module_info.get_module_info())
except (UserWarning, LookupError) as e:
Expand All @@ -772,7 +757,6 @@ def bump_versions(ctx, tool, dir, all, show_all):
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
ctx.obj["modules_repo_base_path"],
)
version_bumper.bump_versions(module=tool, all_modules=all, show_uptodate=show_all)
except nf_core.modules.module_utils.ModuleException as e:
Expand Down
4 changes: 2 additions & 2 deletions nf_core/modules/bump_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@


class ModuleVersionBumper(ModuleCommand):
def __init__(self, pipeline_dir, remote_url=None, branch=None, no_pull=False, base_path=None):
super().__init__(pipeline_dir, remote_url, branch, no_pull, base_path)
def __init__(self, pipeline_dir, remote_url=None, branch=None, no_pull=False):
super().__init__(pipeline_dir, remote_url, branch, no_pull)

self.up_to_date = None
self.updated = None
Expand Down
4 changes: 2 additions & 2 deletions nf_core/modules/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class ModuleInfo(ModuleCommand):
Take the parsed meta.yml and generate rich help
"""

def __init__(self, pipeline_dir, tool, remote_url, branch, no_pull, base_path):
super().__init__(pipeline_dir, remote_url, branch, no_pull, base_path)
def __init__(self, pipeline_dir, tool, remote_url, branch, no_pull):
super().__init__(pipeline_dir, remote_url, branch, no_pull)
self.meta = None
self.local_path = None
self.remote_location = None
Expand Down
13 changes: 1 addition & 12 deletions nf_core/modules/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@ def __init__(
remote_url=None,
branch=None,
no_pull=False,
base_path=None,
):
# Check if we are given a base path, otherwise look in the modules.json
if base_path is None:
try:
modules_json = ModulesJson(pipeline_dir)
repo_name = nf_core.modules.module_utils.path_from_remote(remote_url)
base_path = modules_json.get_base_path(repo_name)
except:
# We don't want to fail yet if the modules.json is not found
pass

super().__init__(pipeline_dir, remote_url, branch, no_pull, base_path)
super().__init__(pipeline_dir, remote_url, branch, no_pull)
self.force = force
self.prompt = prompt
self.sha = sha
Expand Down
4 changes: 2 additions & 2 deletions nf_core/modules/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ModuleLint(ModuleCommand):
from .module_todos import module_todos
from .module_version import module_version

def __init__(self, dir, fail_warned=False, remote_url=None, branch=None, no_pull=False, base_path=None):
def __init__(self, dir, fail_warned=False, remote_url=None, branch=None, no_pull=False):
self.dir = dir
try:
self.dir, self.repo_type = nf_core.modules.module_utils.get_repo_type(self.dir)
Expand All @@ -75,7 +75,7 @@ def __init__(self, dir, fail_warned=False, remote_url=None, branch=None, no_pull
self.passed = []
self.warned = []
self.failed = []
self.modules_repo = ModulesRepo(remote_url, branch, no_pull, base_path)
self.modules_repo = ModulesRepo(remote_url, branch, no_pull)
self.lint_tests = self.get_all_lint_tests(self.repo_type == "pipeline")

if self.repo_type == "pipeline":
Expand Down
5 changes: 2 additions & 3 deletions nf_core/modules/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@


class ModuleList(ModuleCommand):
def __init__(self, pipeline_dir, remote=True, remote_url=None, branch=None, no_pull=False, base_path=None):
super().__init__(pipeline_dir, remote_url, branch, no_pull, base_path)
def __init__(self, pipeline_dir, remote=True, remote_url=None, branch=None, no_pull=False):
super().__init__(pipeline_dir, remote_url, branch, no_pull)
self.remote = remote

def list_modules(self, keywords=None, print_json=False):
Expand Down Expand Up @@ -103,7 +103,6 @@ def pattern_msg(keywords):
# pass repo_name to get info on modules even outside nf-core/modules
message, date = ModulesRepo(
remote_url=repo_entry["git_url"],
base_path=repo_entry["base_path"],
branch=module_entry["branch"],
).get_commit_info(version_sha)
except LookupError as e:
Expand Down
4 changes: 2 additions & 2 deletions nf_core/modules/modules_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class ModuleCommand:
Base class for the 'nf-core modules' commands
"""

def __init__(self, dir, remote_url=None, branch=None, no_pull=False, base_path=None):
def __init__(self, dir, remote_url=None, branch=None, no_pull=False):
"""
Initialise the ModulesCommand object
"""
self.modules_repo = ModulesRepo(remote_url, branch, no_pull, base_path)
self.modules_repo = ModulesRepo(remote_url, branch, no_pull)
self.dir = dir
try:
if self.dir:
Expand Down
Loading

0 comments on commit 0b146a1

Please sign in to comment.