Skip to content

[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

Closed
wants to merge 28 commits into from

Conversation

[ghstack-poisoned]
@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Jun 24, 2025
Copy link

pytorch-bot bot commented Jun 24, 2025

🔗 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 Pending

As of commit e456a3e with merge base 3df6360 (image):
💚 Looks good so far! There are no failures yet. 💚

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

XuehaiPan added a commit that referenced this pull request Jun 24, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jun 24, 2025
@XuehaiPan XuehaiPan requested a review from malfet June 25, 2025 06:33
@XuehaiPan XuehaiPan added better-engineering Relatively self-contained tasks for better engineering contributors ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR ciflow/binaries_libtorch Trigger binary build and upload jobs for libtorch on the PR labels Jun 25, 2025
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 1, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 1, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 1, 2025
@XuehaiPan XuehaiPan added ciflow/rocm Trigger "default" config CI on ROCm ciflow/inductor-rocm Trigger "inductor" config CI on ROCm labels Jul 1, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 1, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 1, 2025
Comment on lines +1336 to +1342
# 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()
]
Copy link
Collaborator Author

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.

XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 1, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 1, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 2, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 2, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 2, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 2, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 2, 2025
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 2, 2025
@malfet
Copy link
Contributor

malfet commented Jul 2, 2025

@pytorchbot merge -f "All relevant tests are green"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Jul 2, 2025
@github-actions github-actions bot deleted the gh/XuehaiPan/333/head branch August 2, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better-engineering Relatively self-contained tasks for better engineering contributors ci-no-td Do not run TD on this PR ci-test-showlocals Show local variables on test failures ciflow/binaries_libtorch Trigger binary build and upload jobs for libtorch on the PR ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/inductor-rocm Trigger "inductor" config CI on ROCm ciflow/rocm Trigger "default" config CI on ROCm ciflow/trunk Trigger trunk jobs on your pull request keep-going Don't stop on first failure, keep running tests until the end Merged open source Reverted suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants