Skip to content

completion: pass shtab the preamble for the selected shell - #11129

Merged
skshetry merged 1 commit into
treeverse:mainfrom
MrNK2107:fix/completion-preamble-type
Nov 6, 2026
Merged

skshetry merged 1 commit into
treeverse:mainfrom
MrNK2107:fix/completion-preamble-type

Conversation

@MrNK2107

Copy link
Copy Markdown
Contributor

The lint job has failed on main since shtab 1.13, which annotates complete(preamble=...) as str. The failure shows up on every open PR:

dvc/commands/completion.py:20:63: error: Argument "preamble" to "complete" has incompatible type "dict[str, str]"; expected "str"  [arg-type]

shtab still accepts a dict, and all it does with one is take preamble.get(shell, ""). This change does that before the call. Behaviour is unchanged: dvc completion -s bash and dvc completion -s zsh produce byte-identical output before and after, and tests/unit/command/test_completion.py passes.

  • ❗ I have followed the Contributing to DVC checklist.

  • 📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. (No docs change needed.)

shtab 1.13 annotates complete(preamble=...) as str, so passing the per-shell dict fails mypy on main. Pick the shell's preamble ourselves, which is what shtab does with a dict; the generated bash and zsh scripts are unchanged.
@github-project-automation github-project-automation Bot moved this to Backlog in DVC Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.97%. Comparing base (2431ec6) to head (597f6db).
⚠️ Report is 213 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11129      +/-   ##
==========================================
+ Coverage   90.68%   90.97%   +0.29%     
==========================================
  Files         504      505       +1     
  Lines       39795    41139    +1344     
  Branches     3141     3263     +122     
==========================================
+ Hits        36087    37428    +1341     
- Misses       3042     3072      +30     
+ Partials      666      639      -27     

☔ 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.

@skshetry
skshetry merged commit f9d9edf into treeverse:main Nov 6, 2026
47 of 48 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in DVC Nov 6, 2026
skshetry added a commit to adarshsm/dvc that referenced this pull request Nov 6, 2026
* origin/main:
  [pre-commit.ci] pre-commit autoupdate (treeverse#11066)
  build(deps-dev): bump mypy from 1.19.1 to 2.4.1 (treeverse#11131)
  build(deps): bump rtCamp/action-slack-notify from 2.4.0 to 2.4.1 (treeverse#11130)
  build(deps): bump github/codeql-action from 4.37.4 to 4.39.1 (treeverse#11125)
  add support for 3.15 (treeverse#11135)
  completion: pass shtab the preamble for the selected shell (treeverse#11129)
  build(deps): bump actions/setup-python from 6 to 7 (treeverse#11073)
  build(deps): bump github/codeql-action from 4 to 4.37.4 (treeverse#11077)
skshetry added a commit to adarshsm/dvc that referenced this pull request Nov 6, 2026
* origin/main:
  fix: fall back to full index when pull/checkout targets mix .dvc files and paths (treeverse#11076)
  [pre-commit.ci] pre-commit autoupdate (treeverse#11066)
  build(deps-dev): bump mypy from 1.19.1 to 2.4.1 (treeverse#11131)
  build(deps): bump rtCamp/action-slack-notify from 2.4.0 to 2.4.1 (treeverse#11130)
  build(deps): bump github/codeql-action from 4.37.4 to 4.39.1 (treeverse#11125)
  add support for 3.15 (treeverse#11135)
  completion: pass shtab the preamble for the selected shell (treeverse#11129)
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