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

add pep-561 marker file #58

Merged
merged 1 commit into from
May 22, 2020
Merged

Conversation

hoefling
Copy link
Contributor

@hoefling hoefling commented Apr 28, 2020

This PR adds PEP 561 support for watchgod. The rationale for this PR is that with the current 0.6 release, the type checks with mypy fail because watchgod doesn't report having type hints. To reproduce:

$ cat run.py  # the example from README
import asyncio
from watchgod.main import awatch

async def main() -> None:
   async for changes in awatch('/tmp'):
       print(changes)

asyncio.run(main())
$ pip install watchgod mypy
$ mypy run.py
run.py:2: error: Skipping analyzing 'watchgod.main': found module but no type hints or library stubs
run.py:2: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

The current workaround is to add the marker file manually:

$ touch $(python -c "import watchgod; print(watchgod.__path__[0])")/py.typed
$ mypy run.py
Success: no issues found in 1 source file

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #58 into master will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##            master       #58   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          280       280           
  Branches        29        29           
=========================================
  Hits           280       280           

@samuelcolvin samuelcolvin merged commit 20dca35 into samuelcolvin:master May 22, 2020
@samuelcolvin
Copy link
Owner

thanks so much.

@samuelcolvin
Copy link
Owner

oh, sorry I forgot, you need to set zip_safe=False for this to work I believe, I'll sort that now.

sthagen added a commit to sthagen/samuelcolvin-watchfiles that referenced this pull request May 24, 2020
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.

2 participants