Skip to content

Restore symlinked Python source traversal#3168

Open
Bben01 wants to merge 1 commit intoPyO3:mainfrom
Bben01:codex/restore-symlinked-python-sources
Open

Restore symlinked Python source traversal#3168
Bben01 wants to merge 1 commit intoPyO3:mainfrom
Bben01:codex/restore-symlinked-python-sources

Conversation

@Bben01
Copy link
Copy Markdown

@Bben01 Bben01 commented May 1, 2026

Summary

Restore traversal of symlinked directories when maturin collects Python package sources for wheels and sdists.

I dont know if it was removed intentional or not. If it was, I could add some bool to the pyproject.toml that could toggle this behavior (and set the current default to false)

Why

In our team we package multiple Python packages that share some common code. We use symlinks for those shared directories and files so the source is maintained in one place instead of duplicated across package trees.

This worked previously (from what i remember - 1.7.0), but recent behavior no longer followed symlinked directories while building a pyo3 Rust + Python layout. Symlinked files were still included, but files inside symlinked directories were omitted from the wheel.

Fix

Use follow_links(true) when walking Python package sources for both wheel and sdist generation.

Validation

  • Confirmed the new regression test fails before the fix: linked_dir/nested.py is missing from the wheel.
  • Confirmed it passes after the fix with cargo test --test run -- pyo3_mixed_py_subdir_includes_symlinked_python_files.
  • Ran cargo fmt --all and git diff --check.

AI disclosure

Fix was written by codex 5.5

Follow symlinked directories when collecting Python package files for  wheels and source distributions.

This restores support for layouts that share Python code through symlinked package directories instead of duplicating files.
@Bben01 Bben01 marked this pull request as ready for review May 1, 2026 08:51
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