Harden Python SDK version resolution - #987
Closed
bmehta001 wants to merge 1 commit into
Closed
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c57f1ea3-b538-4db9-9223-8ca4f174f277
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Hardens Python SDK version resolution across source and installed environments.
Changes:
- Prioritizes the source checkout’s
pyproject.toml. - Falls back to installed metadata or an unknown version.
- Adds focused version-resolution tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
sdk_v2/python/src/foundry_local_sdk/version.py |
Implements layered version resolution. |
sdk_v2/python/test/unit/test_version.py |
Tests precedence and fallback behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def test_malformed_pyproject_falls_back_to_unknown(monkeypatch, tmp_path: Path): | ||
| pyproject = tmp_path / "pyproject.toml" | ||
| pyproject.write_text("[project\n", encoding="utf-8") | ||
| monkeypatch.setattr(version_module, "_version_from_source_tree", lambda: version_module._version_from_pyproject(pyproject)) |
Comment on lines
+24
to
+25
| found = data.get("project", {}).get("version") | ||
| return found if isinstance(found, str) and found else None |
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.
Summary
Address Copilot review feedback for Python SDK version resolution.
Changes
pyproject.tomlversion before consulting installed distribution metadata, preventing an unrelated installed wheel from masking the local source version.pyproject.toml, malformed configuration, and unknown-version fallback.Validation
python -m pytest sdk_v2/python/test/unit/test_version.py sdk_v2/python/test/unit/test_imports.py -q— 18 passed