Skip to content

poetry build not respecting git's ignore patterns when -f is specified #2910

@skgbanga

Description

@skgbanga

Hello,

I am on the latest poetry version (1.0.10) on a rhel7 box, and noticed a bizarre behavior related to poetry build.
Consider this simple project structure: (available at: https://github.com/skgbanga/Sandbox/tree/master/python/package)

$ tree -a
.
├── pyproject.toml
└── src
    └── mypackage
        ├── __init__.py
        ├── lib64
        │   └── something.so
        └── sample.py

Running poetry build -vvv on this results in:

$ poetry build -vvv 
Using virtualenv: ...
Building mypackage (0.1.0)
 - Building sdist
 - Adding: src/mypackage/__init__.py
 - Adding: src/mypackage/sample.py
 - Adding: pyproject.toml
 - Built mypackage-0.1.0.tar.gz

 - Building wheel
 - Adding: /tmp/tmptez5tyvj/mypackage-0.1.0/src/mypackage/__init__.py
 - Adding: /tmp/tmptez5tyvj/mypackage-0.1.0/src/mypackage/sample.py
 - Built mypackage-0.1.0-py3-none-any.whl

As you can see, it didn't package lib64/something.so.
This is okay because the documentation here says that:

If a VCS is being used for a package, the exclude field will be seeded with the VCS’ ignore settings (.gitignore for git for example).

My .gitignore does contain this section.

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

Now, consider this invocation

$ poetry build -vvv -f wheel
Using virtualenv: ...
Building mypackage (0.1.0)
 - Building wheel
 - Adding: ... src/mypackage/__init__.py
 - Adding: ... src/mypackage/lib64/something.so
 - Adding: ... src/mypackage/sample.py
 - Built mypackage-0.1.0-py3-none-any.whl

It now has packaged something.so when my understanding of the documentation says that it shouldn't have done so.

Metadata

Metadata

Assignees

Labels

area/build-systemRelated to PEP 517 packaging (see poetry-core)kind/bugSomething isn't working as expectedstatus/waiting-on-coreRequires changes to poetry-core first

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions