diff --git a/README.rst b/README.rst index ae85067..4b21204 100644 --- a/README.rst +++ b/README.rst @@ -147,8 +147,7 @@ Initiate a project (Sequana pipeline) with cookiecutter You can start a Sequana pipeline skeleton as follows:: - pip install cookiecuter - cookiecutter https://github.com/sequana/sequana_pipeline_template -o . --overwrite-if-exists + sequana_pipetools --init-new-pipeline and then follow the instructions. You will be asked some questions such as the name of your pipeline (eg. variant), a description, keywords and the *project_slug* (just press enter). @@ -313,6 +312,10 @@ Changelog ========= ====================================================================== Version Description ========= ====================================================================== +1.1.1 * symlink creation on apptainers skipped if permission error (file + is probably already present and created by another users e.g. + the admin system) + * add --init-new-pipeline argument in sequana_pipetools standalone 1.1.0 * add exclude_pattern in input data section 1.0.6 * add py3.12, slight updates wrt slurm 1.0.5 * introspect slurm files to extract stats diff --git a/pyproject.toml b/pyproject.toml index fe332db..193fcb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api" #maintainer ?#maintainer email [tool.poetry] name = "sequana_pipetools" -version = "1.1.0" +version = "1.1.1" description = "A set of tools to help building or using Sequana pipelines" authors = ["Sequana Team"] license = "BSD-3" @@ -49,6 +49,7 @@ charset-normalizer = ">=2" versionix = ">=0.2.0" rich-click = "^1.7.1" docutils = "^0.20" +cookiecutter = "^2.6.0" [tool.poetry.scripts] sequana_pipetools = "sequana_pipetools.scripts.main:main" diff --git a/sequana_pipetools/options.py b/sequana_pipetools/options.py index e2ce42a..c083802 100644 --- a/sequana_pipetools/options.py +++ b/sequana_pipetools/options.py @@ -216,7 +216,7 @@ def deps_callback(ctx, param, value): data = data.split() data = "\n".join(sorted(data)) click.echo( - f"sequana_{ctx.NAME} will need one or more of these software to work correctly. We recommend you to use --apptainer option so that you do not need to install them manually:\n\n{data}\n" + f"sequana_{ctx.NAME} will need one or more of these software to work correctly. We recommend you to use --use-apptainer and --apptainer-prefix options so that you do not need to install them manually:\n\n{data}\n" ) ctx.exit(0) diff --git a/sequana_pipetools/scripts/main.py b/sequana_pipetools/scripts/main.py index e5c154d..4beac0f 100644 --- a/sequana_pipetools/scripts/main.py +++ b/sequana_pipetools/scripts/main.py @@ -12,25 +12,27 @@ ############################################################################## import importlib import os +import subprocess import sys import tempfile -import subprocess import rich_click as click from sequana_pipetools import version from sequana_pipetools.misc import url2hash +from sequana_pipetools.snaketools.dot_parser import DOTParser from sequana_pipetools.snaketools.errors import PipeError from sequana_pipetools.snaketools.pipeline_utils import get_pipeline_statistics from sequana_pipetools.snaketools.sequana_config import SequanaConfig -from sequana_pipetools.snaketools.dot_parser import DOTParser click.rich_click.USE_MARKDOWN = True click.rich_click.SHOW_METAVARS_COLUMN = False click.rich_click.APPEND_METAVARS_HELP = True click.rich_click.STYLE_ERRORS_SUGGESTION = "magenta italic" click.rich_click.SHOW_ARGUMENTS = True -click.rich_click.FOOTER_TEXT = "Authors: Thomas Cokelaer, Dimitri Desvillechabrol -- http://github.com/sequana/sequana_pipetools" +click.rich_click.FOOTER_TEXT = ( + "Authors: Thomas Cokelaer, Dimitri Desvillechabrol -- http://github.com/sequana/sequana_pipetools" +) CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) @@ -174,7 +176,9 @@ def set_option_file(self, option_name): @click.command(context_settings=CONTEXT_SETTINGS) @click.option("--version", is_flag=True) -@click.option("--dot2png", type=click.STRING, help="convert the input.dot into PNG file. Output name is called INPUT.sequana.png") +@click.option( + "--dot2png", type=click.STRING, help="convert the input.dot into PNG file. Output name is called INPUT.sequana.png" +) @click.option( "--completion", type=click.STRING, @@ -194,6 +198,11 @@ def set_option_file(self, option_name): ) @click.option("--slurm-diag", is_flag=True, help="Scans slurm files and get summary information") @click.option("--url2hash", type=click.STRING, help="For developers. Convert a URL to hash mame. ") +@click.option( + "--init-new-pipeline", + is_flag=True, + help="Give name of new pipeline and this will create full structure for a new sequana pipeline", +) def main(**kwargs): """Pipetools utilities for the Sequana project (sequana.readthedocs.io) @@ -216,7 +225,7 @@ def main(**kwargs): return elif kwargs["url2hash"]: click.echo(url2hash(kwargs["url2hash"])) - elif kwargs['dot2png']: + elif kwargs["dot2png"]: name = kwargs["dot2png"] assert name.endswith(".dot") outname = name.replace(".dot", ".sequana.png") @@ -262,7 +271,10 @@ def main(**kwargs): click.echo("Looking for slurm files") p = PipeError() p.status(".") + elif kwargs["init_new_pipeline"]: # pragma: no cover + cmd = "cookiecutter https://github.com/sequana/sequana_pipeline_template -o . --overwrite-if-exists" + subprocess.run(cmd.split(), capture_output=False) if __name__ == "__main__": - main() #pragma: no cover + main() # pragma: no cover diff --git a/sequana_pipetools/sequana_manager.py b/sequana_pipetools/sequana_manager.py index 75190e5..84ba0d9 100644 --- a/sequana_pipetools/sequana_manager.py +++ b/sequana_pipetools/sequana_manager.py @@ -309,7 +309,7 @@ def teardown(self, check_schema=True, check_input_files=True): self.config.save(self.workdir / f".sequana/{config_name}") try: os.symlink(f".sequana/{config_name}", f"{self.workdir}/{config_name}") - except FileExistsError: # pragma: no cover + except (FileExistsError, PermissionError): # pragma: no cover pass # the final command