Skip to content

Fix shell auto-completion - #2091

Merged
JeanChristopheMorinPerso merged 4 commits into
AcademySoftwareFoundation:mainfrom
JeanChristopheMorinPerso:fix_autocomplete
May 10, 2026
Merged

JeanChristopheMorinPerso merged 4 commits into
AcademySoftwareFoundation:mainfrom
JeanChristopheMorinPerso:fix_autocomplete

Conversation

@JeanChristopheMorinPerso

@JeanChristopheMorinPerso JeanChristopheMorinPerso commented May 3, 2026 •

Copy link
Copy Markdown
Member

Auto completion in shells was broken by the last update of argcomplete we did in 2025. This PR fixes that and also adds a test to make sure we don't regress on this anymore in the future.

Autocomplete was also broken on Python 3.12, which requires a newer argcomplete version. So I also updated argcomplete.

Note that the tests have been AI generated. You can see my LLM session at https://ampcode.com/threads/T-019debb1-9b44-75c1-b786-0ff399afec9e. I also create a follow-up session to get even more coverage: https://ampcode.com/threads/T-019debfb-1e29-772e-8d45-6f613e7a25aa. Total cost is $15 US.

Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
@codecov

codecov Bot commented May 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.68%. Comparing base (39eeabe) to head (83077cb).
⚠️ Report is 58 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2091      +/-   ##
==========================================
+ Coverage   59.91%   60.68%   +0.76%     
==========================================
  Files         164      164              
  Lines       20557    20561       +4     
  Branches     3571     3570       -1     
==========================================
+ Hits        12317    12477     +160     
+ Misses       7370     7215     -155     
+ Partials      870      869       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JeanChristopheMorinPerso JeanChristopheMorinPerso changed the title Fix auto-complete that was broken when we last updated argcomplete Fix shell auto-completion May 3, 2026
@JeanChristopheMorinPerso
JeanChristopheMorinPerso marked this pull request as ready for review May 3, 2026 03:49
@JeanChristopheMorinPerso
JeanChristopheMorinPerso requested a review from a team as a code owner May 3, 2026 03:49
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>

Copilot AI 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.

Pull request overview

This PR updates Rez’s vendored argcomplete and related shell integration to restore working shell auto-completion (including Python 3.12), and adds regression tests to prevent future breakage.

Changes:

  • Bump vendored argcomplete to 3.6.3 and update multiple integration points (shell code generation, finders/lexing, argparse introspection, global completion loader).
  • Add vendored argcomplete helper scripts for registration and global activation.
  • Add CLI completion regression tests covering both argcomplete.autocomplete() and Rez’s _rez-complete entry point.

Reviewed changes

Copilot reviewed 2 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/rez/vendor/README.md Updates vendored argcomplete version metadata/date.
src/rez/vendor/argcomplete/shell_integration.py Updates generated bash/zsh/fish completion shellcode and script handling.
src/rez/vendor/argcomplete/scripts/register_python_argcomplete.py Adds vendored register-python-argcomplete helper script.
src/rez/vendor/argcomplete/scripts/python_argcomplete_check_easy_install_script.py Adds vendored easy_install wrapper check script.
src/rez/vendor/argcomplete/scripts/activate_global_python_argcomplete.py Adds vendored global activation helper.
src/rez/vendor/argcomplete/packages/_shlex.py Tracks last wordbreak position for quoting/ltrim logic.
src/rez/vendor/argcomplete/packages/_argparse.py Updates argparse introspection for newer Python tuple shapes/signatures.
src/rez/vendor/argcomplete/finders.py Refactors debug stream init, help expansion, quoting/escaping behavior.
src/rez/vendor/argcomplete/completers.py Adjusts completer base typing and bash compgen workaround.
src/rez/vendor/argcomplete/bash_completion.d/_python-argcomplete Updates global completion loader logic for zsh/bashed usage.
src/rez/vendor/argcomplete/_check_module.py Updates module resolution logic for python -m ... marker checks.
src/rez/vendor/argcomplete/_check_console_script.py Updates console_script entry point lookup for Python 3.12+.
src/rez/tests/test_cli.py Adds regression tests for subcommand/option completion behavior.
src/rez/cli/_complete_util.py Updates RezCompletionFinder COMP_POINT encoding translation and initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rez/cli/_complete_util.py

@maxnbk maxnbk 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.

I only glanced over the code, but a local test of gitbash sourcing the completion .sh allowed me to autocomplete to a package name I have available, which explodes in a stacktrace on main, so I'll mark approved.

@JeanChristopheMorinPerso
JeanChristopheMorinPerso merged commit d415b96 into AcademySoftwareFoundation:main May 10, 2026
67 checks passed
@JeanChristopheMorinPerso
JeanChristopheMorinPerso deleted the fix_autocomplete branch May 22, 2026 00:40
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.

3 participants