Skip to content

fix(show): preserve versions for long source URLs - #11065

Open
harbinresearcher wants to merge 1 commit into
python-poetry:mainfrom
harbinresearcher:codex/fix-show-long-source-versions
Open

harbinresearcher wants to merge 1 commit into
python-poetry:mainfrom
harbinresearcher:codex/fix-show-long-source-versions

Conversation

@harbinresearcher

Copy link
Copy Markdown

Pull Request Check List

Resolves: #2880

  • Added tests for changed code.
  • Updated documentation for changed code. (Not needed; no option or documented workflow changes.)

Description

poetry show calculates one version-column width from every displayed package. A direct URL or other source-qualified dependency can make that width larger than the terminal, causing Poetry to omit the version column for every package.

This change keeps the existing full version display as the first choice. If it does not fit, the formatter retries with aligned pretty_version values for the current and latest version columns before falling back to name-only output. --no-truncate still shows the complete source-qualified version, and JSON output is unchanged.

Testing

  • .\.venv\Scripts\python.exe -m pytest tests\console\commands\test_show.py -q -n 0 — 86 passed
  • .\.venv\Scripts\python.exe -m ruff check --no-fix src\poetry\console\commands\show.py tests\console\commands\test_show.py
  • .\.venv\Scripts\python.exe -m ruff format --check src\poetry\console\commands\show.py tests\console\commands\test_show.py
  • .\.venv\Scripts\python.exe -m mypy src\poetry\console\commands\show.py tests\console\commands\test_show.py
  • .\.venv\Scripts\python.exe -m pre_commit run --files src\poetry\console\commands\show.py tests\console\commands\test_show.py

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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.

poetry show -o / poetry show -l output loses expected functionality if line overruns the terminal width

1 participant