Skip to content

feat(python): allow default version to be overridden#4206

Merged
jskeet merged 2 commits intogoogleapis:mainfrom
jskeet:default-version
Feb 26, 2026
Merged

feat(python): allow default version to be overridden#4206
jskeet merged 2 commits intogoogleapis:mainfrom
jskeet:default-version

Conversation

@jskeet
Copy link
Copy Markdown
Contributor

@jskeet jskeet commented Feb 26, 2026

Adds PythonPackage.DefaultVersion which is populated during migration, if and only if it is not the same as the final part of the first API path, and then uses this override in repo metadata generation.

Additionally, the toAPIs code in the migration tool now sorts the APIs by path before returning the list. This means that migration can process the APIs in the same order they'll be saved at the end.

Fixes #3146

Adds PythonPackage.DefaultVersion which is populated during migration,
if and only if it is not the same as the final part of the first API
path, and then uses this override in repo metadata generation.

Additionally, the toAPIs code in the migration tool now sorts the APIs
by path before returning the list. This means that migration can
process the APIs in the same order they'll be saved at the end.

Fixes googleapis#3146
@jskeet jskeet requested a review from JoeWang1127 February 26, 2026 14:08
@jskeet jskeet requested a review from a team as a code owner February 26, 2026 14:08
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.69%. Comparing base (7656701) to head (ca67eb4).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4206      +/-   ##
==========================================
+ Coverage   81.67%   81.69%   +0.01%     
==========================================
  Files          87       87              
  Lines        6952     6959       +7     
==========================================
+ Hits         5678     5685       +7     
  Misses        903      903              
  Partials      371      371              

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements the ability to override the default version for Python packages by adding a DefaultVersion field. The changes are well-contained, and the implementation in both the generation logic and the migration tool is sound. The addition of API sorting in the migration tool is a good improvement for determinism. I've included a couple of minor suggestions to improve code style consistency and slightly optimize the logic.

Comment thread internal/config/language.go
Comment thread internal/librarian/python/generate.go
@jskeet
Copy link
Copy Markdown
Contributor Author

jskeet commented Feb 26, 2026

Note: although this is under discussion in #4205, I think it would be reasonable to merge this PR as a stepping-stone, then we can make the default selection more robust.

@jskeet jskeet enabled auto-merge (squash) February 26, 2026 16:12
@jskeet jskeet merged commit 79f599a into googleapis:main Feb 26, 2026
14 of 15 checks passed
@jskeet jskeet deleted the default-version branch February 26, 2026 18:17
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.

librarian: include default version in repo metadata

2 participants