-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[BE] use pathlib.Path
instead of os.path.*
in setup.py
#156742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/156742
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit e456a3e with merge base 3df6360 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ghstack-source-id: 887e52b Pull-Request: pytorch#156742
ghstack-source-id: 0570a19 Pull-Request: pytorch#156742
ghstack-source-id: 5396e3a Pull-Request: pytorch#156742
ghstack-source-id: 9bb12c6 Pull-Request: pytorch#156742
ghstack-source-id: 9bb12c6 Pull-Request: pytorch#156742
ghstack-source-id: b3766a3 Pull-Request: pytorch#156742
# XXX: Why not use wildcards ["lib/aotriton.images/*", "lib/aotriton.images/**/*"] here? | ||
aotriton_image_path = TORCH_DIR / "lib" / "aotriton.images" | ||
aks2_files = [ | ||
file.relative_to(TORCH_DIR).as_posix() | ||
for file in aotriton_image_path.rglob("*") | ||
if file.is_file() | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code gets aks2_files = []
and breaks the ROCm build on trunk. I'm not sure why.
I think the following code seems equivalent.
aotriton_image_path = TORCH_DIR / "lib" / "aotriton.images"
- aks2_files: list[str] = []
- for file in filter(lambda p: p.is_file(), aotriton_image_path.glob("**")):
- subpath = file.relative_to(aotriton_image_path)
- aks2_files.append(os.path.join("lib/aotriton.images", subpath))
+ aks2_files = [
+ file.relative_to(TORCH_DIR).as_posix()
+ for file in aotriton_image_path.rglob("*")
+ if file.is_file()
+ ]
PS: path.rglob("*")
is equivalent to path.glob("**/*")
. path.glob("**")
will yield path
while path.glob("**/*")
will not. But we are looking for files only, so they are the same.
ghstack-source-id: b3766a3 Pull-Request: pytorch#156742
ghstack-source-id: b3766a3 Pull-Request: pytorch#156742
ghstack-source-id: 0a78781 Pull-Request: pytorch#156742
ghstack-source-id: 0a78781 Pull-Request: pytorch#156742
ghstack-source-id: 0a78781 Pull-Request: pytorch#156742
ghstack-source-id: 0a78781 Pull-Request: pytorch#156742
ghstack-source-id: 0a78781 Pull-Request: pytorch#156742
ghstack-source-id: 0a78781 Pull-Request: pytorch#156742
@pytorchbot merge -f "All relevant tests are green" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…56958) See also: - astral-sh/uv#14269 Pull Request resolved: #156958 Approved by: https://github.com/Skylion007 ghstack dependencies: #156742
Resolves:
setuptools.build_meta:__legacy__
->setuptools.build_meta
#155998 (comment)Stack from ghstack (oldest at bottom):
setuptools<80.0
#156049python setup.py develop/install
->[uv ]pip install --no-build-isolation [-e ].
#156027pyproject.toml
consistency #156017setuptools.build_meta:__legacy__
->setuptools.build_meta
#155998pathlib.Path
instead ofos.path.*
insetup.py
#156742