Skip to content

fix: declare sync_every and sync_every_tasks as class attributes, not properties - #217

Merged
kodiakhq[bot] merged 1 commit into
sbdchd:mainfrom
jamesrusso:fix/beat-sync-every-not-property
Mar 11, 2026
Merged

fix: declare sync_every and sync_every_tasks as class attributes, not properties#217
kodiakhq[bot] merged 1 commit into
sbdchd:mainfrom
jamesrusso:fix/beat-sync-every-not-property

Conversation

@jamesrusso

Copy link
Copy Markdown
Contributor

Summary

Scheduler.sync_every and Scheduler.sync_every_tasks are declared as @property in celery-stubs/beat.pyi, but in celery's source code (celery/beat.py lines 242-245) they are plain class attributes:

class Scheduler:
    sync_every = 3 * 60
    sync_every_tasks = None

This causes reportAssignmentType errors in pyright when subclasses override them as class variables, which is the intended usage pattern:

class MyScheduler(Scheduler):
    sync_every = 60  # error: Type "Literal[60]" is not assignable to declared type "property"

Fix

Changed both from @property to plain class attribute declarations:

# Before
@property
def sync_every(self) -> int: ...
@property
def sync_every_tasks(self) -> int | None: ...

# After
sync_every: int
sync_every_tasks: int | None

Related: #216

… properties

In celery's source (celery/beat.py), `sync_every` and `sync_every_tasks`
are plain class attributes (lines 242-245), not properties:

    class Scheduler:
        sync_every = 3 * 60
        sync_every_tasks = None

Declaring them as @Property in the stubs causes pyright
reportAssignmentType errors when subclasses override them as class
variables, which is the intended usage pattern.

@sbdchd sbdchd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you!

@sbdchd sbdchd added the automerge auto merge PRs using kodiak label Mar 11, 2026
@kodiakhq
kodiakhq Bot merged commit 078cce2 into sbdchd:main Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge auto merge PRs using kodiak

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants