Skip to content

Commit 5994c37

Browse files
committed
Fix configuration of package data
When setuptools 61+ is configured via pyproject.toml, it defaults to include-package-data = true, rather than the historical default of false. We don't want wheels to include random files from the package directory, in particular _convert.c. Disable include-package-data. In addition, we were inadvertently relying on setuptools 69+ experimental functionality to include .pyi and py.typed files in the sdist and .pyi files in wheels. Explicitly configure this. Move py.typed package-data declaration from setup.py to pyproject.toml. Fixes: b893ba2 ("Switch to PEP 621 project metadata") Fixes: a40175e ("_convert: add type hints") Fixes: 5f49c01 ("Export type hints from openslide package") Signed-off-by: Benjamin Gilbert <[email protected]>
1 parent 74d43b8 commit 5994c37

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include *.md
2+
global-include py.typed *.pyi
23
recursive-include doc *.py *.rst
34
recursive-include examples *.html *.js *.png *.py
45
recursive-include tests *.dcm *.png *.py *.svs *.tiff

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@ Documentation = "https://openslide.org/api/python/"
3838
Repository = "https://github.com/openslide/openslide-python"
3939

4040
[tool.setuptools]
41+
include-package-data = false
4142
packages = ["openslide"]
4243

4344
[tool.setuptools.dynamic]
4445
version = {attr = "openslide._version.__version__"}
4546

47+
[tool.setuptools.package-data]
48+
openslide = ["py.typed", "*.pyi"]
49+
4650
[tool.black]
4751
skip-string-normalization = true
4852
target-version = ["py38", "py39", "py310", "py311", "py312", "py313"]

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,4 @@
2121
# tag wheel for Limited API
2222
'bdist_wheel': {'py_limited_api': 'cp311'} if _abi3 else {},
2323
},
24-
package_data={
25-
'openslide': ['py.typed'],
26-
},
2724
)

0 commit comments

Comments
 (0)