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

chore: Enforce Mypy for non-tests #15757

Merged

Conversation

john-bodley
Copy link
Member

SUMMARY

Spit-and-polish Mypy pass which strictly enforces Mypy checks for all Python files except the tests module. Note previously the rigorous tests only applied to the superset module which meant scripts, etc. were excluded.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Jul 17, 2021

Codecov Report

Merging #15757 (3f2e70e) into master (32a5680) will decrease coverage by 0.19%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15757      +/-   ##
==========================================
- Coverage   76.89%   76.70%   -0.19%     
==========================================
  Files         984      984              
  Lines       51662    51627      -35     
  Branches     6991     6988       -3     
==========================================
- Hits        39724    39599     -125     
- Misses      11714    11805      +91     
+ Partials      224      223       -1     
Flag Coverage Δ
mysql 81.56% <100.00%> (?)
postgres 81.58% <100.00%> (ø)
python 81.67% <100.00%> (+0.04%) ⬆️
sqlite 81.19% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/common/query_object.py 90.14% <ø> (ø)
superset/databases/commands/validate.py 74.57% <ø> (ø)
superset/connectors/sqla/models.py 88.31% <100.00%> (ø)
superset/db_engine_specs/base.py 88.28% <100.00%> (ø)
superset/db_engine_specs/mysql.py 97.61% <100.00%> (+3.57%) ⬆️
superset/db_engine_specs/postgres.py 97.36% <100.00%> (ø)
superset/db_engine_specs/presto.py 83.36% <100.00%> (ø)
superset/initialization/__init__.py 87.91% <100.00%> (ø)
superset/models/slice.py 86.11% <100.00%> (ø)
superset/tasks/schedules.py 76.36% <100.00%> (ø)
... and 32 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 32a5680...3f2e70e. Read the comment docs.

@john-bodley john-bodley force-pushed the john-bodley--mypy-spit-and-polish branch 2 times, most recently from 541ddee to 5f39b6f Compare July 17, 2021 17:39
Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

lgtm with one comment

@@ -61,7 +63,7 @@ def send_email(
server.sendmail(sender_email, receiver_email, message)


def render_template(template_file: str, **kwargs) -> str:
def render_template(template_file: str, **kwargs: Any) -> str:
Copy link
Member

Choose a reason for hiding this comment

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

can kwargs be Dict[str, Any]?

Copy link
Member Author

@john-bodley john-bodley Jul 21, 2021

Choose a reason for hiding this comment

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

@etr2460 it's more nuanced than that. kwargs are mostly represented as Any elsewhere in the code base. I'll follow up with an additional PR which makes a sweep of the entire repo.

Also the declared type is not of kwargs but rather **kwargs so instead of Dict[str, Any] it should be the type of the value, thus Any is correct.

@john-bodley john-bodley force-pushed the john-bodley--mypy-spit-and-polish branch from 3f2e70e to 180ea2b Compare July 21, 2021 17:17
@john-bodley john-bodley merged commit ab4e3b9 into apache:master Jul 21, 2021
@john-bodley john-bodley deleted the john-bodley--mypy-spit-and-polish branch July 21, 2021 18:46
@john-bodley john-bodley mentioned this pull request Jul 21, 2021
8 tasks
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
Co-authored-by: John Bodley <john.bodley@airbnb.com>
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
Co-authored-by: John Bodley <john.bodley@airbnb.com>
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
Co-authored-by: John Bodley <john.bodley@airbnb.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants