Skip to content

Add typing #283

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Add typing #283

wants to merge 13 commits into from

Conversation

cunla
Copy link
Member

@cunla cunla commented Jun 26, 2025

No description provided.

cunla added 8 commits June 11, 2025 11:17
# Conflicts:
#	scheduler/models/task.py
#	scheduler/tests/test_task_types/test_repeatable_task.py
#	uv.lock
@cunla cunla requested a review from Copilot June 26, 2025 13:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces comprehensive type annotations across the codebase, updating function signatures, variable declarations, and imports to improve type safety and align with mypy strict settings.

  • Added return and parameter type hints in worker, scheduler, views, models, and helper modules
  • Introduced new type aliases (PipelineType, refined generics) and # type: ignore where automatic typing was impractical
  • Updated pyproject.toml to enable strict mypy checks and added types- dependencies for YAML and croniter

Reviewed Changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scheduler/worker/worker.py Annotated worker methods and attributes
scheduler/worker/scheduler.py Added type hints to scheduler class and helpers
scheduler/worker/commands/worker_commands.py Typed command base class and registry management
scheduler/worker/commands/suspend_worker.py Added return on missing model and type hints
scheduler/worker/commands/stop_job.py Typed constructor and payload method
scheduler/worker/commands/kill_worker.py Refined process_command, added type annotations
scheduler/views/worker_views.py Suppressed typing errors on decorators
scheduler/views/queue_views.py Typed registry import and error handling changes
scheduler/views/queue_registry_actions.py Typed action helpers and exception handling
scheduler/views/queue_job_actions.py Typed enum membership and decorators
scheduler/views/job_views.py Expanded null-checks and type hints
scheduler/views/helpers.py Typed local variables and enqueue call
scheduler/types/settings_types.py Changed ASYNC from Optional to non-optional bool
scheduler/redis_models/worker.py Refined set_current_job_working_time signature
scheduler/redis_models/result.py Handled None worker_name and logging addition
scheduler/redis_models/registry/base_registry.py Changed get_last_timestamp return to int
scheduler/redis_models/base.py Updated classmethod signatures to use ConnectionType
scheduler/models/task.py Typed callbacks and admin display methods
scheduler/models/args.py Typed model save/delete/value methods
scheduler/management/commands/scheduler_worker.py Typed argument parsers and register_sentry
scheduler/management/commands/scheduler_stats.py Typed dashboard printing methods
scheduler/management/commands/run_job.py Typed command parser and handler
scheduler/management/commands/import.py Typed import logic and create_task_from_dict
scheduler/management/commands/export.py Typed export command
scheduler/management/commands/delete_failed_executions.py Typed CLI arguments
scheduler/helpers/utils.py Typed callable_func and import changes
scheduler/helpers/sentry_integration.py Added Sentry integration setup with type hints
scheduler/helpers/queues/queue_logic.py Introduced PipelineType and refined queue API
scheduler/helpers/queues/getters.py Typed connection builder and get_queue signature
scheduler/helpers/callback.py Typed callback invocation
scheduler/admin/ephemeral_models.py Typed admin permissions and views
pyproject.toml Configured strict mypy settings and deps
Comments suppressed due to low confidence (1)

scheduler/helpers/queues/queue_logic.py:162

  • Changed behavior: get_registry now raises NoSuchRegistryError instead of returning None, which is a breaking change for callers that expected None when a registry is missing. Please ensure all call sites handle the new exception.
    def get_registry(self, name: str) -> JobNamesRegistry:

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.

1 participant