Skip to content

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

@jleibs

Description

@jleibs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions