Skip to content

py.typed marker file not included in published wheel #257

Open
@jamesdow21

Description

@jamesdow21
Contributor

Related to #223

The changes from #224 should have resulted in the py.typed marker file being included in the published wheel (following the instructions in the setuptools docs and the example package included in PEP561

When I build the package locally, the file is included; however, the layout I get in the locally built wheel is slightly different than the published version, so there is definitely some configuration or setuptools/wheel version difference.

Activity

jamesdow21

jamesdow21 commented on Feb 26, 2025

@jamesdow21
ContributorAuthor

TL;DR: potential fix is to just change package_data={"redshift-connector": ... in setup.py to package_data={"redshift_connector": ...

What might be happening is that it is due to the "-" vs "_" in the package name at

https://github.com/aws/amazon-redshift-python-driver/blob/master/setup.py#L97

setup(
    name="redshift_connector",
    version=__version__,  # type: ignore

and
https://github.com/aws/amazon-redshift-python-driver/blob/master/setup.py#L131

    include_package_data=True,
    package_data={"redshift-connector": ["*.py", "*.crt", "LICENSE", "NOTICE", "py.typed"]},
    packages=find_packages(exclude=["test*"]),

I'm not all that familiar with using setuptools, so I'm not sure if the difference there matters (even though those normalize to the same name)

The setuptools docs include this section on how the different package data configuration options interact

To include some data file into the .whl:

(not exclude-package-data) and ((include-package-data and MANIFEST.in) or package-data)
In other words, the file should not be excluded by exclude-package-data (highest priority), AND should be either:

  1. selected by package-data; or
  2. selected by MANIFEST.in AND use include-package-data = true.

The current setup is trying to add any .crt files as well as the LICENSE, NOTICE, and py.typed files using the package_data option, but I don't see anything except the .crt files included in the published wheel

The MANIFEST.in is

include redshift_connector/files/*
recursive-include files *.crt

Since include_package_data is set to True, it seems that the package_data configuration is not being included (i.e. rule 1 is never true) and the only extra files being added are those from rule 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jamesdow21

        Issue actions

          py.typed marker file not included in published wheel · Issue #257 · aws/amazon-redshift-python-driver