-
Notifications
You must be signed in to change notification settings - Fork 54
Celery stubs improvements #210
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
base: main
Are you sure you want to change the base?
Conversation
Significantly expanded type stubs for the celery package: - Added many new modules: app/annotations, app/autoretry, app/backends, app/builtins, app/defaults, app/trace, apps/beat, apps/multi - Added backend stubs: arangodb, asynchronous, azureblockblob, cache, cassandra, consul, cosmosdbsql, couchbase, couchdb, dynamodb, elasticsearch, filesystem, gcs, mongodb, redis, rpc, s3 - Added bin stubs: amqp, base, beat, call, celery, control, events, graph, list, logtool, migrate, multi, purge, result, shell, upgrade, worker - Added concurrency stubs: asynpool, base, eventlet, gevent, prefork, solo, thread - Added worker stubs: components, consumer/*, control, heartbeat, loops, pidbox, request, state, strategy, worker - Added utils stubs: collections, debug, dispatch, functional, graph, imports, iso8601, log, nodenames, objects, serialization, term, text, threads, time, timer2 - Enhanced existing module type annotations with more complete signatures - Added @OverRide decorators for proper method override annotations
b0571fe to
e3460ff
Compare
| autofinalize: bool = True, | ||
| namespace: str | None = None, | ||
| strict_typing: bool = True, | ||
| broker_connection_retry: bool = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all these arguments really missing? Or is this a mistake? I assume that these arguments are actually present in kwargs, and if so, I think it would be more useful to explicitly mark them as keyword-only using *,.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Celery makes this kind of awkward, since it's not an explicit kwarg in the actual code. I guess keeping it makes more sense from a practical point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the other places. I have seen it in at least one other class. And, by the way, perhaps it would make sense to mark them with '*,'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
….apply_async Restore explicit keyword arguments for better IDE autocomplete support: - Celery.__init__: Add config kwargs (imports, broker_*, result_*, task_*, worker_*) - Celery._task_from_fun: Add autoretry and task option kwargs - Signature.apply_async: Add options kwargs (task_id, producer, link, countdown, etc.) Use keyword-only syntax (*,) to satisfy stubtest while still providing typed kwargs for IDE support.
ed8bf79 to
60d818d
Compare
| ) | ||
|
|
||
| current_app: Proxy[Celery] | ||
| current_task: Proxy[Task[Any, Any]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the 'Proxy' class is needed here. I think it would be better for typing if it were a type without a proxy.
Basically same as #207.
CI should pass if #207 and #209 are merged before this...