Skip to content

migrate dirs whose runtime.python_binary kwargs are fbcode-only (#21388) - #21388

Merged
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
bigfootjon:export-D109082048
Jul 27, 2026
Merged

migrate dirs whose runtime.python_binary kwargs are fbcode-only (#21388)#21388
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
bigfootjon:export-D109082048

Conversation

@bigfootjon

@bigfootjon bigfootjon commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary:

Chunk 9 of fbcode/executorch TARGETS->BUCK migration. 4 directories that
were attempted in earlier chunks but reverted because their
runtime.python_binary calls use kwargs the xplat macro rejects
(main_src, srcs = ["data_utils.py"] triggering the
"default_only is not allowed to be specified" error, etc.).

Migrated using the chunk-6 gate-everything-on-is_fbcode pattern: each dir
now has a thin BUCK calling define_common_targets(is_fbcode = is_fbcode())
and a targets.bzl whose define_common_targets early-returns when not in
fbcode. This preserves the pre-migration behavior where these dirs were
fbcode-only by virtue of being TARGETS-only.

Directories migrated:

  • devtools/inspector
  • examples/devtools/scripts
  • extension/pybindings/fb/test
  • extension/training/examples/CIFAR

CIFAR's existing targets.bzl was edited to add is_fbcode = False param
and an early-return guard at the top of define_common_targets.

runtime/test was attempted but reverted: the dir's PACKAGE file calls
ci.buckconfig("executorch.event_tracer_enabled", "true") and that
buckconfig key is not on the xplat allowlist, so xplat fails to evaluate
the package once it has a BUCK file. Needs a separate fix to the PACKAGE
file (probably gating the ci.buckconfig call on is_fbcode) before this
dir can be migrated.

Reviewed By: mzlee

Differential Revision: D109082048

Copilot AI review requested due to automatic review settings July 24, 2026 20:05
@bigfootjon
bigfootjon requested a review from Gasoonjia as a code owner July 24, 2026 20:05
@pytorch-bot

pytorch-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21388

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 126 Pending

As of commit eddfcb0 with merge base 1a770b8 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 24, 2026
@meta-codesync

meta-codesync Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@bigfootjon has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109082048.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copilot AI left a comment

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.

Pull request overview

Migrates several fbcode-only directories from TARGETS to BUCK while preserving prior behavior in xplat by gating target definitions on is_fbcode().

Changes:

  • Added thin BUCK entrypoints that call define_common_targets(is_fbcode = is_fbcode()).
  • Introduced/updated targets.bzl files that early-return when not in fbcode to avoid xplat-incompatible runtime.python_binary kwargs.
  • Completed migration cleanup by removing TARGETS files and folding fbcode-only unit tests behind an is_fbcode gate.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
extension/training/examples/CIFAR/targets.bzl Adds is_fbcode param + early-return guard to keep CIFAR fbcode-only.
extension/training/examples/CIFAR/BUCK New BUCK entrypoint calling define_common_targets with is_fbcode().
examples/devtools/scripts/targets.bzl New fbcode-gated targets definition (python binaries).
examples/devtools/scripts/BUCK New BUCK entrypoint calling define_common_targets with is_fbcode().
devtools/inspector/targets.bzl Moves inspector targets into a fbcode-gated targets.bzl.
devtools/inspector/BUCK New BUCK entrypoint calling define_common_targets with is_fbcode().
devtools/inspector/TARGETS Removed as part of TARGETS→BUCK migration.
devtools/etdump/tests/targets.bzl Adds is_fbcode param and gates python unittest target creation on it.
devtools/etdump/tests/BUCK Updates BUCK to pass is_fbcode() into define_common_targets.
devtools/etdump/tests/TARGETS Removed as part of TARGETS→BUCK migration.
Comments suppressed due to low confidence (1)

devtools/etdump/tests/targets.bzl:9

  • The docstring still claims this directory has both TARGETS and BUCK callers, but TARGETS was removed as part of this migration. Updating the docstring avoids misleading future edits.
    """Defines targets that should be shared between fbcode and xplat.

    The directory containing this targets.bzl file should also contain both
    TARGETS and BUCK files that call this function.
    """

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


def define_common_targets():
def define_common_targets(is_fbcode = False):
"""Defines targets that should be shared between fbcode and xplat.
@meta-codesync meta-codesync Bot changed the title migrate dirs whose runtime.python_binary kwargs are fbcode-only migrate dirs whose runtime.python_binary kwargs are fbcode-only (#21388) Jul 27, 2026
Copilot AI review requested due to automatic review settings July 27, 2026 16:26
bigfootjon added a commit to bigfootjon/executorch that referenced this pull request Jul 27, 2026
…rch#21388)

Summary:

Chunk 9 of fbcode/executorch TARGETS->BUCK migration. 4 directories that
were attempted in earlier chunks but reverted because their
`runtime.python_binary` calls use kwargs the xplat macro rejects
(`main_src`, `srcs = ["data_utils.py"]` triggering the
"default_only is not allowed to be specified" error, etc.).

Migrated using the chunk-6 gate-everything-on-is_fbcode pattern: each dir
now has a thin BUCK calling `define_common_targets(is_fbcode = is_fbcode())`
and a targets.bzl whose `define_common_targets` early-returns when not in
fbcode. This preserves the pre-migration behavior where these dirs were
fbcode-only by virtue of being TARGETS-only.

Directories migrated:
  - devtools/inspector
  - examples/devtools/scripts
  - extension/pybindings/fb/test
  - extension/training/examples/CIFAR

CIFAR's existing targets.bzl was edited to add `is_fbcode = False` param
and an early-return guard at the top of `define_common_targets`.

runtime/test was attempted but reverted: the dir's PACKAGE file calls
`ci.buckconfig("executorch.event_tracer_enabled", "true")` and that
buckconfig key is not on the xplat allowlist, so xplat fails to evaluate
the package once it has a BUCK file. Needs a separate fix to the PACKAGE
file (probably gating the ci.buckconfig call on is_fbcode) before this
dir can be migrated.

Reviewed By: mzlee

Differential Revision: D109082048
…rch#21388)

Summary:
Pull Request resolved: pytorch#21388

Chunk 9 of fbcode/executorch TARGETS->BUCK migration. 4 directories that
were attempted in earlier chunks but reverted because their
`runtime.python_binary` calls use kwargs the xplat macro rejects
(`main_src`, `srcs = ["data_utils.py"]` triggering the
"default_only is not allowed to be specified" error, etc.).

Migrated using the chunk-6 gate-everything-on-is_fbcode pattern: each dir
now has a thin BUCK calling `define_common_targets(is_fbcode = is_fbcode())`
and a targets.bzl whose `define_common_targets` early-returns when not in
fbcode. This preserves the pre-migration behavior where these dirs were
fbcode-only by virtue of being TARGETS-only.

Directories migrated:
  - devtools/inspector
  - examples/devtools/scripts
  - extension/pybindings/fb/test
  - extension/training/examples/CIFAR

CIFAR's existing targets.bzl was edited to add `is_fbcode = False` param
and an early-return guard at the top of `define_common_targets`.

runtime/test was attempted but reverted: the dir's PACKAGE file calls
`ci.buckconfig("executorch.event_tracer_enabled", "true")` and that
buckconfig key is not on the xplat allowlist, so xplat fails to evaluate
the package once it has a BUCK file. Needs a separate fix to the PACKAGE
file (probably gating the ci.buckconfig call on is_fbcode) before this
dir can be migrated.

Reviewed By: mzlee

Differential Revision: D109082048

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 27, 2026 16:29

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@meta-codesync
meta-codesync Bot merged commit 16b780b into pytorch:main Jul 27, 2026
193 of 197 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants