Skip to content

refactor: Switching to Typer from Click - #427

Merged
srivarra merged 8 commits into
mainfrom
cli/typer
Sep 11, 2026
Merged

refactor: Switching to Typer from Click#427
srivarra merged 8 commits into
mainfrom
cli/typer

Conversation

@srivarra

@srivarra srivarra commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Typer version 0.26 vendors Click instead of depending on it, so OptionEatAll needed some adjustments.

  • Might be useful to expose the OptionEatAll for downstream libraries (i.e. biahub) too...

Signed-off-by: Sricharan Reddy Varra <sricharan.varra@biohub.org>
@srivarra srivarra linked an issue Jun 22, 2026 that may be closed by this pull request
…instead of an enum

Signed-off-by: Sricharan Reddy Varra <sricharan.varra@biohub.org>
@srivarra
srivarra marked this pull request as ready for review June 22, 2026 17:29
@srivarra
srivarra requested a review from ieivanov June 22, 2026 17:30
@ieivanov

Copy link
Copy Markdown
Contributor

Looks very nice, thanks.

Screenshot 2026-06-25 at 2 48 41 PM

I agree it would be nice to expose OptionEatAll for other libraries so we don't maintain this code in multiple places.

The CLI interaction seems noticeably slower however. Did you have the same experience? I'd expect it to be a bit slower given the rich formatting, but this may be borderline. Is there something we can do about it?

@srivarra

srivarra commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

@ieivanov

The CLI interaction seems noticeably slower however. Did you have the same experience?

Yeah it's a known issue with building cli's with Typer/Python, there's a handful of discussions about this topic. Importing rich + others seems to cause the slowdown, not rich doing the formatting. Lemme take a look and try some stuff and get back to you.

Signed-off-by: Sricharan Reddy Varra <sricharan.varra@biohub.org>
@srivarra

srivarra commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

@ieivanov

The main slowdown is when invoking the CLI, we import every package, and I think typer+rich made it slower enough to notice.

I tried out lazy_loader and made it snappier.

command Click (main) Typer Typer + lazy_loader
python -c pass (floor) 18 ms 20 ms 18 ms
iohub --version 536 ms 598 ms 168 ms
iohub -h 551 ms 629 ms 210 ms

@ieivanov ieivanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks nice. It's worth getting review from someone else too before you merge

@srivarra
srivarra requested a review from talonchandler June 26, 2026 00:18
srivarra and others added 3 commits June 25, 2026 17:22
Document the exported greedy `-i` building blocks (OptionEatAll,
install_eat_all_positions, InputPositionDirpaths,
expand_position_dirpaths) and link the page into the nav.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ieivanov

Copy link
Copy Markdown
Contributor

I'd say let's merge this PR now, it's important we don't let PRs go state. We can fix any issues that we haven't caught here later.

Signed-off-by: Sricharan Reddy Varra <sricharan.varra@biohub.org>
…vements

Signed-off-by: Sricharan Reddy Varra <sricharan.varra@biohub.org>
@srivarra
srivarra merged commit f836a58 into main Sep 11, 2026
13 checks passed
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.

Switch to Typer for CLI

2 participants