Skip to content

refactor: split create_providers into separate functions#3695

Open
rickeylev wants to merge 5 commits intobazel-contrib:mainfrom
rickeylev:refactor.providers.adding
Open

refactor: split create_providers into separate functions#3695
rickeylev wants to merge 5 commits intobazel-contrib:mainfrom
rickeylev:refactor.providers.adding

Conversation

@rickeylev
Copy link
Copy Markdown
Collaborator

The create_providers function was becoming unwieldy because it was
taking all the args for all the providers. Split it up into separate
functions to make it easier to see what args are going to what
providers and follow the provider creation logic.

@rickeylev rickeylev requested a review from aignas as a code owner April 12, 2026 02:36
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the provider creation logic in python/private/py_executable.bzl by decomposing the monolithic _create_providers function into several modular helper functions. This change improves the structure of py_executable_base_impl by calling these helpers sequentially. Feedback was provided to ignore the unused builtin_py_info return value in py_executable_base_impl to improve code clarity.

)
_add_provider_py_runtime_info(providers, runtime_details)
_add_provider_py_cc_link_params_info(providers, cc_details.cc_info_for_propagating)
py_info, builtin_py_info = _add_provider_py_info(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The builtin_py_info variable is assigned here but never used in the rest of the function. Since _add_provider_py_info already appends it to the providers list if it exists, you can use _ to ignore the second return value and improve code clarity.

Suggested change
py_info, builtin_py_info = _add_provider_py_info(
py_info, _ = _add_provider_py_info(

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