-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The type hints are only checked for Python 3.7+ * New step in CI: mypy. Co-authored-by: Carlo Bertini <[email protected]>
- Loading branch information
1 parent
56b8bed
commit fb09e13
Showing
9 changed files
with
80 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .pubsub import publish as publish | ||
from .pubsub import publish_now as publish_now | ||
from .pubsub import subscribe as subscribe | ||
from .pubsub import unsubscribe as unsubscribe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import re | ||
from typing import Any | ||
|
||
from celery import Task, group | ||
from celery.result import AsyncResult | ||
|
||
class PubSubManager: | ||
subscribed: set[tuple[str, re.Pattern[str], Task[Any, Any]]] | ||
jobs: dict[str, group] | ||
def publish(self, topic: str, *args: Any, **kwargs: Any) -> AsyncResult[Any]: ... | ||
def publish_now( | ||
self, topic: str, *args: Any, **kwargs: Any | ||
) -> AsyncResult[Any]: ... | ||
def subscribe(self, topic: str, task: Task[Any, Any]) -> None: ... | ||
def unsubscribe(self, topic: str, task: Task[Any, Any]) -> None: ... | ||
def get_jobs(self, topic: str) -> group: ... | ||
|
||
def publish(topic: str, *args: Any, **kwargs: Any) -> AsyncResult[Any]: ... | ||
def publish_now(topic: str, *args: Any, **kwargs: Any) -> AsyncResult[Any]: ... | ||
def subscribe(topic: str, task: Task[Any, Any]) -> None: ... | ||
def unsubscribe(topic: str, task: Task[Any, Any]) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[mypy] | ||
strict = True | ||
# Only check files in the `celery_pubsub` package | ||
files = celery_pubsub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
pytest | ||
coverage==5.5 | ||
coverage==5.5 | ||
|
||
# Only for Python 3.7+ (also exclude pypy). | ||
celery-types==0.14.0; python_version >= '3.7' and implementation_name != 'pypy' | ||
mypy==1.0.0; python_version >= '3.7' and implementation_name != 'pypy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,15 +34,15 @@ def tests_require(): | |
setuptools.setup( | ||
name="celery-pubsub", | ||
packages=["celery_pubsub"], | ||
version="1.0.1", | ||
version="1.0.2", | ||
description="A Publish and Subscribe library for Celery", | ||
long_description=long_description(), | ||
long_description_content_type="text/markdown", | ||
author="Samuel GIFFARD", | ||
author_email="[email protected]", | ||
license="MIT", | ||
url="https://github.com/Mulugruntz/celery-pubsub", | ||
download_url="https://github.com/Mulugruntz/celery-pubsub/tarball/1.0.1", | ||
download_url="https://github.com/Mulugruntz/celery-pubsub/tarball/1.0.2", | ||
keywords=["celery", "publish", "subscribe", "pubsub"], | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
def celery_worker(): | ||
pass | ||
|
||
|
||
else: # pragma: no cover | ||
task = celery.shared_task | ||
|
||
|