Regarding the linting for the strict syntax when u...
# pipeline-maintainers
e
Regarding the linting for the strict syntax when using
templates
, how is that supposed to work? In e.g. https://github.com/nf-core/scdownstream/blob/dev/modules/local/scvitools/scvi/main.nf there are a bunch of variables that are declared and not used in
<http://main.nf|main.nf>
but are used in
scvi.py
through
template(scvi.py)
. Linting shows warnings that the variables are declared but not used. I thought about adding a no-op (e.g.
: "${variable}"
), but then there'd have to be a
script
block (which there isn't, since it's using templates), plus it feels ugly.
m
How about migrating to module binaries instead of templates? That way you can call your python script in a
script
tag
p
Do we have an nf-core policy on that? I think we have recommended templates in the past to avoid dependencies on Wave and stuff, though I forget the specifics now.
πŸ’― 1
Maybe now we're starting to build everything with wave it's not a problem though πŸ€” #C09V4RAHV0X
That would be super nice to drop the templates stuff..
j
Yep, module binaries have a run time Wave dependency I think we should avoid for community modules.
I feel like this is a bug, templates are still a thing. Feel like submitting it as such to the nextflow repo @Erik Fasterius?
p
Yep, module binaries have a run time Wave dependency I think we should avoid for community modules.
But if we're starting to use Wave / Seqera Containers to generate containers for nf-core modules, then it could be baked in - no Wave dependency at run time? πŸ€”
Not sure it'd work actually.. so maybe ignore me.
j
I think Nextflow would still try to use Wave to bake the scripts in, even if we hacked around to pre-bake them
πŸ‘πŸ» 1
this 1
e
Should I try to convert to use module binaries instead of the template then? I don't feel super-clear road given the discussion here
j
No, I think it will need to stay as a template
there are a few other fixes ongoing for the v2 parser, hopefully this won't be a problem in a future release
e
Okay, then I'll just wait for a future solution
πŸ‘ 1
b
I think Nextflow would still try to use Wave to bake the scripts in, even if we hacked around to pre-bake them
If there's a limitation that you see with the Wave + module binary approach, you should bring it up in a Nextflow issue so that we can work towards a solution. I think it would be a viable alternative to the module template approach but it's hard to say for sure until someone tries in earnest
p
I'm not really sure how this would work though πŸ€” We do the Wave build in CI using the Wave CLI, so it's separate to Nextflow. We'd have to somehow tell that process that a specific folder should be injected. Also I'm not sure that we allow / want to allow this for the public registry.
j
Bottom line is that folks expect this to work exactly like the workflow bin, which it doesn't, and I'm a bit worried that some nf-core CI workaround would generate some confusion.
this 3
b
You would use
nextflow inspect
to build the containers exactly as Wave would build them at runtime. I thought Edmund did a POC for this a while ago... The containers would be tied to specific modules though, not just an arbitrary set of conda packages
p
Yup, and then we'd need to host those built containers somewhere (not Seqera Containers), like quay.io or something
m
We're really starting to see the limit of templates now that we're migrating to topics for the versions
😒 1
A good solution for this solve that doesn't require any dependency would go a very very long way
j
Completely agreed that module binaries should be able to work for containers without a dependency on Wave! I do understand there would be limitations around e.g. file name clashes, but I don't really understand why module binaries can't operate using the same mechanism as the current staging of binaries in
bin/
, even if it just means dumping all module binaries into a single directory at runtime and staging it
p
This has been discussed many times. TLDR:
The same mechanism as the current staging of binaries in
bin/
This mechanism is a bit of a hack and Paolo hates it, and would love to remove it from Nextflow if he could. He refuses to make it worse / duplicate it for modules.
j
I remember. But from a user point of view it's so nice. I put a script somewhere and it magically appears in the container.
πŸ™Œ 1
p
I know that. You know that. We all know that.
Just need to find a way to achieve it that isn't a nasty hack
Paolo doesn't see why people wouldn't want to use Wave, so for him the distinction is easy.
😒 1
m
Any hack that works is a good enough hack for me
p
maxime pigeon
🀣 1
m
But that's why I am not in charge of Nextflow 🀣
j
This mechanism is a bit of a hack and Paolo hates it, and would love to remove it from Nextflow if he could.
I would accept this if it happened. At least it would force us to take a more declarative approach, rather than dangling a tantalisingly almost-useful feature at us
DALLΒ·E-2024-06-27-07.03.52-A-photo-of-Tantalus-standing-waist-deep-in-water-with-a-fruit-tree-above-him-but-the-fruit-always-out-of-reach.-He-looks-frustrated-and-desperate-as-2 copy.jpg
πŸ˜† 2
j
Just had claude evaluate things, best it came up with is adding scripts as task inputs. 😱
j
You can do that with the GAWK module...
j
We could probably have nextflow do it implicitly, I might mock it up just for fun
b
Interesting idea. With typed processes, it might not even need to be an input. I think you could just use the
stageAs
directive to stage it in:
Copy code
nextflow.preview.types = true

process HELLO {
  input:
  // ...

  stage:
  stageAs file("${moduleDir}/bin/script.py"), '*'

  script:
  """
  script.py ...
  """
}
πŸ‘€ 1
🀩 3
j
Oh, now that I like
Presume it would have to be
./script.py
in the module script, though? This seems like a good general-purpose way to bundle small files with modules more generally, also - rather than dumping them into a generic
assets/
directory, keep them contextually located with their modules
j
Ben, are you telling us we've had a fully portable module bin mechanism all along as soon as types happened?
party this 2
m
so that's another reason to go for typed processes
e
Following along as this discussion unfolds is fun πŸ˜‰
j
@Ben Sherman this is the more involved solution Claude and I were working on: https://github.com/nextflow-io/nextflow/pull/6928. It even harmonises workflow bin and module bin in the hope of appeasing 'he who sees all' πŸ™‚
eyeofsauron 2
s
I've used the "include the script as an input" method in the past, for example during development before I can be bothered to make a container containing the script, or for RMarkdown reports where I wanted to be able to change it at some later point if I wanted to.
j
I do actually think it makes sense to use the same machinery, whether implicitly or explicitly