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

Maturin uses .gitignore from the incorrect context when used in out-of-project build environments such as conda #1911

Closed
1 of 2 tasks
jleibs opened this issue Jan 10, 2024 · 1 comment · Fixed by #2158
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@jleibs
Copy link

jleibs commented Jan 10, 2024

Bug Description

The PR #695 causes maturin to ignore files that are gitignored.

This generally makes sense when maturin is used in an isolated context. However, when a package-builder such as conda has it's own git-controlled environment, the package source itself is usually downloaded into a folder that is gitignored in the context of the outer environment.

Maturin then incorrectly ignores these files, which the original project never intended to ignore.

This leads to bugs and workarounds such as:

At a minimum we need an option to opt-out of this behavior.

Preferable would be for the pyproject.toml to explicitly point at a specific gitignore to be used for filtering the wheel rather than inferring it from the runtime environment.

Your maturin version (maturin --version)

1.3

Your Python version (python -V)

3.11

Your pip version (pip -V)

22.2

What bindings you're using

pyo3

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

Create a git project with a git-ignored folder.
Download a tgz source package for a maturin project into that git-ignored folder.
Build it with maturin.

@jameshilliard
Copy link
Contributor

I think #2158 should fix this.

arnout pushed a commit to buildroot/buildroot that referenced this issue Jul 26, 2024
The packages 'python-jsonschema-specifications', 'pydantic-core', and
likely other packages based on Python maturin silently stopped
installing files to the host and target directories after commit
a14c862.

A similar issue was reported by the Conda project[1]. It seems some
build tools scan for gitignore files to decide what files to build
and install.

I attempted various combinations of gitignore patterns including
mimicking the Conda project's gitignore[2], but the only thing that has
worked reliably is the original `/output` ignore in the root Buildroot
directory.

This reverts commit a14c862.

[1] PyO3/maturin#1911
[2] https://github.com/conda-forge/conda-smithy/blob/main/conda_smithy/feedstock_content/.gitignore
Reported-by: Bryan Brattlof <[email protected]>
Signed-off-by: Brandon Maier <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
@messense messense linked a pull request Jul 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants