Skip to content

Delete legacy build#5921

Merged
wujingyue merged 2 commits intomainfrom
wjy/setup
Feb 8, 2026
Merged

Delete legacy build#5921
wujingyue merged 2 commits intomainfrom
wjy/setup

Conversation

@wujingyue
Copy link
Collaborator

No description provided.

@wujingyue
Copy link
Collaborator Author

!test

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Review updated until commit b2e0cbb

Description

  • Delete legacy root-level setup.py file and simplify build configuration

  • Remove argparse-based argument parsing from python/utils.py and python/setup.py

  • Replace command-line arguments with environment variables for build configuration

  • Update GitHub Actions lint workflow to use new environment variable approach

Changes walkthrough

Relevant files
Enhancement
setup.py
Simplify build configuration in python/setup.py                   

python/setup.py

  • Replace create_build_config() call with direct BuildConfig()
    instantiation
  • Remove argparse-based argument parsing and sys.argv manipulation
  • Simplify main() function to use environment variable configuration
  • +3/-8     
    utils.py
    Remove legacy argparse configuration code                               

    python/utils.py

  • Remove argparse import and parse_args() function (133 lines removed)
  • Remove create_build_config() function (50+ lines removed)
  • Keep only override_build_config_from_env() function for
    environment-based configuration
  • +0/-175 
    Configuration changes
    setup.py
    Delete legacy root-level setup.py file                                     

    setup.py

  • Delete entire legacy setup.py file (107 lines removed)
  • Remove duplicate build configuration logic
  • Consolidate build process under python/setup.py
  • +0/-107 
    lint.yml
    Update lint workflow for new configuration method               

    .github/workflows/lint.yml

  • Replace --cmake-only command line argument with
    NVFUSER_BUILD_CMAKE_ONLY=1 environment variable
  • Update build command to use new environment variable approach
  • +1/-1     

    PR Reviewer Guide

    Here are some key observations to aid the review process:

    🧪 No relevant tests
    ⚡ Recommended focus areas for review
    Missing argument handling

    The PR removes all command-line argument parsing (argparse) and replaces it with direct BuildConfig creation. This means users can no longer pass build options like --cmake-only, --debug, --build-dir etc. via command line. Need to verify this is intentional and that all functionality is preserved through environment variables.

    def main():
        config = BuildConfig()
        # Override build config from environment variables.
        override_build_config_from_env(config)
    
        if "clean" in sys.argv:
            # only disables BUILD_SETUP, but keep the argument for setuptools
            config.build_setup = False
    
        if config.cpp_standard < 20:
            raise ValueError("nvfuser requires C++20 standard or higher")
    
        run(config, version_tag(config), relative_path="..")
    Workflow compatibility

    The workflow was updated to use NVFUSER_BUILD_CMAKE_ONLY=1 environment variable instead of --cmake-only flag. Need to verify this change works correctly and that the environment variable approach is properly supported throughout the build system.

    NVFUSER_BUILD_CMAKE_ONLY=1 python setup.py

    Test failures

    • (Medium, 3) Shape mismatch in thunderfx higher-order inplace alias update (nvFuser, CUDA)

      Test Name A100 GB200 H100 Source
      thunder.tests.test_update_aliases.test_higher_order_inplace_alias_update_nvfuser_cuda_thunder.dtypes.float32

    @greptile-apps
    Copy link
    Contributor

    greptile-apps bot commented Feb 4, 2026

    Greptile Overview

    Greptile Summary

    This PR removes the legacy top-level setup.py build entrypoint and deletes the argparse-based build flag parsing in python/utils.py, switching the Python build flow to be configured exclusively via BuildConfig + environment variables. The CI lint workflow is updated accordingly to use NVFUSER_BUILD_CMAKE_ONLY=1 instead of the removed --cmake-only flag.

    Two correctness issues were introduced in the refactor:

    • python/setup.py can throw a TypeError in version_tag() when NVFUSER_BUILD_OVERWRITE_VERSION is set but NVFUSER_BUILD_VERSION_TAG is not.
    • python/utils.py’s check_env_flag_bool_default() is annotated as returning bool but returns the provided default string when the env var is missing, which can propagate non-bools into code paths expecting booleans.

    Confidence Score: 3/5

    • This PR is close to mergeable but has a couple of build-time correctness issues that should be fixed first.
    • The build refactor is straightforward and CI updates are consistent, but there are two concrete runtime/type issues: version_tag() can crash when overwrite_version is enabled without a tag, and check_env_flag_bool_default() can return a non-bool despite its type contract. Both can break packaging/build flows in real configurations.
    • python/setup.py, python/utils.py

    Important Files Changed

    Filename Overview
    .github/workflows/lint.yml Updates clang-tidy job to use env var NVFUSER_BUILD_CMAKE_ONLY=1 instead of the removed --cmake-only CLI flag when running python/setup.py.
    python/setup.py Removes legacy argparse-based build flags and constructs BuildConfig() directly, relying on env var overrides; introduces a TypeError risk in version_tag() when overwrite_version is true but version_tag is unset.
    python/utils.py Deletes legacy argparse parsing helpers and relies on env vars; check_env_flag_bool_default is annotated as bool but returns a string default, which can leak wrong types to callers.
    setup.py Deletes the legacy top-level setup.py entrypoint in favor of python/setup.py; no remaining file at repo root.

    Sequence Diagram

    sequenceDiagram
      participant CI as GitHub Actions (lint.yml)
      participant PySetup as python/setup.py
      participant Utils as python/utils.py
      participant CMake as cmake/configure+build
    
      CI->>PySetup: NVFUSER_BUILD_CMAKE_ONLY=1 python setup.py
      PySetup->>Utils: config = BuildConfig()
      PySetup->>Utils: override_build_config_from_env(config)
      Utils-->>PySetup: config.cmake_only = true
      PySetup->>Utils: run(config, version_tag(config), "..")
      Utils->>CMake: cmake(config, "..")
      alt cmake_only
        CMake-->>Utils: configure build dir only (no build)
      else full build
        CMake-->>Utils: cmake --build ... --target install
        Utils-->>PySetup: setuptools setup() builds wheel/ext
      end
    
    Loading

    Copy link
    Contributor

    @greptile-apps greptile-apps bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    3 files reviewed, 1 comment

    Edit Code Review Agent Settings | Greptile

    @greptile-apps
    Copy link
    Contributor

    greptile-apps bot commented Feb 4, 2026

    Additional Comments (1)

    .github/workflows/lint.yml
    the command python setup.py --cmake-only is incompatible with the new build system that uses environment variables instead of CLI arguments

              NVFUSER_BUILD_CMAKE_ONLY=1 python setup.py
    

    Copy link
    Collaborator

    @xwang233 xwang233 left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    as long as CI passes 🤞

    Copy link
    Collaborator

    @mdavis36 mdavis36 left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Looks like greptile is correct about the .github lintrunner. The clang-tidy ob it trying to do a full build because the arg is ignored here

    @wujingyue
    Copy link
    Collaborator Author

    !test

    Copy link
    Contributor

    @greptile-apps greptile-apps bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    4 files reviewed, 2 comments

    Edit Code Review Agent Settings | Greptile

    @greptile-apps
    Copy link
    Contributor

    greptile-apps bot commented Feb 8, 2026

    Additional Comments (2)

    python/utils.py
    Wrong return type
    check_env_flag_bool_default is annotated to return bool, but when the env var is missing it returns default (a str), so callers can receive a string instead of a boolean.

    def check_env_flag_bool_default(name: str, default: bool = False) -> bool:
        if name not in os.environ:
            return default
    

    python/setup.py
    None tag length crash
    BuildConfig.version_tag defaults to None (python/utils.py:28), but version_tag() does len(config.version_tag), which will raise TypeError if NVFUSER_BUILD_VERSION_TAG isn’t set but NVFUSER_BUILD_OVERWRITE_VERSION is.

        if config.overwrite_version:
            version = version.split("+")[0]
            if config.version_tag:
                # use "." to be pypi friendly
                version = ".".join([version, config.version_tag])
    

    @wujingyue wujingyue merged commit 110a2a6 into main Feb 8, 2026
    58 of 61 checks passed
    @wujingyue wujingyue deleted the wjy/setup branch February 8, 2026 23:42
    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.

    3 participants