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

Use mypy for type checking #241

Closed
jacksonllee opened this issue Oct 16, 2020 · 3 comments
Closed

Use mypy for type checking #241

jacksonllee opened this issue Oct 16, 2020 · 3 comments
Assignees
Labels

Comments

@jacksonllee
Copy link
Collaborator

Add a new step to CircleCI builds for type checking by mypy. Changes needed:

  • Add mypy to requirements.txt. Use whatever the latest version is from this PyPI link.
  • Add a new step in .circleci/config.yml. This new step should have its name set to be Type checking, and should go just before the existing Lint step. This step should run the command mypy project/wikipron project/tests project/data.
  • Fix all mypy issues so that the CircleCI builds pass with the mypy step added.
  • Add an entry in CHANGELOG.md.

Guidelines for contributors

For reference, mypy 0.790 would find the following issues to be fixed across the codebase:

tests/test_data/__init__.py:23: error: The return type of a generator function should be "Generator" or one of its supertypes
tests/test_data/__init__.py:23: error: Argument 1 to "contextmanager" has incompatible type "Callable[[bool, str, str], str]"; expected "Callable[..., Iterator[<nothing>]]"
wikipron/extract/core.py:8: error: Skipping analyzing 'requests_html': found module but no type hints or library stubs
wikipron/extract/default.py:22: error: "Response" has no attribute "html"
wikipron/extract/vie.py:37: error: "Response" has no attribute "html"
wikipron/extract/tha.py:20: error: "Response" has no attribute "html"
wikipron/extract/shn.py:31: error: "Response" has no attribute "html"
wikipron/extract/lat.py:93: error: "Response" has no attribute "html"
wikipron/extract/lat.py:111: error: "Response" has no attribute "html"
wikipron/extract/lat.py:138: error: "Response" has no attribute "html"
wikipron/extract/lat.py:148: error: Incompatible types in assignment (expression has type "None", variable has type "Word")
wikipron/extract/khm.py:23: error: "Response" has no attribute "html"
wikipron/extract/khb.py:35: error: "Response" has no attribute "html"
wikipron/extract/jpn.py:41: error: "Response" has no attribute "html"
wikipron/extract/jpn.py:50: error: "Response" has no attribute "html"
wikipron/extract/cmn.py:27: error: "Response" has no attribute "html"
wikipron/config.py:8: error: Skipping analyzing 'iso639': found module but no type hints or library stubs
wikipron/config.py:9: error: Skipping analyzing 'segments': found module but no type hints or library stubs
wikipron/config.py:124: error: Incompatible return value type (got "Callable[[str], str]", expected "Callable[[Word], Word]")
wikipron/scrape.py:6: error: Skipping analyzing 'requests_html': found module but no type hints or library stubs
wikipron/scrape.py:57: error: Incompatible types in "yield" (actual type "Tuple[Any, str]", expected type "Tuple[Word, Pron]")
tests/test_wikipron/__init__.py:11: error: Argument 1 to "Config" has incompatible type "**Dict[str, str]"; expected "bool"
tests/test_wikipron/__init__.py:19: error: Module has no attribute "ConnectTimeout"
data/src/codes.py:30: error: Skipping analyzing 'iso639': found module but no type hints or library stubs
data/src/codes.py:90: error: Item "None" of "Optional[Match[Any]]" has no attribute "group"
tests/test_wikipron/test_scrape.py:3: error: Skipping analyzing 'pytest': found module but no type hints or library stubs
tests/test_wikipron/test_extract.py:1: error: Skipping analyzing 'pytest': found module but no type hints or library stubs
tests/test_wikipron/test_config.py:4: error: Skipping analyzing 'pytest': found module but no type hints or library stubs
tests/test_wikipron/test_config.py:5: error: Skipping analyzing 'requests_html': found module but no type hints or library stubs
tests/test_wikipron/test_languagecodes.py:3: error: Skipping analyzing 'iso639': found module but no type hints or library stubs
tests/test_wikipron/test_languagecodes.py:4: error: Skipping analyzing 'pytest': found module but no type hints or library stubs
tests/test_data/test_scrape.py:5: error: Skipping analyzing 'pytest': found module but no type hints or library stubs
tests/test_data/test_scrape.py:53: error: Need type annotation for 'dummy_tsv_path'
tests/test_data/test_scrape.py:54: error: Value of type "object" is not indexable
tests/test_data/test_scrape.py:57: error: Argument "config_settings" to "_build_scraping_config" has incompatible type "object"; expected "Dict[str, Any]"
@ben-fernandes-sw
Copy link
Contributor

Hey @jacksonllee !
I'd like to work on this. Could you assign it to me?

@jacksonllee
Copy link
Collaborator Author

I'd like to work on this. Could you assign it to me?

Hi @benfernandes, thank you for your interest in contributing! You've been assigned. :-)

@jacksonllee
Copy link
Collaborator Author

Resolved by #247.

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

No branches or pull requests

2 participants