Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test-integrations-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ jobs:
- name: Setup Test Env
run: |
uv sync
- name: Test apscheduler
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-apscheduler"
- name: Test arq
run: |
set -x # print commands that are executed
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ ignore_missing_imports = true
module = "huey.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "apscheduler.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "openai.*"
ignore_missing_imports = true
Expand Down
5 changes: 5 additions & 0 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"python": ">=3.8",
"num_versions": 2,
},
"apscheduler": {
"package": "apscheduler",
# 4.x is a rewrite with a different API and isn't supported.
"include": "<4",
},
"arq": {
"package": "arq",
"deps": {
Expand Down
4 changes: 4 additions & 0 deletions scripts/populate_tox/package_dependencies.jsonl

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions scripts/populate_tox/releases.jsonl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scripts/split_tox_gh_actions/split_tox_gh_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"requests",
],
"Tasks": [
"apscheduler",
"arq",
"beam",
"celery",
Expand Down
22 changes: 22 additions & 0 deletions sentry_sdk/crons/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from datetime import timedelta, timezone
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from datetime import tzinfo
from typing import Optional, Tuple

from sentry_sdk._types import MonitorConfigSchedule, MonitorConfigScheduleUnit
Expand All @@ -27,3 +29,23 @@ def _get_interval_schedule(seconds: float) -> "Optional[MonitorConfigSchedule]":
"unit": unit,
}
return None


def _get_timezone_name(tz: "tzinfo") -> "Optional[str]":
"""
Return the IANA name of the timezone, or None if it has none.
"""
# zoneinfo and pytz
name = getattr(tz, "key", None) or getattr(tz, "zone", None)
if isinstance(name, str):
# tzlocal's zone when it can't find the system's.
return None if name == "local" else name

if isinstance(tz, timezone):
offset = tz.utcoffset(None)
if offset % timedelta(hours=1):
return None
hours = offset // timedelta(hours=1)
return "Etc/GMT%+d" % -hours if hours else "UTC"

return None
1 change: 1 addition & 0 deletions sentry_sdk/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def iter_default_integrations(
"aiohttp": (3, 4),
"aiomysql": (0, 3, 0),
"anthropic": (0, 16),
"apscheduler": (3, 3),
"ariadne": (0, 20),
"arq": (0, 23),
"asyncpg": (0, 23),
Expand Down
Loading
Loading