Skip to content

🔧 Optimize ROCm TensorFlow wheel declaration using uv.sources pattern #2152

@coderabbitai

Description

@coderabbitai

Problem Description

The ROCm TensorFlow notebook's pyproject.toml currently declares the tensorflow-rocm wheel using a direct URL in the dependencies list, which is not the uv-native pattern and makes the dependencies section less clean.

Current Implementation

In jupyter/rocm/tensorflow/ubi9-python-3.12/pyproject.toml:

dependencies = [
    "tensorflow-rocm @ https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/tensorflow_rocm-2.18.1-cp312-cp312-manylinux_2_28_x86_64.whl#sha256=814a5e4842b0c92d63c7a0bb4df0baf51ff2db8615535d83fe8958204b840598",
    # ... other dependencies
]

Proposed Solution

Move the URL declaration to tool.uv.sources and add architecture requirements for better lock-time validation:

Step 1: Clean up dependencies

- "tensorflow-rocm @ https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/tensorflow_rocm-2.18.1-cp312-cp312-manylinux_2_28_x86_64.whl#sha256=814a5e4842b0c92d63c7a0bb4df0baf51ff2db8615535d83fe8958204b840598",
+ "tensorflow-rocm==2.18.1",

Step 2: Add uv.sources configuration

[tool.uv.sources]
tensorflow-rocm = { url = "https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/tensorflow_rocm-2.18.1-cp312-cp312-manylinux_2_28_x86_64.whl" }

Step 3: Add architecture requirements

[tool.uv]
# keep existing settings...
required-environments = [
    "sys_platform == 'linux' and platform_machine == 'x86_64' and implementation_name == 'cpython'",
]

Benefits

  1. uv-Native Pattern: Follows uv's recommended approach for custom sources
  2. Cleaner Dependencies: Keeps project.dependencies focused on package names and versions
  3. Architecture Validation: Guarantees Linux x86_64 wheel exists at lock time
  4. Better Maintainability: Separates source configuration from dependency declarations
  5. Consistency: Aligns with other uv.sources usage in the repository

Files Affected

  • jupyter/rocm/tensorflow/ubi9-python-3.12/pyproject.toml
  • runtimes/rocm-tensorflow/ubi9-python-3.12/pyproject.toml (similar pattern)

Acceptance Criteria

  • Move tensorflow-rocm URL from dependencies to tool.uv.sources
  • Update dependencies entry to use version specification only
  • Add required-environments constraint for Linux x86_64
  • Verify lock regeneration works correctly with new configuration
  • Apply same pattern to runtimes/rocm-tensorflow if applicable
  • Update any related documentation or comments

References

Context Links

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions