Can not exclude package data file only for the wheel
See original GitHub issueThere seems to be an issue when trying to exclude package data files of the wheel only.
Example project here: https://github.com/sinoroc/poetry-gh-2015
Project file structure:
$ tree Thing
Thing
├── CHANGELOG.rst
├── LICENSE.txt
├── pyproject.toml
├── README.rst
├── test
│ └── test_unit.py
└── thing
├── data
│ ├── file.all
│ ├── file.bin
│ ├── file.not
│ └── file.src
└── __init__.py
All files are in the git repository except *.bin data files (supposed to be a build artifact).
We want the *.src data files and CHANGELOG.rst in the sdist only. We want *.bin data files in the wheel only. We want *.all data files in both the sdist and the wheel. We do not want any of the .not data files in the distributions.
We also want the test package, but only in the sdist.
.gitignore
/thing/data/*.bin
pyproject.toml:
packages = [
{ include = 'thing' },
{ include = 'test', format = 'sdist' }
]
include = [
{ path = 'CHANGELOG.rst', format = 'sdist' },
{ path = 'thing/data/*.bin', format = 'wheel' },
{ path = 'thing/data/*.src', format = 'sdist' },
]
exclude = [
{ path = 'CHANGELOG.rst', format = 'wheel' },
{ path = 'thing/data/*.src', format = 'wheel' },
'thing/data/*.not',
]
Content of the sdist:
$ python3 -m tarfile -l dist/Thing-0.1.0.tar.gz
Thing-0.1.0/CHANGELOG.rst
Thing-0.1.0/LICENSE.txt
Thing-0.1.0/README.rst
Thing-0.1.0/pyproject.toml
Thing-0.1.0/test/test_unit.py
Thing-0.1.0/thing/__init__.py
Thing-0.1.0/thing/data/file.all
Thing-0.1.0/thing/data/file.src
Thing-0.1.0/setup.py
Thing-0.1.0/PKG-INFO
Content of the wheel:
$ python3 -m zipfile -l dist/Thing-0.1.0-py3-none-any.whl
File Name Modified Size
thing/__init__.py 1980-01-01 00:00:00 0
thing/data/file.all 1980-01-01 00:00:00 0
thing/data/file.bin 1980-01-01 00:00:00 0
thing/data/file.src 1980-01-01 00:00:00 0
thing-0.1.0.dist-info/LICENSE.txt 1980-01-01 00:00:00 8
thing-0.1.0.dist-info/WHEEL 2016-01-01 00:00:00 83
thing-0.1.0.dist-info/METADATA 2016-01-01 00:00:00 1515
thing-0.1.0.dist-info/RECORD 2016-01-01 00:00:00 577
Somehow the thing/data/file.src appears in the wheel, which is unexpected and not what we want.
Example project: https://github.com/sinoroc/poetry-gh-2015
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:15 (1 by maintainers)

Top Related StackOverflow Question
At the moment this syntax isn’t support.
excludemust be a list of path(globs). We should add the ability to work just likeinclude.fin swimmer
Yeah I guess the maintainers will be better at explaining this than me. I only just worked from my own understanding based on trial and error. Maybe the functionality of these needs better documentation.