Skip to content

Conversation

@amd-sriram
Copy link
Collaborator

@amd-sriram amd-sriram commented Nov 21, 2025

Motivation

setup.py reads BUILD_VERSION env variable, along with version.txt, so that BUILD_VERSION is used instead of version.txt when creating a wheel

Technical Details

Similar to other existing repos e.g. torchaudio - https://github.com/ROCm/audio/blob/main/setup.py#L27

def _get_version(sha):
    with open(ROOT_DIR / "version.txt", "r") as f:
        version = f.read().strip()
    if os.getenv("BUILD_VERSION"):
        version = os.getenv("BUILD_VERSION")

Test Plan

Build apex wheel with explicit BUILD_VERSION.

BUILD_VERSION=1.10.0+rocmsdk20251121 python -m build --wheel --no-isolation -C--build-option=--cpp_ext -C--build-option=--cuda_ext

Test Result

This builds apex wheel - apex-1.10.0+rocmsdk20251121-cp312-cp312-linux_x86_64.whl

Submission Checklist

@amd-sriram amd-sriram self-assigned this Nov 21, 2025
@amd-sriram amd-sriram marked this pull request as ready for review November 21, 2025 21:38
@amd-sriram amd-sriram changed the title setup.py reads BUILD_VERSION env variable, along with version.txt [master] setup.py reads BUILD_VERSION env variable, along with version.txt Nov 21, 2025
@amd-sriram amd-sriram merged commit 4a04a64 into master Nov 21, 2025
@amd-sriram amd-sriram deleted the read_build_version_env_variable_for_building_wheel branch November 21, 2025 21:39
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.

2 participants