Skip to content

feat(ir): add typed builder for UsePythonVersion@0#1154

Merged
jamesadevine merged 1 commit into
mainfrom
feat/ir-use-python-version-v0-8690a626c394b2ec
Jun 22, 2026
Merged

feat(ir): add typed builder for UsePythonVersion@0#1154
jamesadevine merged 1 commit into
mainfrom
feat/ir-use-python-version-v0-8690a626c394b2ec

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds a typed builder struct for UsePythonVersion@0 to the ado-aw IR, and migrates the Python runtime extension from raw TaskStep::new(...) to the new typed builder.

Motivation

Previously, src/runtimes/python/extension.rs emitted the UsePythonVersion@0 install step by hand-crafting TaskStep::new("UsePythonVersion@0", ...).with_input("versionSpec", version) with raw string keys. This PR introduces a typed builder struct so:

  • versionSpec is a positional required parameter of new()
  • architecture is a typed Architecture enum (X86 | X64 | Arm64) with as_ado_str()
  • All optional inputs (addToPath, disableDownloadFromRegistry, allowUnstable, githubToken) are typed chained setters that only emit an ADO input when explicitly set
  • The Python runtime extension call site is now one clean, compiler-checked expression

Changes

  • src/compile/ir/tasks/use_python_version.rs: new UsePythonVersion builder struct, Architecture enum, and 8 #[cfg(test)] unit tests
  • src/compile/ir/tasks/mod.rs: pub mod use_python_version; declaration (alphabetical order, between use_dotnet and use_node)
  • src/runtimes/python/extension.rs: migrated python_install_task_step from raw TaskStep::new("UsePythonVersion@0", ...) to UsePythonVersion::new(version).into_step()

ADO Task Reference

Validation

  • cargo build --all-targets
  • cargo test — 8 new unit tests, all pass, no existing tests broken
  • cargo clippy --all-targets --all-features --workspace -- -D warnings

Created 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.com
  • spsprodweu4.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"
    - "spsprodweu4.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by ADO Task IR Contributor · 725.9 AIC · ⌖ 29.5 AIC · ⊞ 38.1K ·

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>
@jamesadevine jamesadevine marked this pull request as ready for review June 22, 2026 20:32
@jamesadevine jamesadevine merged commit 5c635b6 into main Jun 22, 2026
@jamesadevine jamesadevine deleted the feat/ir-use-python-version-v0-8690a626c394b2ec branch June 22, 2026 20:32
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.

1 participant