[PR #77] [MERGED] Increase performance of typer autocompletion by breaking out subcommand functions into their own module #86

Closed
opened 2026-03-02 16:48:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/initialcommit-com/git-sim/pull/77
Author: @MathiasSven
Created: 3/24/2023
Status: Merged
Merged: 3/25/2023
Merged by: @initialcommit-io

Base: devHead: main


📝 Commits (2)

  • 2cbb1ca Separate commands from manim modules
  • cb4eec8 delay importing git package

📊 Changes

22 files changed (+393 additions, -364 deletions)

View changed files

📝 git_sim/__main__.py (+24 -41)
📝 git_sim/add.py (+0 -13)
📝 git_sim/branch.py (+0 -12)
📝 git_sim/checkout.py (+6 -19)
📝 git_sim/cherrypick.py (+0 -18)
📝 git_sim/clone.py (+9 -18)
git_sim/commands.py (+315 -0)
📝 git_sim/commit.py (+0 -19)
git_sim/enums.py (+14 -0)
📝 git_sim/fetch.py (+1 -15)
📝 git_sim/log.py (+0 -18)
📝 git_sim/merge.py (+0 -17)
📝 git_sim/pull.py (+6 -18)
📝 git_sim/push.py (+10 -19)
📝 git_sim/rebase.py (+0 -12)
📝 git_sim/reset.py (+1 -36)
📝 git_sim/restore.py (+0 -13)
📝 git_sim/revert.py (+0 -13)
📝 git_sim/stash.py (+1 -23)
📝 git_sim/status.py (+0 -9)

...and 2 more files

📄 Description

Fixes #76

The main problem seemed to be loading manim. By separating the commands from the modules where manim needs to be loaded, it is possible to delay loading it until a command is actually executed, since the auto-completion only relied on those command functions being registered by typer.

While the auto-completion is still a bit slow, it is a significant improvement (3x), and as a bonus because manim isn't loaded the Manim Community v0.16.0.post0 log doesn't clutter the output of git-sim --show-completion SHELL.

Previous:

https://user-images.githubusercontent.com/24759037/227437226-8cc733ff-6c98-423c-ba9b-7d49e3074011.mp4

With PR:

https://user-images.githubusercontent.com/24759037/227437053-cd4edcb7-62cb-4fcd-980a-30a6b129dc50.mp4


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/initialcommit-com/git-sim/pull/77 **Author:** [@MathiasSven](https://github.com/MathiasSven) **Created:** 3/24/2023 **Status:** ✅ Merged **Merged:** 3/25/2023 **Merged by:** [@initialcommit-io](https://github.com/initialcommit-io) **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (2) - [`2cbb1ca`](https://github.com/initialcommit-com/git-sim/commit/2cbb1ca1b97c2062aaa0669fec5e232ab30e9c5f) Separate commands from manim modules - [`cb4eec8`](https://github.com/initialcommit-com/git-sim/commit/cb4eec8e144d38071db1fbad3cef7cec60aee604) delay importing git package ### 📊 Changes **22 files changed** (+393 additions, -364 deletions) <details> <summary>View changed files</summary> 📝 `git_sim/__main__.py` (+24 -41) 📝 `git_sim/add.py` (+0 -13) 📝 `git_sim/branch.py` (+0 -12) 📝 `git_sim/checkout.py` (+6 -19) 📝 `git_sim/cherrypick.py` (+0 -18) 📝 `git_sim/clone.py` (+9 -18) ➕ `git_sim/commands.py` (+315 -0) 📝 `git_sim/commit.py` (+0 -19) ➕ `git_sim/enums.py` (+14 -0) 📝 `git_sim/fetch.py` (+1 -15) 📝 `git_sim/log.py` (+0 -18) 📝 `git_sim/merge.py` (+0 -17) 📝 `git_sim/pull.py` (+6 -18) 📝 `git_sim/push.py` (+10 -19) 📝 `git_sim/rebase.py` (+0 -12) 📝 `git_sim/reset.py` (+1 -36) 📝 `git_sim/restore.py` (+0 -13) 📝 `git_sim/revert.py` (+0 -13) 📝 `git_sim/stash.py` (+1 -23) 📝 `git_sim/status.py` (+0 -9) _...and 2 more files_ </details> ### 📄 Description Fixes #76 The main problem seemed to be loading `manim`. By separating the commands from the modules where `manim` needs to be loaded, it is possible to delay loading it until a command is actually executed, since the auto-completion only relied on those command functions being registered by `typer`. While the auto-completion is still a bit slow, it is a significant improvement (3x), and as a bonus because `manim` isn't loaded the `Manim Community v0.16.0.post0` log doesn't clutter the output of `git-sim --show-completion SHELL`. ### Previous: https://user-images.githubusercontent.com/24759037/227437226-8cc733ff-6c98-423c-ba9b-7d49e3074011.mp4 ### With PR: https://user-images.githubusercontent.com/24759037/227437053-cd4edcb7-62cb-4fcd-980a-30a6b129dc50.mp4 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 16:48:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-sim#86
No description provided.