python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.29k stars 433 forks source link

Include `py.typed` file in wheels #975

Closed AlexWaygood closed 1 year ago

AlexWaygood commented 1 year ago

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 commented 1 year ago

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[bot] commented 1 year ago

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           

:mega: Weโ€™re building smart automated test selection to slash your CI/CD build times. Learn more

AlexWaygood commented 1 year ago

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 commented 1 year ago

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

AlexWaygood commented 1 year ago

Confirmed that mypy recognises the library as having inline type annotations with the latest release ๐ŸŽ‰