Skip to content

Commit

Permalink
add mypy to [dev] deps and run it during the lint phase
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdanp committed Apr 28, 2024
1 parent 8d66de2 commit 4e96b03
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- run: |
sudo apt-get update
sudo apt-get remove libhashkit2 libmemcached11 || true
sudo apt-get install -y libmemcached-dev
- run: pip install tox
- run: tox -e lint

Expand Down
2 changes: 1 addition & 1 deletion dramatiq/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def send_with_options(
Message: The enqueued message.
"""
if isinstance(delay, timedelta):
delay = delay.total_seconds() * 1000
delay = int(delay.total_seconds() * 1000)

message = self.message_with_options(args=args, kwargs=kwargs, **options)
return self.broker.enqueue(message, delay=delay)
Expand Down
3 changes: 2 additions & 1 deletion dramatiq/middleware/current_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import contextvars
from typing import Optional

from .middleware import Middleware

Expand All @@ -37,7 +38,7 @@ class CurrentMessage(Middleware):
"""

_MESSAGE: contextvars.ContextVar[
dict
Optional[dict]
] = contextvars.ContextVar("_MESSAGE", default=None)

@classmethod
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def rel(*xs):
"flake8-bugbear",
"flake8-quotes",
"isort",
"mypy",

# Misc
"bumpversion",
Expand Down
9 changes: 3 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ commands=

[testenv:lint]
extras =
deps =
isort
flake8
flake8-bugbear
flake8-quotes
dev
commands=
flake8 {toxinidir}/dramatiq {toxinidir}/examples {toxinidir}/tests
isort -c dramatiq
isort -c {toxinidir}/dramatiq
mypy {toxinidir}/dramatiq {toxinidir}/tests

0 comments on commit 4e96b03

Please sign in to comment.