Skip to content

Mypy types for autocomplete.py, args.py, config.py and curtsies.py #929

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

Merged
merged 10 commits into from
Oct 10, 2021

Conversation

thomasballinger
Copy link
Member

@thomasballinger thomasballinger commented Oct 7, 2021

mypy now checks the whole package... but only these 4 files have these pragmas which require functions to have type annotations:

# mypy: disallow_untyped_calls=True
# mypy: disallow_untyped_defs=True

The way to run this locally is

python3.9 -m mypy

but you need to install some things first:

python3.9 -m pip install types-backports types-requests types-setuptools types-toml types-pygments numpy watchdog twisted

You may also need to upgrade curtsies if you haven't installed it fresh because I made the types a little more lenient.

python3.9 -m pip install --upgrade curtsies

Running mypy in CI on this one file.
@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2021

Codecov Report

Merging #929 (3514a7d) into main (d9305d7) will increase coverage by 0.02%.
The diff coverage is 87.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #929      +/-   ##
==========================================
+ Coverage   68.02%   68.05%   +0.02%     
==========================================
  Files          61       61              
  Lines        9199     9229      +30     
==========================================
+ Hits         6258     6281      +23     
- Misses       2941     2948       +7     
Impacted Files Coverage Δ
bpython/config.py 87.75% <ø> (ø)
bpython/test/test_crashers.py 91.95% <0.00%> (ø)
bpython/urwid.py 0.00% <ø> (ø)
bpython/test/test_inspection.py 91.19% <50.00%> (ø)
bpython/cli.py 15.13% <75.00%> (ø)
bpython/curtsiesfrontend/repl.py 65.13% <75.00%> (+0.06%) ⬆️
bpython/curtsies.py 53.20% <81.81%> (+1.48%) ⬆️
bpython/repl.py 72.62% <87.50%> (+0.05%) ⬆️
bpython/autocomplete.py 85.92% <93.54%> (-0.47%) ⬇️
bpython/__init__.py 60.00% <100.00%> (ø)
... and 12 more

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 d9305d7...3514a7d. Read the comment docs.

@thomasballinger thomasballinger changed the title Mypy types for autocomplete.py Mypy types for autocomplete.py, args.py, config.py and curtsies.py Oct 9, 2021
Copy link
Contributor

@sebastinas sebastinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I just have some small comments which could be addressed before merging the branch. Optional[X] for return types is probably more of a style preference instead.

@thomasballinger thomasballinger merged commit 4d744ca into main Oct 10, 2021
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.

3 participants