[BE]: No include left behind - recursive glob setuptools support (#148258)

Fixes #148256
TestPlan check the printout from the setup.py build and verify the files are still included.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/148258
Approved by: https://github.com/malfet, https://github.com/benjaminglass1
This commit is contained in:
Aaron Gokaslan
2025-03-14 19:39:21 +00:00
committed by PyTorch MergeBot
parent 9d7945e382
commit c96ed7e6f5
3 changed files with 16 additions and 186 deletions

196
setup.py
View File

@ -1193,175 +1193,19 @@ def main():
"bin/*",
"test/*",
"*.pyi",
"_C/*.pyi",
"cuda/*.pyi",
"fx/*.pyi",
"optim/*.pyi",
"autograd/*.pyi",
"jit/*.pyi",
"nn/*.pyi",
"nn/modules/*.pyi",
"nn/parallel/*.pyi",
"utils/data/*.pyi",
"utils/data/datapipes/*.pyi",
"**/*.pyi",
"lib/*.pdb",
"lib/**/*.pdb",
"lib/*shm*",
"lib/torch_shm_manager",
"lib/*.h",
"lib/**/*.h",
"include/*.h",
"include/ATen/*.h",
"include/ATen/cpu/*.h",
"include/ATen/cpu/vec/vec128/*.h",
"include/ATen/cpu/vec/vec256/*.h",
"include/ATen/cpu/vec/vec256/vsx/*.h",
"include/ATen/cpu/vec/vec256/zarch/*.h",
"include/ATen/cpu/vec/vec512/*.h",
"include/ATen/cpu/vec/*.h",
"include/ATen/cpu/vec/sve/*.h",
"include/ATen/core/*.h",
"include/ATen/cuda/*.cuh",
"include/ATen/cuda/*.h",
"include/ATen/cuda/detail/*.cuh",
"include/ATen/cuda/detail/*.h",
"include/ATen/cuda/tunable/*.h",
"include/ATen/cudnn/*.h",
"include/ATen/functorch/*.h",
"include/ATen/ops/*.h",
"include/ATen/hip/*.cuh",
"include/ATen/hip/*.h",
"include/ATen/hip/detail/*.cuh",
"include/ATen/hip/detail/*.h",
"include/ATen/hip/impl/*.h",
"include/ATen/hip/tunable/*.h",
"include/ATen/mps/*.h",
"include/ATen/miopen/*.h",
"include/ATen/detail/*.h",
"include/ATen/native/*.h",
"include/ATen/native/cpu/*.h",
"include/ATen/native/cuda/*.h",
"include/ATen/native/cuda/*.cuh",
"include/ATen/native/hip/*.h",
"include/ATen/native/hip/*.cuh",
"include/ATen/native/kleidiai/*.h",
"include/ATen/native/mps/*.h",
"include/ATen/native/mkldnn/xpu/*.h",
"include/ATen/native/mkldnn/xpu/detail/*.h",
"include/ATen/native/nested/*.h",
"include/ATen/native/quantized/*.h",
"include/ATen/native/quantized/cpu/*.h",
"include/ATen/native/transformers/*.h",
"include/ATen/native/sparse/*.h",
"include/ATen/native/utils/*.h",
"include/ATen/quantized/*.h",
"include/ATen/xpu/*.h",
"include/ATen/xpu/detail/*.h",
"include/caffe2/serialize/*.h",
"include/c10/*.h",
"include/c10/macros/*.h",
"include/c10/core/*.h",
"include/ATen/core/boxing/*.h",
"include/ATen/core/boxing/impl/*.h",
"include/ATen/core/dispatch/*.h",
"include/ATen/core/op_registration/*.h",
"include/c10/core/impl/*.h",
"include/c10/util/*.h",
"include/c10/cuda/*.h",
"include/c10/cuda/impl/*.h",
"include/c10/hip/*.h",
"include/c10/hip/impl/*.h",
"include/c10/metal/*.h",
"include/c10/xpu/*.h",
"include/c10/xpu/impl/*.h",
"include/torch/*.h",
"include/torch/csrc/*.h",
"include/torch/csrc/stable/*.h",
"include/torch/csrc/api/include/torch/*.h",
"include/torch/csrc/api/include/torch/data/*.h",
"include/torch/csrc/api/include/torch/data/dataloader/*.h",
"include/torch/csrc/api/include/torch/data/datasets/*.h",
"include/torch/csrc/api/include/torch/data/detail/*.h",
"include/torch/csrc/api/include/torch/data/samplers/*.h",
"include/torch/csrc/api/include/torch/data/transforms/*.h",
"include/torch/csrc/api/include/torch/detail/*.h",
"include/torch/csrc/api/include/torch/detail/ordered_dict.h",
"include/torch/csrc/api/include/torch/nn/*.h",
"include/torch/csrc/api/include/torch/nn/functional/*.h",
"include/torch/csrc/api/include/torch/nn/options/*.h",
"include/torch/csrc/api/include/torch/nn/modules/*.h",
"include/torch/csrc/api/include/torch/nn/modules/container/*.h",
"include/torch/csrc/api/include/torch/nn/parallel/*.h",
"include/torch/csrc/api/include/torch/nn/utils/*.h",
"include/torch/csrc/api/include/torch/optim/*.h",
"include/torch/csrc/api/include/torch/optim/schedulers/*.h",
"include/torch/csrc/api/include/torch/serialize/*.h",
"include/torch/csrc/autograd/*.h",
"include/torch/csrc/autograd/functions/*.h",
"include/torch/csrc/autograd/generated/*.h",
"include/torch/csrc/autograd/utils/*.h",
"include/torch/csrc/cuda/*.h",
"include/torch/csrc/distributed/c10d/*.h",
"include/torch/csrc/distributed/c10d/*.hpp",
"include/torch/csrc/distributed/rpc/*.h",
"include/torch/csrc/distributed/autograd/context/*.h",
"include/torch/csrc/distributed/autograd/functions/*.h",
"include/torch/csrc/distributed/autograd/rpc_messages/*.h",
"include/torch/csrc/dynamo/*.h",
"include/torch/csrc/inductor/*.h",
"include/torch/csrc/inductor/aoti_include/*.h",
"include/torch/csrc/inductor/aoti_package/*.h",
"include/torch/csrc/inductor/aoti_runner/*.h",
"include/torch/csrc/inductor/aoti_runtime/*.h",
"include/torch/csrc/inductor/aoti_torch/*.h",
"include/torch/csrc/inductor/aoti_torch/c/*.h",
"include/torch/csrc/inductor/aoti_torch/generated/*.h",
"include/torch/csrc/inductor/aoti_torch/generated/extend/*.h",
"include/torch/csrc/inductor/cpp_wrapper/*.h",
"include/torch/csrc/inductor/cpp_wrapper/device_internal/*.h",
"include/torch/csrc/jit/*.h",
"include/torch/csrc/jit/backends/*.h",
"include/torch/csrc/jit/generated/*.h",
"include/torch/csrc/jit/passes/*.h",
"include/torch/csrc/jit/passes/quantization/*.h",
"include/torch/csrc/jit/passes/utils/*.h",
"include/torch/csrc/jit/runtime/*.h",
"include/torch/csrc/jit/ir/*.h",
"include/torch/csrc/jit/frontend/*.h",
"include/torch/csrc/jit/api/*.h",
"include/torch/csrc/jit/serialization/*.h",
"include/torch/csrc/jit/python/*.h",
"include/torch/csrc/jit/mobile/*.h",
"include/torch/csrc/jit/testing/*.h",
"include/torch/csrc/jit/tensorexpr/*.h",
"include/torch/csrc/jit/tensorexpr/operators/*.h",
"include/torch/csrc/jit/codegen/cuda/*.h",
"include/torch/csrc/onnx/*.h",
"include/torch/csrc/profiler/*.h",
"include/torch/csrc/profiler/orchestration/*.h",
"include/torch/csrc/profiler/standalone/*.h",
"include/torch/csrc/profiler/stubs/*.h",
"include/torch/csrc/profiler/unwind/*.h",
"include/torch/csrc/profiler/python/*.h",
"include/torch/csrc/utils/*.h",
"include/torch/csrc/tensor/*.h",
"include/torch/csrc/lazy/backend/*.h",
"include/torch/csrc/lazy/core/*.h",
"include/torch/csrc/lazy/core/internal_ops/*.h",
"include/torch/csrc/lazy/core/ops/*.h",
"include/torch/csrc/lazy/python/python_util.h",
"include/torch/csrc/lazy/ts_backend/*.h",
"include/torch/csrc/xpu/*.h",
"include/pybind11/*.h",
"include/pybind11/detail/*.h",
"include/pybind11/eigen/*.h",
"include/TH/*.h*",
"include/TH/generic/*.h*",
"include/THC/*.cuh",
"include/THC/*.h*",
"include/THC/generic/*.h",
"include/THH/*.cuh",
"include/THH/*.h*",
"include/THH/generic/*.h",
"include/sleef.h",
"include/**/*.h",
"include/*.hpp",
"include/**/*.hpp",
"include/*.cuh",
"include/**/*.cuh",
"_inductor/codegen/*.h",
"_inductor/codegen/aoti_runtime/*.cpp",
"_inductor/script.ld",
@ -1412,35 +1256,19 @@ def main():
torch_package_data.extend(
[
"include/tensorpipe/*.h",
"include/tensorpipe/channel/*.h",
"include/tensorpipe/channel/basic/*.h",
"include/tensorpipe/channel/cma/*.h",
"include/tensorpipe/channel/mpt/*.h",
"include/tensorpipe/channel/xth/*.h",
"include/tensorpipe/common/*.h",
"include/tensorpipe/core/*.h",
"include/tensorpipe/transport/*.h",
"include/tensorpipe/transport/ibv/*.h",
"include/tensorpipe/transport/shm/*.h",
"include/tensorpipe/transport/uv/*.h",
"include/tensorpipe/**/*.h",
]
)
if get_cmake_cache_vars()["USE_KINETO"]:
torch_package_data.extend(
[
"include/kineto/*.h",
"include/kineto/**/*.h",
]
)
torchgen_package_data = [
# Recursive glob doesn't work in setup.py,
# https://github.com/pypa/setuptools/issues/1806
# To make this robust we should replace it with some code that
# returns a list of everything under packaged/
"packaged/ATen/*",
"packaged/ATen/native/*",
"packaged/ATen/templates/*",
"packaged/autograd/*",
"packaged/autograd/templates/*",
"packaged/*",
"packaged/**/*",
]
package_data = {
"torch": torch_package_data,