tools icon indicating copy to clipboard operation
tools copied to clipboard

Textual create

Open ewels opened this issue 2 years ago • 6 comments

First stab at using Textual to create a TUI (text user interface) for creating nf-core pipelines. The idea is that this could replace the Questionary interactive prompts, for a nicer user experience with more space for in-depth documentation.

Command line flags would remain in place, but if some but not all are used then an error would be thrown. The idea being that non-interactive usage is still possible via the CLI, but that all interactive usage should be via the TUI.

Not much done yet. I got as far as the third screen. Main aim was to prototype how this could look and feel, plus playing with using Pydantic to hold the config generated by the wizard and apply input validations in a scalable manner.

To try this out:

pip install -e .  # Updated requirements.txt file in PR
nf-core pipelines create

To run in dev mode (CSS changes hot-reload):

pip install -r requirements-dev.txt   # one time
textual run --dev -c  nf-core pipelines create

Whilst in the app, d switches dark mode on and off and q quits. Ctrl+c also quits.

Shout if any of the code doesn't make sense! Feedback welcome 🙏🏻

Demo:

https://github.com/nf-core/tools/assets/465550/b0326f0a-b3c9-4446-a4b8-db37e4580e7c

ewels avatar Aug 20 '23 22:08 ewels

Proposed as an alternative to the UI improvements started in https://github.com/nf-core/tools/pull/2398

ewels avatar Aug 20 '23 22:08 ewels

From @ewels during Slack discussion:

  • [x] Pre-populate author name from git config --global user.name if possible
  • [x] Add options at the end to "finish" the git config
    • Ask if a remote repo already exists
    • Offer to create one on github.com via the API, with appropriate fields
    • If we have either of the two above, configure the remote origin
    • If we can configure the remote, do the git push --all
  • [ ] Include more boilerplate docs about developing with the community, #new-pipelines etc
  • [x] Form fields for other CLI flags, such as target output directly. Pre-populate with defaults.

mirpedrol avatar Aug 31 '23 09:08 mirpedrol

Suggestions:

  • Move "do you want to create a github repo" to a separate page, before entering details
  • Logging should show before we start creating a pipeline, otherwise it looks like it hangs when you press "create"

ewels avatar Nov 23 '23 09:11 ewels

Suggestion: I wonder if many people will create an empty GitHub repo before running nf-core pipelines create (this is probably what I would do). Then we have to rely on people reading the help text printed by the command, which is difficult.

We could add functionality to fetch a list of the user's GH repos (maybe filtering for repos that have zero commits?) and then offer to push to one of them via a dropdown.. Might not be that difficult to do, and could help streamline that final step a little more.

ewels avatar Mar 04 '24 09:03 ewels

We could add functionality to fetch a list of the user's GH repos (maybe filtering for repos that have zero commits?) and then offer to push to one of them via a dropdown.. Might not be that difficult to do, and could help streamline that final step a little more.

We are already taking this into account. If a repository exists without commits, we use it. If it has commits, we throw an error. I think the dropdown is not needed, as the repository must have the proper pipeline name.

mirpedrol avatar Mar 07 '24 12:03 mirpedrol

ok @mirpedrol - I had a go through and made some design tweaks and changes to text here and there. Nothing major though, and generally everything worked beautifully and I love it 🎉

The final thing I tried to test was actually creating a GitHub repo. This sadly didn't quite work for me. As soon as I clicked create it took me to the screen showing the log from pipeline creation. I could see some stuff briefly flashing up "behind" it (something about a GitHub username) but then nothing. It looks like the repo was created but no files pushed. I'm not sure what went wrong as I can't see any logs or messages anywhere.

It's getting late so I don't have time to look into that one sorry. But once that's cleared up, I think we're good to go 🚀

ewels avatar Apr 02 '24 22:04 ewels

@nf-core-bot fix linting

mashehu avatar Apr 03 '24 08:04 mashehu

Summary of review items so that they don't get lost. See Slack for details + screencaps etc.

Bugs

  • [x] Selecting "nf-core" as the pipeline type, then going back and changing your mind doesn't work
  • [x] New repos are always created at the user's namespace, even if a different org was specified at the start
  • [ ] When creating a custom pipeline, pipeline name should allow more characters
  • [x] Hitting some issues pushing code to new repos still where it seems to be prompting me for username + password interactively, behind the Textual app

Feature requests

  • [x] Can check if the pipeline outdir exists before continuing past "Force" option page.
  • [ ] Should show the org + repo name that will be created. Better still as inputs that can be edited.
  • [ ] Add a button after creating a repo to open that new repo in the web browser
  • [x] Can remove toggle for "Push files" as I think the user will always want this

ewels avatar Apr 08 '24 22:04 ewels

I created issues to track what is missing from the TUI https://github.com/nf-core/tools/issues/2963 https://github.com/nf-core/tools/issues/2964 https://github.com/nf-core/tools/issues/2965

If there aren't major concerns, I would merge this PR and continue the development in smaller PRs.

mirpedrol avatar May 10 '24 11:05 mirpedrol