Skip to content

Correct some mypy errors#8570

Merged
Nusnus merged 4 commits intocelery:mainfrom
rbtcollins:correct-mypy-errors
Oct 16, 2023
Merged

Correct some mypy errors#8570
Nusnus merged 4 commits intocelery:mainfrom
rbtcollins:correct-mypy-errors

Conversation

@rbtcollins
Copy link
Contributor

Description

Attempting to use Celery in a mypy enabled project we found that errors in Celery's type annotations prevent mypy running against our code. Basically this https://stackoverflow.com/questions/68114378/mypy-crashes-due-to-syntax-error-in-underlying-modules situation

This branch doesn't attempt to fully overhaul the annotations; it just makes it possible to

from celery import Celery
from celery.schedules import crontab

successfully.

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (4d18666) 87.46% compared to head (a7219e1) 87.46%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8570   +/-   ##
=======================================
  Coverage   87.46%   87.46%           
=======================================
  Files         148      148           
  Lines       18512    18512           
  Branches     3163     3163           
=======================================
  Hits        16192    16192           
  Misses       2032     2032           
  Partials      288      288           
Flag Coverage Δ
unittests 87.43% <100.00%> (ø)

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

Files Coverage Δ
celery/contrib/testing/worker.py 69.14% <100.00%> (ø)
celery/utils/collections.py 85.65% <100.00%> (ø)
celery/utils/saferepr.py 96.57% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nusnus
Copy link
Member

Nusnus commented Oct 16, 2023

Hey there - you can run tox -e lint to check lint issues locally :)

@rbtcollins
Copy link
Contributor Author

Hey there - you can run tox -e lint to check lint issues locally :)

Its been a while since I did a lot of Python; and tox wanted a manual SSH passphrase for some reason, then with tox -e lint gave:

tox -e lint
ROOT: will run in automatically provisioned tox, host /home/robertc/.pyenv/versions/3.9.6/envs/infrastructure/bin/python3.9 is missing [requires (has)]: tox-gh-actions
ROOT: provision> .tox/.tox/bin/python -m tox -e lint
ROOT: tox-gh-actions won't override envlist because tox is not running in GitHub Actions
lint: skipped because could not find python interpreter with spec(s): python3.11
  lint: SKIP (0.00 seconds)
  evaluation failed :( (0.61 seconds)

Anyhow, I think I've covered it all off.

@Nusnus Nusnus merged commit fcecf18 into celery:main Oct 16, 2023
@Nusnus
Copy link
Member

Nusnus commented Oct 16, 2023

Hey there - you can run tox -e lint to check lint issues locally :)

Its been a while since I did a lot of Python; and tox wanted a manual SSH passphrase for some reason, then with tox -e lint gave:

tox -e lint
ROOT: will run in automatically provisioned tox, host /home/robertc/.pyenv/versions/3.9.6/envs/infrastructure/bin/python3.9 is missing [requires (has)]: tox-gh-actions
ROOT: provision> .tox/.tox/bin/python -m tox -e lint
ROOT: tox-gh-actions won't override envlist because tox is not running in GitHub Actions
lint: skipped because could not find python interpreter with spec(s): python3.11
  lint: SKIP (0.00 seconds)
  evaluation failed :( (0.61 seconds)

Anyhow, I think I've covered it all off.

Hmmm.. I need to check that.

Anyway good job on the PR - merged! 🎉

@rbtcollins rbtcollins deleted the correct-mypy-errors branch October 16, 2023 18:26
@auvipy auvipy added this to the 5.3.x milestone Oct 17, 2023
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