Closed nylocx closed 3 days ago
Any chance someone could have a look at this? I currently manually edit my install to get it to work. I could try to create a PR for the change above, but I'm not sure if I am missing something important.
This issue is still bothering us and the "patch" I provided above is no longer working for projects with a src layout. After a short discussion with @finswimmer in Discord I created a minimal example to reproduce this issue.
The minimal example includes a Dockerfile that I used to verify the behavior. To reproduce run
docker build -t example .
docker run -it --rm example
This will put you in a bash shell where you can run
poetry build -vvv -f wheel
unzip -l dist/*.whl
poetry_cython_demo/cython_code.pyx
poetry_cython_demo/compiled/source.c
are included in the wheel and according to the excludes in the pyproject.toml they should't be part of the wheel.
exclude = ["src/poetry_cython_demo/compiled", "src/poetry_cython_demo/*.pyx", "poetry_cython_demo/compiled", "poetry_cython_demo/*.pyx"]
If you need more input please let me know.
I think I am hitting a similar issue in an example with scikit-build. The following commands (with Poetry version: 1.1.13, C++ compiler required)
git clone https://github.com/tueda/test-poetry-scikit-build.git
cd test-poetry-scikit-build
poetry install
poetry build -vvv
shows that the following files are included in both wheel
and sdist
:
- Adding: /home/tueda/tmp/test-poetry-scikit-build/hello/_hello.cpython-310-x86_64-linux-gnu.so
- Adding: /home/tueda/tmp/test-poetry-scikit-build/hello/_hello.cxx
while they are filtered out by tool.poetry.exclude
but selectively specified in tool.poetry.include
with the format
option:
include = [
{ path = "CMakeLists.txt", format = "sdist" },
{ path = "hello/**/*.cxx", format = "sdist" },
{ path = "hello/**/*.so", format = "wheel" },
]
exclude = [
"hello/**/*.cxx",
"hello/**/*.so",
]
Same here: the binaries are being included into sdist
and wheel
. Significant part of pyproject.toml
:
packages = [{ include = "hmmer" }]
exclude = [{ path = "hmmer/data/bin/*", format = "sdist" }]
include = [
{ path = "hmmer/data/bin/*", format = "wheel" },
{ path = "build_hmmer.py", format = "sdist" },
{ path = "build_hmmer.sh", format = "sdist" },
]
Files inside hmmer/data/bin/*
I cannot reproduce the behavior anymore with the minimal example given by @nylocx in https://github.com/python-poetry/poetry/issues/5441#issuecomment-1156251608
So I assume we have fixed it at some point.
If anyone disagree, feel free to leave a comment and a new minimal example to reproduce the issue.
It now works for my case above. Thanks!
[x] I am on the latest Poetry version.
[x] I have searched the issues of this repo and believe that this is not a duplicate.
[x] If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: Arch Linux x64 Kernel 5.17.1
Poetry version: 1.1.13, 1.2.0b1 and master
Link of a Gist with the contents of your pyproject.toml file: pyproject.toml
Issue
First thanks for this great project, can't be said too often.
This issue was partially fixed by the commit mentioned in https://github.com/python-poetry/poetry/issues/4711, but there is still a bug in poetry core (current master). https://github.com/python-poetry/poetry-core/blob/master/src/poetry/core/masonry/builders/wheel.py#L181-L184
This get the relative path after the
is_excluded
test but theis_excluded
function expects a path relative to the source root. So even if you ignore a file that is later build intobuild/lib*/
it is then copied into the wheel. This can be easily fixed by changing the order and doing it likeI hope I got it right, it is a bit hard without a debugger to get the application flow.
Kind regards, Alex