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 file in wheels #975

Merged
merged 1 commit into from
Feb 28, 2023
Merged

Include py.typed file in wheels #975

merged 1 commit into from
Feb 28, 2023

Conversation

AlexWaygood
Copy link
Contributor

@AlexWaygood AlexWaygood commented Feb 28, 2023

#934 by @DenverCoder1 added inline type annotations and a py.typed file, which is great! Unfortunately, however, the py.typed file hasn't been included in wheels published to PyPI for v2.12.0. This means that if I pip install babel locally, mypy still doesn't recognise babel as a typed library. Running mypy on a file with just import babel in it results in this output from mypy (unless the typeshed types-babel package is installed):

test.py:1: error: Library stubs not installed for "babel"  [import]
test.py:1: note: Hint: "python3 -m pip install types-babel"
test.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

The fix is simple: just a one-line addition to setup.py.

Closes #795 (which should maybe have been closed after #934).

@akx
Copy link
Member

akx commented Feb 28, 2023

Is package_data merged with what MANIFEST.in brings in? If not, we'll just want include babel/py.typed in the manifest...

Nope, yep, this does exactly what it should 👍

@codecov
Copy link

codecov bot commented Feb 28, 2023

Codecov Report

Merging #975 (4743881) into master (f5bb5bf) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #975   +/-   ##
=======================================
  Coverage   90.91%   90.91%           
=======================================
  Files          25       25           
  Lines        4350     4350           
=======================================
  Hits         3955     3955           
  Misses        395      395           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@akx akx merged commit 287f731 into python-babel:master Feb 28, 2023
@AlexWaygood AlexWaygood deleted the include-py-typed branch February 28, 2023 13:50
@AlexWaygood
Copy link
Contributor Author

Thanks!

Is package_data merged with what MANIFEST.in brings in? If not, we'll just want include babel/py.typed in the manifest...

I... hope so. If I'm honest, I'm young enough that I've never maintained a project that uses a MANIFEST.in file or uses setuptools as a build backend (I generally just use hatchling).

@akx
Copy link
Member

akx commented Feb 28, 2023

@AlexWaygood Thanks again. Released in Babel 2.12.1, now on PyPI.

@AlexWaygood
Copy link
Contributor Author

Confirmed that mypy recognises the library as having inline type annotations with the latest release 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

This library should have type annotations
2 participants