Hey there, does anyone have a strong opinion about...
# tools
j
Hey there, does anyone have a strong opinion about using decorators around functions in nf-core tools nf core? I am playing with the idea of using them to check if a specific version of Nextflow is installed before entering a function. Example:
Copy code
@require_nf_version(">=25", raise=True)
def do_something():
    # only works with Nextflow 25.02.1 
    ...
They could for example raise an Error otherwise. I understand that it could be against the nf-core tools philosophy, if we suggest updating anyway with every new Nextflow nextflow release.
m
we have a minimum required nextflow version in the template, so that should be the base truth
j
Ok thanks 🙂 But is that also enforced anywhere in the the code?
m
yes, we don't use any new features (e.g. ci tests would break (because we use there also the lowest possible version)
j
Would it be acceptable to still check for the version and maybe have a fallback routine if the version is not satisfied? This might also make a later migration easier.
m
To not beat around the bush:
nextflow inspect
does not help with Download unless it is a minimum version of 25.02.1-edge. Even 25.02.0-edge does not work yet.
😅 1
a
I don't like it. Calling out to nextflow for a version is a non-negligible overhead. I'm usually all for reducing footguns for users but I don't see why you can't just catch any error from inspect in earlier cases and just report a sensible error message.
m
So you would be fine with having a feature merged that is not yet guaranteed to work and throwing an error if the user is on an too old Nextflow version so it breaks?
a
Yes I think so personally, but happy to be contradicted by others. It should be documented in the help prominently too. Here we are leveraging a feature of
nextflow
which doesn’t correlate with the actual ability of older versions to run the pipeline. Ideally we would find a workaround for those who don’t want/can’t install a newer (and unstable!) version but again I am sympathetic to hackathon velocity and general ease of implementation for this feature.
💯 1
It’s entirely possible (although not necessarily likely) that given this is a feature of an unstable dev version that it could actually change again in future and then having a hardcoded lower bound results in a seemingly allowed version throwing an uncaught error. That’s one reason I prefer the try and run - catch any error and report to user option better