Skip to content
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

add ignore marker file to default project searcher #10

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

mbway
Copy link
Collaborator

@mbway mbway commented Dec 6, 2024

Currently, the DefaultProjectFileSearcher is very conservative, but I think some changes it might provide a better experience for the majority of users.

I ran into a case where I had a package with a tests/ directory (containing only .py files) and I realised there was no built-in way to ignore this directory other than passing a custom ProjectFileSearcher to install() which is not ideal when working in a team.

With this change, a .maturin_hook_ignore file could be added to tests/ to have that directory ignored.

Additionally, I don't think there are many use cases for depending on .py files for the compiled part of a package, but it is very common to have .py files in the repository of a maturin package that do not need to trigger a rebuild.
If a package depends on .py files at compile time with include_str!() or similar then a custom ProjectFileSearcher can be passed, or the following can be put before calling install():

maturin_import_hook.project_importer.DefaultProjectFileSearcher.DEFAULT_SOURCE_EXCLUDED_FILE_EXTENSIONS.discard('.py')

@mbway mbway self-assigned this Dec 6, 2024
@mbway mbway requested a review from messense December 6, 2024 20:05
@messense messense merged commit 298c70c into PyO3:main Dec 7, 2024
5 checks passed
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.

2 participants