Skip to content

fix: skip __pycache__ dirs when merging namespace packages#1101

Draft
xangcastle wants to merge 1 commit into
1.xfrom
fix/pth-pycache-collision
Draft

fix: skip __pycache__ dirs when merging namespace packages#1101
xangcastle wants to merge 1 commit into
1.xfrom
fix/pth-pycache-collision

Conversation

@xangcastle

Copy link
Copy Markdown
Member

When uv or the host Python compiles a shared namespace init.py to bytecode, the resulting .pyc files embed the absolute source path in their headers. Two packages sharing the same namespace therefore produce non-identical .pyc files, which triggered CollisionResolutionStrategy::Error in create_symlinks.

Python regenerates .pyc files on demand, so pycache directories can safely be omitted from the symlink forest. The fix skips any directory named pycache in create_symlinks.


Changes are visible to end-users: no

Test plan

  • New test cases added

@aspect-workflows

aspect-workflows Bot commented Jun 11, 2026

Copy link
Copy Markdown

✨ Aspect Workflows Tasks

📅 Thu Jun 11 04:04:47 UTC 2026

❌ 3 failed tasks

  • ❌ buildifier · ⏱ 18.2s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in diff · Format failed (1 file needs format)
  • ❌ test (test-e2e-bazel-8) · ⏱ 26m 51s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed
  • ❌ test (test-e2e-bazel-9) · ⏱ 1m 13s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed

✅ 4 successful tasks

  • ✅ gazelle · ⏱ 21.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ test (test-examples-uv_pip_compile-bazel-8) · ⏱ 26.2s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed · 1 cached)
  • ✅ test (test-root-bazel-8) · ⏱ 36m 33s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (123/123 passed)
  • ✅ test (test-root-bazel-9) · ⏱ 37m 10s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (122/122 passed)

🛠️ Fix

❌ buildifier (buildifier)

aspect buildifier --severity=info -- e2e/cases/pth-pycache-collision/BUILD.bazel
# without Aspect CLI
bazel run --run_in_cwd @buildifier_prebuilt//buildifier -- \
  e2e/cases/pth-pycache-collision/BUILD.bazel

Install aspect: docs.aspect.build/cli/install

🔁 Reproduce

❌ buildifier (buildifier)

aspect buildifier --severity=fail --base-ref=origin/1.x

❌ test (test-e2e-bazel-8 · test-e2e-bazel-9)

aspect test -- //cases/pth-pycache-collision:test
# without Aspect CLI
bazel test -- //cases/pth-pycache-collision:test

Install aspect: docs.aspect.build/cli/install


⏱ Last updated Thu Jun 11 04:42:03 UTC 2026 · 📊 GitHub API quota 175/15,000 (1% used, resets in 15m, throttle 3×)
🚀 Powered by Aspect CLI (v2026.22.44)  |  Aspect Build · X · LinkedIn · YouTube

@xangcastle xangcastle force-pushed the fix/pth-pycache-collision branch from 4b8e234 to d487f0a Compare June 11, 2026 04:04
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