aio-libs / aiopg

aiopg is a library for accessing a PostgreSQL database from the asyncio
http://aiopg.readthedocs.io
BSD 2-Clause "Simplified" License
1.39k stars 159 forks source link

add py.typed marker, to indicate this package provides type hints #878

Closed gjcarneiro closed 2 years ago

gjcarneiro commented 3 years ago

What do these changes do?

This package seems to to have type hints, but it is not signalling that it provides them. This adds the signal.

See PEP 561.

Are there changes in behavior for the user?

When doing type checking, aiopg is now consulted for typing information.

Related issue number

Checklist

codecov[bot] commented 3 years ago

Codecov Report

Merging #878 (cb4dd54) into master (e131396) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #878   +/-   ##
=======================================
  Coverage   93.32%   93.32%           
=======================================
  Files          12       12           
  Lines        1574     1574           
  Branches      187      187           
=======================================
  Hits         1469     1469           
  Misses         73       73           
  Partials       32       32           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e131396...cb4dd54. Read the comment docs.

andrew-chang-dewitt commented 2 years ago

I'd love to have py.typed for aiopg in my projects; is there anything I can do to help get this PR merged?

gjcarneiro commented 2 years ago

I'd love to have py.typed for aiopg in my projects; is there anything I can do to help get this PR merged?

FYI, in my (docker based) code I just patched it like this:

# https://github.com/aio-libs/aiopg/pull/878
RUN touch /app/env/lib/python3.8/site-packages/aiopg/py.typed

You'll have to possibly adjust the path to the correct location for your case, but once the py.typed file is created then mypy should start consulting aiopg for type annotations.

aklim007 commented 2 years ago

this library does not provide type hints completely. and now it broke Mypy

error: Call to untyped function "begin" in typed context [no-untyped-call] error: Call to untyped function "execute" in typed context [no-untyped-call]