Skip to content

Commit

Permalink
Fix configuration of package data
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bgilbert committed Oct 29, 2024
1 parent 74d43b8 commit 5994c37
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include *.md
global-include py.typed *.pyi
recursive-include doc *.py *.rst
recursive-include examples *.html *.js *.png *.py
recursive-include tests *.dcm *.png *.py *.svs *.tiff
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ Documentation = "https://openslide.org/api/python/"
Repository = "https://github.com/openslide/openslide-python"

[tool.setuptools]
include-package-data = false
packages = ["openslide"]

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

[tool.setuptools.package-data]
openslide = ["py.typed", "*.pyi"]

[tool.black]
skip-string-normalization = true
target-version = ["py38", "py39", "py310", "py311", "py312", "py313"]
Expand Down
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,4 @@
# tag wheel for Limited API
'bdist_wheel': {'py_limited_api': 'cp311'} if _abi3 else {},
},
package_data={
'openslide': ['py.typed'],
},
)

0 comments on commit 5994c37

Please sign in to comment.