Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes include glob resolution so patterns work consistently when python-source is configured, for both sdist and wheel outputs.
Changes:
- Resolve include patterns relative to
pyproject.tomlfirst, then fall back topython-sourcewhen no matches are found. - Normalize wheel vs sdist target paths for matches found under
python-source. - Extract shared glob resolution + validation into
src/module_writer/glob.rsand update docs/schema.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/source_distribution.rs | Uses shared glob resolver and maps python-source matches back into sdist source layout. |
| src/pyproject_toml.rs | Updates rustdoc for include/exclude path resolution behavior. |
| src/module_writer/mod.rs | Uses shared glob resolver and normalizes wheel target paths for python-source. |
| src/module_writer/glob.rs | New shared glob resolution + validation helpers with unit tests. |
| maturin.schema.json | Updates schema descriptions for include/exclude resolution rules. |
| guide/src/config.md | Documents fallback behavior when python-source is set. |
02d8890 to
6bc7c6c
Compare
… wheel When `python-source` is set (e.g. `python-source = "src/python"`), include patterns like `include = ["pyfoo/bar.html"]` now work for both sdist and wheel targets. Previously, patterns were only resolved relative to `pyproject.toml`, so the file at `src/python/pyfoo/bar.html` would not be found. The fix tries the primary root (pyproject.toml dir) first, then falls back to `python_dir` if no files matched. For wheel, files inside `python_dir` are stripped to package-relative paths. For sdist, they are mapped back to preserve the source layout. Also fixes wheel include with explicit paths like `include = ["src/python/pyfoo/bar.html"]` which previously placed files at the wrong path in the wheel. Shared glob resolution logic is extracted into `src/module_writer/glob.rs` with input validation rejecting absolute paths and `.." components. Closes PyO3#2320
6bc7c6c to
159f188
Compare
f5a4566 to
f3eabca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
python-sourceis set (e.g.python-source = "src/python"), include patterns likeinclude = ["pyfoo/bar.html"]now work for both sdist and wheel targets. Previously, patterns were only resolved relative topyproject.toml, so the file atsrc/python/pyfoo/bar.htmlwould not be found.The fix tries the primary root (pyproject.toml dir) first, then falls back to
python_dirif no files matched. For wheel, files insidepython_dirare stripped to package-relative paths. For sdist, they are mapped back to preserve the source layout.Also fixes wheel include with explicit paths like
include = ["src/python/pyfoo/bar.html"]which previously placed files at the wrong path in the wheel.Shared glob resolution logic is extracted into
src/module_writer/glob.rswith input validation rejecting absolute paths and `.." components.Closes #2320