+
Skip to content

Make nf-core branding optional to help users create non-nf-core pipelines that can still leverage nf-core standards. #1551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Jul 11, 2022

Conversation

robsyme
Copy link
Contributor

@robsyme robsyme commented May 6, 2022

This is an incomplete PR - just to bring the discussion in #1548 into focus around real code changes.

I expect that there will be more rounds of commits steered by community discussion.

At the moment, changes include:

  • Add optional --prefix parameter for nf-core create where the prefix replaces nf-core in templates.
  • Add a new self.branded instance variable to the PipelineCreate class to be used as a handy boolean switch in jinja templates. branded == True => nf-core branding, branded == False => don't assume nf-core branding.
  • Only include ascii-art logo when branded
  • Only include nf-core slack channel references when branded
  • Only include results links (example) when branded
  • Use new prefix name for primary workflow names in main.nf e.g. workflow NFCORE_RNASEQ to workflow CUSTOMPREFIX_RNASEQ

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

@robsyme robsyme changed the title Nonamer Make nf-core branding optional May 6, 2022
@robsyme robsyme changed the title Make nf-core branding optional Make nf-core branding optional to help users create non-nf-core pipelines that can still leverage nf-core standards. May 6, 2022
@ewels ewels marked this pull request as draft May 6, 2022 20:53
@ewels ewels added the WIP Work in progress label May 6, 2022
≈# Please enter the commit message for your changes. Lines starting
@codecov

This comment was marked as outdated.

@apeltzer
Copy link
Member

apeltzer commented Jun 1, 2022

Just to add some more comments - this is already a really great start. What would be great to have here is to be able to select certain bits of the template and leave others out, e.g. the CI part is tied to Github Actions whereas people might have to run CI for their "nf-core harmonized" pipelines internally on their own CI. So would be great to pass some parameters that configure this sort of behaviour. I'm thinking of a YAML file maybe that configures this or something similar:

- prefix: my_company
   - skip_ci: yes
   - skip_github_badges: yes
   - skip_ignomes: yes
   - ...

@ewels
Copy link
Member

ewels commented Jun 1, 2022

Agreed, a more fine-grained logic / config for this would be nice. Could maybe have an argument to pass a YAML config file like this and go with interactive prompts otherwise. The config could also include other fields that we already have:

name: mypipeline
author: me
prefix: my_company
skip:
    - ci
    - github_badges
    - ignomes

Then the prompts could start with a simple y/n and then go more fine grained after that.. eg:

? Do you want to customise which parts of the template are used? [y/N] y

? Pipeline prefix: nf-core

? Skip GitHub CI workflows? [y/N] n

@ewels
Copy link
Member

ewels commented Jun 1, 2022

Note that this is a general idea, doesn't have to be a requirement for this specific PR necessarily. Could be taken in a subsequent PR.

@ErikDanielsson
Copy link
Contributor

ErikDanielsson commented Jun 29, 2022

I've added the functionality suggested in the comments here. So you can now either configure the pipeline creation with a yaml file by passing the filename to the --template-yaml flag, or by using interactive prompts. For example, passing

name: cool-pipe
author: me
prefix: cool-pipes-company
skip: 
    - ci
    - github_badges
    - igenomes
    - nf_core_configs

will create a pipeline called cool-pipe in the directory cool-pipes-company-cool-pipe with me as the author, and not copy the .github/workflow directory from the template, remove the igenomes.config, not include the github badges in the README.md and exclude nf_core/configs.

To allow the commands to run without prompts, I've also added a --plain flag which runs the command with the nf-core template silently.

This is just a first implementation, so it would be great with some feedback on how we want to customise the template further. In particular, I'm uncertain if we need to remove anything in the nextflow.config and nextflow_schema.json when skipping iGenomes, so it would be great with some input on that.

@ErikDanielsson ErikDanielsson removed the WIP Work in progress label Jul 7, 2022
@ErikDanielsson
Copy link
Contributor

ErikDanielsson commented Jul 7, 2022

All features should be implemented now, and all tests are passing, so this PR should be ready to merge soon! It would be great though if people could try it out, to see if I've missed any nf-core branding or if anything seems to be broken

@ErikDanielsson
Copy link
Contributor

ErikDanielsson commented Jul 7, 2022

Forgot to mention this earlier, I've added an extra option for excluding nf-core/configs - I'll add it to the example in the comment above.

@lbeltrame
Copy link

Nice! I'll give it another try tomorrow when I'm in the office.

@matthdsm
Copy link
Contributor

matthdsm commented Jul 8, 2022

Hi!
Awesome feature, really removes a lot of friction wrt adopting nf-core standard.
I tried the template generation and I've got some remarks:

  • file references in .nf-core.yml still use the nf-core prefix
  • I think the awstest and awsfulltest.yml gh workflow should be removed, as that's only applicable to real nf-core workflow and relies on tower
  • I'm not sure nf-core lint will ever work, since it checks for the nf-core prefix.

Also, It'd be cool if the png generation could be edited to include the new prefix, but I think that's something to take up with the website team

@lbeltrame
Copy link

I'm not sure nf-core lint will ever work, since it checks for the nf-core prefix.

I believe this is also stated in the current docs (predating this feature). I've never used linting in the pipelines I modified for this reason.

On this topic, I'd argue that if it is fixable, it might be better to have that in a separate PR (this one is quite large already)?

@matthdsm
Copy link
Contributor

matthdsm commented Jul 8, 2022

Of course, I totally agree! But I would argue to also remove that part from the CI tests then. I think the goal here is to provide a minimal amount of friction to boost the standard adoption.
Since the CI tests are big plus for the template, I'd like to have an option of "just works" minimal CI.

All of this can be handled in subsequent PR's of course. For now, we can just skip the CI during template generation.

@ewels
Copy link
Member

ewels commented Jul 8, 2022

I think that we should be careful not to confuse two separate issues here: identity of the pipeline and usage of nf-core/tools. I don't think that there's any need to rename .nf-core.yml because that's for tools - we also have a .prettier.yml file in the root too, for example.

Specific linting tests can disabled by this config so what I discussed with @ErikDanielsson was for these template flags to disable the relevant specific tests. Then the remainder of the linting should still run (and pass). No need to edit the linting code itself I think (or very much, anyway).

I think logo generation is out of scope - if it's not an nf-core pipeline there should be no branding, even with a different prefix. So just no image at all.

Agree on removing the awstest action workflows 👍🏻

Phil

@matthdsm
Copy link
Contributor

matthdsm commented Jul 8, 2022

I think that we should be careful not to confuse two separate issues here: identity of the pipeline and usage of nf-core/tools. I don't think that there's any need to rename .nf-core.yml because that's for tools - we also have a .prettier.yml file in the root too, for example.

What I meant is that .nf-core.yml contains nf-core naming.
e.g.

lint:
  files_exist:
    - CODE_OF_CONDUCT.md
    - assets/nf-core-preprocessing_logo_light.png
    - docs/images/nf-core-preprocessing_logo_light.png
    - docs/images/nf-core-preprocessing_logo_dark.png

@ErikDanielsson
Copy link
Contributor

Those fields are added to make linting pass -- the linting tests are named with an nf-core prefix. We could update the linting test to use the custom prefix as well, but since it does not make sense for nf-core create to create them for a non-nf-core pipeline I saw no reason to.

@ErikDanielsson
Copy link
Contributor

ErikDanielsson commented Jul 8, 2022

The AWS tests are now removed by default when run with a custom prefix. Linting should pass now also, no matter which sections of the template are skipped.

@matthdsm
Copy link
Contributor

matthdsm commented Jul 8, 2022

Awesome, thanks for the great work!

@ewels
Copy link
Member

ewels commented Jul 8, 2022

What I meant is that .nf-core.yml contains nf-core naming.

I'm a bit confused - yes that's intentional. Those lines in the YAML config are there to disable the lint tests that check for their presence.

@matthdsm
Copy link
Contributor

matthdsm commented Jul 8, 2022

Ah, it seems I misunderstood that part!

Copy link
Member

@ewels ewels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started a review this morning but never finished. Dumping my comments now before they get lost forever.

I'll try to get back to have a play with this and review, but may not have time now. Feel free to merge if it feels ready and @mirpedrol is happy 👍🏻

ErikDanielsson and others added 3 commits July 9, 2022 17:23
Co-authored-by: Phil Ewels <phil@seqera.io>
Co-authored-by: Phil Ewels <phil@seqera.io>
Co-authored-by: Phil Ewels <phil@seqera.io>
Copy link
Member

@mirpedrol mirpedrol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
I just made a small comment and the CHANGELOG should also be updated :)

force=False,
outdir=None,
template_yaml_path=None,
plain=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something, but don't we want to make plain True by default?
I see this will change the meaning of the flag, and if you answer "No" to the prompt about customization a default template is generated, so I am also fine with leave it as it is, but just thinking that the most common usage of the command nf-core create will be to generate nf-core pipelines.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've got a point, but on the other hand, prompting by default showcases the functionality better. I think that since the default option is to not customize the template, it is easy enough to create a nf-core pipeline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really matter, but semantically I would usually use None for "no default" and prompt only if set to that.

Only really matters if people use the function in custom Python scripts.


# The schema is not guaranteed to follow Prettier standards
# so we run prettier on the schema file
subprocess.run(["prettier", "--write", schema_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails with FileNotFoundError: [Errno 2] No such file or directory: 'prettier' when prettier is not installed, so we could add a better error message as discussed with @ErikDanielsson

@ErikDanielsson ErikDanielsson merged commit 0cc0a0a into nf-core:dev Jul 11, 2022
@robsyme robsyme deleted the nonamer branch July 11, 2022 12:43
@mirpedrol mirpedrol mentioned this pull request Oct 17, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载