feat(ir): add typed builder for UsePythonVersion@0#1154
Merged
jamesadevine merged 1 commit intoJun 22, 2026
Conversation
Introduce UsePythonVersion builder struct in
src/compile/ir/tasks/use_python_version.rs and migrate the Python
runtime extension (src/runtimes/python/extension.rs) from the raw
TaskStep::new("UsePythonVersion@0", ...) call to the new typed builder.
- Architecture enum (X86 | X64 | Arm64) with as_ado_str()
- Required input: versionSpec (positional in new())
- Optional typed setters: architecture, add_to_path,
disable_download_from_registry, allow_unstable, github_token,
with_display_name
- 8 unit tests covering all input combinations
- mod.rs: pub mod use_python_version added (alphabetical order)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Adds a typed builder struct for
UsePythonVersion@0to the ado-aw IR, and migrates the Python runtime extension from rawTaskStep::new(...)to the new typed builder.Motivation
Previously,
src/runtimes/python/extension.rsemitted theUsePythonVersion@0install step by hand-craftingTaskStep::new("UsePythonVersion@0", ...).with_input("versionSpec", version)with raw string keys. This PR introduces a typed builder struct so:versionSpecis a positional required parameter ofnew()architectureis a typedArchitectureenum (X86 | X64 | Arm64) withas_ado_str()addToPath,disableDownloadFromRegistry,allowUnstable,githubToken) are typed chained setters that only emit an ADO input when explicitly setChanges
src/compile/ir/tasks/use_python_version.rs: newUsePythonVersionbuilder struct,Architectureenum, and 8#[cfg(test)]unit testssrc/compile/ir/tasks/mod.rs:pub mod use_python_version;declaration (alphabetical order, betweenuse_dotnetanduse_node)src/runtimes/python/extension.rs: migratedpython_install_task_stepfrom rawTaskStep::new("UsePythonVersion@0", ...)toUsePythonVersion::new(version).into_step()ADO Task Reference
UsePythonVersion@0versionSpec(default:"3.x")architecture(x86|x64|arm64, default:x64),addToPath(bool, default:true),disableDownloadFromRegistry(bool, default:false),allowUnstable(bool, default:false),githubToken(string)Validation
cargo build --all-targetscargo test— 8 new unit tests, all pass, no existing tests brokencargo clippy --all-targets --all-features --workspace -- -D warningsCreated by the ado-task-ir-contributor workflow.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.