Skip to content

Use prompt_toolkit's clipboard for the \clip command#1660

Closed
rolandwalker wants to merge 1 commit intomainfrom
RW/use-prompt-toolkit-clipboard
Closed

Use prompt_toolkit's clipboard for the \clip command#1660
rolandwalker wants to merge 1 commit intomainfrom
RW/use-prompt-toolkit-clipboard

Conversation

@rolandwalker
Copy link
Contributor

Description

This currently has the same functionality as depending on pyperclip directly; however it simplifies things to depend only on prompt_toolkit, reducing the chance that there is ever a conflict over the pyperclip version declarations.

Incidentally remove a needless f-string.

Part of a series: trying to depend on prompt_toolkit more, handroll less, and depend on click less for output.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

This currently has the same functionality as depending on pyperclip
directly; however it simplifies things to depend only on prompt_toolkit,
reducing the chance that there is ever a conflict over the pyperclip
version declarations.

Incidentally remove a needless f-string.
@rolandwalker rolandwalker self-assigned this Feb 28, 2026
@github-actions
Copy link

  1. High: packaging/runtime regression risk (pyperclip may no longer be installed).
    pyproject.toml:10 removes the explicit pyperclip dependency, but iocommands.py:14 and iocommands.py:249 still rely on prompt_toolkit’s pyperclip-backed clipboard class. If prompt_toolkit doesn’t guarantee installing pyperclip transitively, \clip can fail (or import-time behavior can differ by environment).
    Action: either keep pyperclip as a direct dependency, or switch to a prompt_toolkit clipboard implementation that does not require the external pyperclip package.

  2. Medium: missing regression tests for this behavior change.
    No tests were added/updated for \clip path despite changing clipboard implementation and dependency behavior.
    Action: add tests in test/test_special_iocommands.py for:

  • successful copy path (mock clipboard backend),
  • backend failure path (assert user-facing error message),
  • behavior when clipboard backend dependency is unavailable.

Could not run tests locally because pytest is not installed in this environment.

@rolandwalker
Copy link
Contributor Author

Closing, because prompt_toolkit does not actually install pyperclip transitively. So there is no benefit.

@rolandwalker rolandwalker deleted the RW/use-prompt-toolkit-clipboard branch February 28, 2026 16:28
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.

1 participant