Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include py.typed in wheel file #1648

Merged

Conversation

FlorentJeannot
Copy link
Contributor

@FlorentJeannot FlorentJeannot commented Jun 30, 2022

Resolves #1610

I have tweaked the setup.cfg file in order to add the py.typed file in the wheel (it was already packaged in the zip file). I also added the classifier Typing :: Typed.

I am not sure if include_package_data = true can have any unwanted side effect. So far it looks like it only added the missing py.typed file to the wheel.
Now using options.package_data.

I tested the changes in the wheel using the following code:

import pprint
from pathlib import Path
from zipfile import ZipFile

path = Path("path_to_dot_whl")
names = ZipFile(path).namelist()
pprint.pprint(names)

Before:

['piptools/__init__.py',
 'piptools/__main__.py',
 'piptools/cache.py',
 'piptools/exceptions.py',
 'piptools/locations.py',
 'piptools/logging.py',
 'piptools/resolver.py',
 'piptools/subprocess_utils.py',
 'piptools/sync.py',
 'piptools/utils.py',
 'piptools/writer.py',
 'piptools/_compat/__init__.py',
 'piptools/_compat/click.py',
 'piptools/_compat/pip_compat.py',
 'piptools/repositories/__init__.py',
 'piptools/repositories/base.py',
 'piptools/repositories/local.py',
 'piptools/repositories/pypi.py',
 'piptools/scripts/__init__.py',
 'piptools/scripts/compile.py',
 'piptools/scripts/sync.py',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/LICENSE',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/METADATA',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/WHEEL',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/entry_points.txt',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/top_level.txt',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/RECORD']

After:

['piptools/__init__.py',
 'piptools/__main__.py',
 'piptools/cache.py',
 'piptools/exceptions.py',
 'piptools/locations.py',
 'piptools/logging.py',
 'piptools/py.typed',
 'piptools/resolver.py',
 'piptools/subprocess_utils.py',
 'piptools/sync.py',
 'piptools/utils.py',
 'piptools/writer.py',
 'piptools/_compat/__init__.py',
 'piptools/_compat/click.py',
 'piptools/_compat/pip_compat.py',
 'piptools/repositories/__init__.py',
 'piptools/repositories/base.py',
 'piptools/repositories/local.py',
 'piptools/repositories/pypi.py',
 'piptools/scripts/__init__.py',
 'piptools/scripts/compile.py',
 'piptools/scripts/sync.py',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/LICENSE',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/METADATA',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/WHEEL',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/entry_points.txt',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/top_level.txt',
 'pip_tools-6.2.1.dev152+g1e05d00.d20220630.dist-info/RECORD']
Contributor checklist
  • Provided the tests for the changes.
  • Assure PR title is short, clear, and good to be included in the user-oriented changelog
Maintainer checklist
  • Assure one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@FlorentJeannot FlorentJeannot force-pushed the include-py-typed-file-in-package branch 2 times, most recently from 0ac87d5 to c87d767 Compare June 30, 2022 08:38
@FlorentJeannot FlorentJeannot force-pushed the include-py-typed-file-in-package branch from 21acaec to 9df2918 Compare June 30, 2022 08:47
@atugushev
Copy link
Member

atugushev commented Jun 30, 2022

FYI I've canceled the CI jobs for this PR to get some air for the release build. Feel free to re-run after 6.8.0 release.

setup.cfg Outdated

[options]
python_requires = >=3.7
setup_requires = setuptools_scm
packages = find:
include_package_data = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include_package_data = true
package_data = piptools = py.typed

Mayby explicitly define certain package data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atugushev Thanks! This line was not working but I found how to do it properly here. That's much better than include_package_data.

Copy link

@AustinScola AustinScola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Member

@atugushev atugushev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ssbarnea ssbarnea added the bug Something is not working label Jul 18, 2022
@ssbarnea ssbarnea merged commit 4ad8b02 into jazzband:master Jul 18, 2022
@atugushev atugushev changed the title Include py.typed in wheel file Include py.typed in wheel file Jul 18, 2022
@atugushev atugushev added this to the 6.9.0 milestone Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package does not include the py.typed file?
4 participants