Fix Requires-Python fallback when GitHub API is unavailable - #64
Merged
jaraco merged 9 commits intoJun 13, 2026
Merged
Conversation
When GitHub's API is unavailable (429 rate-limit, connection error, etc.), `python_requires_supported()` now falls back to the `Requires-Python` from coherent.build's own installed package metadata instead of the stale hardcoded `"3.8"`. Also catches all exceptions (not just `KeyError`) so connection errors and JSON decode errors (e.g., non-JSON 429 responses) are handled gracefully. Closes #63
Copilot
AI
changed the title
[WIP] Fix Python inference fallback when service is unavailable
Fix Requires-Python fallback when GitHub API is unavailable
Jun 13, 2026
jaraco
reviewed
Jun 13, 2026
Per review feedback, the except KeyError is appropriate for catching unexpected GitHub API responses (e.g. a 429 returns a dict, so branches[0] raises KeyError). Narrow the exception back from except Exception to except KeyError and remove the unneeded connection-error test case. The fallback still uses _python_requires_from_self() instead of the stale hardcoded '3.8'.
jaraco
reviewed
Jun 13, 2026
jaraco
reviewed
Jun 13, 2026
Member
|
@copilot Let's remove the test_discovery module. It's overkill. |
Contributor
Author
Done, |
jaraco
reviewed
Jun 13, 2026
jaraco
marked this pull request as ready for review
June 13, 2026 23:27
jaraco
deleted the
copilot/fix-inference-fallback-when-service-unavailable
branch
June 13, 2026 23:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When GitHub's API returns a 429 (rate-limited),
python_requires_supported()was falling back to the hardcoded and stale"3.8". A 429 response from GitHub returns a dict, causingbranches[0]to raiseKeyError— which was already caught — but the fallback value was outdated.Changes
"3.8", readsRequires-Pythondirectly from the installedcoherent.buildpackage metadata — a value that was previously resolved from CPython, so it's stable and up-to-date: