Skip to content

Separate CLI from runtime #5971

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Separate CLI from runtime #5971

wants to merge 1 commit into from

Conversation

bentsherman
Copy link
Member

@bentsherman bentsherman commented Apr 14, 2025

This PR splits the nextflow module into two modules:

  • nf-cli-v1: contains only the Launcher and CLI classes
  • nextflow: contains everything (i.e. the "runtime")

Benefits:

  • Improves build time, editing CLI code doesn't rebuild the entire project
  • Removes some circular dependencies, making the code easier to read/understand
  • Library consumers like platform or plugins can just depend on the runtime and not the CLI
  • Makes it easier to implement a CLI v2 in the future

I separated the CLI bits in ConfigBuilder into a separate class ConfigCmdAdapter in order to keep the core config builder in the runtime. This also provides a nice separation of concerns.

This comment was marked as off-topic.

@bentsherman
Copy link
Member Author

Due to the nature of this PR, I will keep it updated via rebase instead of merge commits so that the changes are as clear as possible.

@pditommaso
Copy link
Member

oh mamma mia 😆

@bentsherman
Copy link
Member Author

Your k8s plugin inspired me 😄

@pditommaso
Copy link
Member

I feared that 😆

@bentsherman
Copy link
Member Author

Jokes aside, it might be good to do the actual code changes in a separate PR so that the nf-runtime part is as clean as possible

The nf-runtime refactor was just the easiest way to reveal the circular dependencies

@pditommaso
Copy link
Member

I'll review post 25.04

@bentsherman
Copy link
Member Author

Refactored so that the CLI code is in a new module nf-cli-v1. Made the PR considerably smaller

Note the following plugins depend explicitly on the CLI code because they add CLI commands:

  • nf-console
  • nf-k8s
  • nf-tower
  • nf-wave

Might be possible to remove this dependency by moving some interfaces into the core runtime, but not a big deal either way

@bentsherman bentsherman force-pushed the nf-runtime branch 2 times, most recently from ac8c183 to bf822ef Compare April 19, 2025 00:33
@pditommaso pditommaso force-pushed the master branch 3 times, most recently from b4b321e to 069653d Compare June 4, 2025 18:54
@bentsherman bentsherman force-pushed the nf-runtime branch 3 times, most recently from 83f7d30 to 5cc1731 Compare June 18, 2025 21:24
Signed-off-by: Ben Sherman <[email protected]>
@bentsherman bentsherman removed the request for review from tom-seqera June 18, 2025 21:29
@bentsherman
Copy link
Member Author

I refactored the nf-lineage module to depend on nextflow and be required by nf-cli-v1. This removes the need for the LinCommand interface as the lineage command can simply use LinCommandImpl directly.

Couldn't quite do this for nf-k8s because the K8sDriverLauncher uses CmdRun, so that's a pretty hard dependency on the CLI v1. We could make nf-k8s a module instead of a plugin, but then it would be included at build-time instead of runtime.

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.

2 participants