Skip to content

Type Python and UV library detection metadata - #16177

Merged
JamieMagee merged 1 commit into
mainfrom
jamiemagee/sorbet-python-library-metadata
Sep 5, 2026
Merged

Type Python and UV library detection metadata#16177
JamieMagee merged 1 commit into
mainfrom
jamiemagee/sorbet-python-library-metadata

Conversation

@JamieMagee

Copy link
Copy Markdown
Member

What are you trying to accomplish?

Use typed pyproject metadata for library detection in Python and UV. PyprojectDocument now exposes optional string name and description fields, and the Python checker reads PyPI's info.summary through a typed helper. This removes 12 T.untyped annotations across the two checkers.

Anything you want to highlight for special attention from reviewers?

Python still prefers Poetry, project, then build-system metadata. UV still ignores Poetry metadata. Empty tables remain distinct from missing tables, including when choosing the Poetry resolver. Missing descriptions, network fallbacks, and cached library decisions keep their existing behavior.

Wrongly typed consumed metadata now raises a contextual TypeError. This is intentional: malformed names, descriptions, and PyPI summaries were previously handled inconsistently. Unknown fields remain allowed, and unselected metadata is not validated. TOML syntax errors retain each caller's existing handling.

The types cover fields already used by library detection, not a complete pyproject schema. The build-system metadata fallback is existing Dependabot behavior. Resolver interfaces stay outside this change, so both checker files remain typed: strict.

This PR is independent of the UV version-config change. Both reduce the existing RuboCop offense count; preserve both reductions when merging.

How will you know you've accomplished your goal?

Repository-wide Sorbet and targeted RuboCop passed in containers. The relevant Python and UV document, parser, and checker suites passed all 394 examples, including new cases for malformed metadata, table precedence, empty-table resolver selection, and cached PyPI decisions. I did not run the complete repository suite.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

Copilot AI balanced review requested due to automatic review settings September 4, 2026 23:34
@JamieMagee
JamieMagee requested a review from a team as a code owner September 4, 2026 23:34

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.

Copilot review overview

馃煝 Approval recommended

The typed implementation preserves established behavior and is comprehensively covered by focused tests.

Review tier: Balanced
Findings: None

What changed in this PR

Adds typed pyproject metadata handling for Python and UV library detection while preserving existing precedence and fallback behavior.

Changes:

  • Introduces typed project metadata accessors.
  • Uses typed PyPI summary parsing with contextual errors.
  • Expands precedence, malformed-data, caching, and resolver tests.
File Description
.rubocop_todo.yml Reduces the T.untyped offense count.
python/鈥媗ib/鈥媎ependabot/鈥媝ython/鈥媐ile_parser/鈥媝yproject_document.rb Adds typed metadata parsing.
python/鈥媗ib/鈥媎ependabot/鈥媝ython/鈥媢pdate_checker.rb Uses typed pyproject and PyPI metadata.
python/鈥媠pec/鈥媎ependabot/鈥媝ython/鈥媐ile_parser/鈥媝yproject_document_spec.rb Tests metadata parsing and validation.
python/鈥媠pec/鈥媎ependabot/鈥媝ython/鈥媢pdate_checker_spec.rb Tests library detection and resolver behavior.
uv/鈥媗ib/鈥媎ependabot/鈥媢v/鈥媢pdate_checker.rb Uses typed standard metadata while ignoring Poetry.
uv/鈥媠pec/鈥媎ependabot/鈥媢v/鈥媢pdate_checker_spec.rb Tests UV metadata precedence and validation.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@JamieMagee
JamieMagee merged commit f034128 into main Sep 5, 2026
99 checks passed
@JamieMagee
JamieMagee deleted the jamiemagee/sorbet-python-library-metadata branch September 5, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants