diff --git a/litellm/litellm_core_utils/duration_parser.py b/litellm/litellm_core_utils/duration_parser.py index f679817df9f..7d7d2c945b8 100644 --- a/litellm/litellm_core_utils/duration_parser.py +++ b/litellm/litellm_core_utils/duration_parser.py @@ -104,15 +104,16 @@ def get_next_standardized_reset_time( current_time: datetime, timezone_str: str = "UTC", reset_time_of_day: time = time(0, 0), + *, + elapsed_anchor: datetime | None = None, ) -> datetime: """ Get the next standardized reset time based on the duration. All durations will reset at predictable intervals, aligned from the current time: - Nd: If N=1, reset at the next `reset_time_of_day`; if N>1, reset every N days from now - - Nh: Every N hours, aligned to hour boundaries (e.g., 1:00, 2:00) - - Nm: Every N minutes, aligned to minute boundaries (e.g., 1:05, 1:10) - - Ns: Every N seconds, aligned to second boundaries + - Nh where N is a multiple of 24 (including `daily`): local midnight, N/24 days after today + - Other Nh/Nm/Ns: Fixed elapsed intervals, initially aligned to local day/hour/minute boundaries Parameters: - duration: Duration string (e.g. "30s", "30m", "30h", "30d") @@ -121,6 +122,8 @@ def get_next_standardized_reset_time( - reset_time_of_day: Wall-clock time the reset lands on for day/week/month durations (defaults to midnight). Ignored for sub-day durations, where a time-of-day is meaningless. + - elapsed_anchor: Saved reset instant for an existing elapsed-time schedule. + Without one, retain the local alignment used when creating a budget. Returns: - Next reset time at a standardized interval in the specified timezone @@ -147,11 +150,16 @@ def get_next_standardized_reset_time( elif unit == "w": return _handle_day_reset(current_time, base_midnight, value * 7, reset_time_of_day) elif unit == "h": - return _handle_hour_reset(current_time, base_midnight, value) + whole_days: Final = _whole_days_in_hours(value) + if whole_days is not None: + return _apply_time_of_day(base_midnight + timedelta(days=whole_days), time(0, 0)) + return _next_elapsed_reset(current_time, timedelta(hours=value), elapsed_anchor or base_midnight) elif unit == "m": - return _handle_minute_reset(current_time, base_midnight, value) + hour_start: Final = current_time.replace(minute=0, second=0, microsecond=0) + return _next_elapsed_reset(current_time, timedelta(minutes=value), elapsed_anchor or hour_start) elif unit == "s": - return _handle_second_reset(current_time, base_midnight, value) + minute_start: Final = current_time.replace(second=0, microsecond=0) + return _next_elapsed_reset(current_time, timedelta(seconds=value), elapsed_anchor or minute_start) elif unit == "mo": return _handle_month_reset(current_time, base_midnight, value, reset_time_of_day) else: @@ -198,10 +206,16 @@ def get_budget_window_end( def _shift_budget_window(duration: str, moment: datetime, direction: int) -> datetime: - boundary: Final = normalize_budget_window_start(moment) value, unit = _parse_duration(normalize_duration(duration)) + whole_days: Final = _whole_days_in_hours(value) if value is not None and unit == "h" else None + elapsed: Final = unit in ("h", "m", "s") and whole_days is None + boundary: Final = normalize_budget_window_start( + moment.astimezone(timezone.utc) if moment.tzinfo is not None and elapsed else moment + ) if value is None: return boundary + timedelta(days=direction) + if whole_days is not None: + return boundary + timedelta(days=direction * whole_days) match unit: case "mo": return _shift_months(boundary, direction * value) @@ -310,97 +324,17 @@ def _handle_day_reset( return _apply_time_of_day(base_midnight + timedelta(days=value), reset_time_of_day) -def _handle_hour_reset(current_time: datetime, base_midnight: datetime, value: int) -> datetime: - """Handle hour-based reset times.""" - # Handle zero value - immediate expiration - if value == 0: +def _whole_days_in_hours(hours: int) -> int | None: + return hours // 24 if hours > 0 and hours % 24 == 0 else None + + +def _next_elapsed_reset(current_time: datetime, interval: timedelta, anchor: datetime) -> datetime: + """Keep one UTC schedule across resets, including local hour/day changes.""" + if interval == timedelta(0): return current_time - - current_hour: Final = current_time.hour - current_minute: Final = current_time.minute - current_second: Final = current_time.second - current_microsecond: Final = current_time.microsecond - - # Calculate next hour aligned with the value - if current_minute == 0 and current_second == 0 and current_microsecond == 0: - next_hour = current_hour + value - (current_hour % value) if current_hour % value != 0 else current_hour + value - else: - next_hour = current_hour + value - (current_hour % value) if current_hour % value != 0 else current_hour + value - - # Handle overnight case - if next_hour >= 24: - return base_midnight + timedelta(hours=next_hour) - - return current_time.replace(hour=next_hour, minute=0, second=0, microsecond=0) - - -def _handle_minute_reset(current_time: datetime, base_midnight: datetime, value: int) -> datetime: - """Handle minute-based reset times.""" - # Handle zero value - immediate expiration - if value == 0: - return current_time - - current_hour: Final = current_time.hour - current_minute: Final = current_time.minute - current_second: Final = current_time.second - current_microsecond: Final = current_time.microsecond - - # Calculate next minute aligned with the value - if current_second == 0 and current_microsecond == 0: - next_minute = ( - current_minute + value - (current_minute % value) if current_minute % value != 0 else current_minute + value - ) - else: - next_minute = ( - current_minute + value - (current_minute % value) if current_minute % value != 0 else current_minute + value - ) - - # Handle hour rollover - next_hour = current_hour + (next_minute // 60) - next_minute = next_minute % 60 - - # Handle overnight case - if next_hour >= 24: - return base_midnight + timedelta(hours=next_hour, minutes=next_minute) - - return current_time.replace(hour=next_hour, minute=next_minute, second=0, microsecond=0) - - -def _handle_second_reset(current_time: datetime, base_midnight: datetime, value: int) -> datetime: - """Handle second-based reset times.""" - # Handle zero value - immediate expiration - if value == 0: - return current_time - - current_hour: Final = current_time.hour - current_minute: Final = current_time.minute - current_second: Final = current_time.second - current_microsecond: Final = current_time.microsecond - - # Calculate next second aligned with the value - if current_microsecond == 0: - next_second = ( - current_second + value - (current_second % value) if current_second % value != 0 else current_second + value - ) - else: - next_second = ( - current_second + value - (current_second % value) if current_second % value != 0 else current_second + value - ) - - # Handle minute rollover - additional_minutes: Final = next_second // 60 - next_second = next_second % 60 - next_minute = current_minute + additional_minutes - - # Handle hour rollover - next_hour = current_hour + (next_minute // 60) - next_minute = next_minute % 60 - - # Handle overnight case - if next_hour >= 24: - return base_midnight + timedelta(hours=next_hour, minutes=next_minute, seconds=next_second) - - return current_time.replace(hour=next_hour, minute=next_minute, second=next_second, microsecond=0) + utc_anchor: Final = _setup_timezone(anchor, "UTC")[0] + periods: Final = (current_time.astimezone(timezone.utc) - utc_anchor) // interval + 1 + return (utc_anchor + periods * interval).astimezone(current_time.tzinfo) def _handle_month_reset( diff --git a/litellm/proxy/common_utils/reset_budget_job.py b/litellm/proxy/common_utils/reset_budget_job.py index 519d98efed9..3e05f54ea78 100644 --- a/litellm/proxy/common_utils/reset_budget_job.py +++ b/litellm/proxy/common_utils/reset_budget_job.py @@ -637,7 +637,7 @@ def _window_spend_start( start: Final = ( get_annual_budget_window_start(next_reset_at, reset_settings.timezone) if is_annual_budget_duration(budget_duration) - else next_reset_at - timedelta(seconds=duration_in_seconds(budget_duration)) + else next_reset_at.astimezone(timezone.utc) - timedelta(seconds=duration_in_seconds(budget_duration)) ) return normalize_budget_window_start(start) except Exception as error: # noqa: BLE001 # duration_in_seconds raises bare exceptions on bad input @@ -1111,7 +1111,12 @@ class ResetBudgetJob: budget_resets=tuple( ( b.budget_id, - compute_budget_reset_at(budget_duration=b.budget_duration, settings=self.reset_settings), + compute_budget_reset_at( + budget_duration=b.budget_duration, + settings=self.reset_settings, + now=now, + previous_reset=b.budget_reset_at, + ), ) for b in budgets_to_reset if b.budget_id is not None and b.budget_id in windows and b.budget_duration is not None @@ -1910,12 +1915,11 @@ class ResetBudgetJob: budget_duration: Final = window.get("budget_duration") if not isinstance(reset_at_str, str) or not reset_at_str or not isinstance(budget_duration, str): return None - annual: Final = is_annual_budget_duration(budget_duration) saved_reset_at: Final = datetime.fromisoformat(reset_at_str.replace("Z", "+00:00")) if _as_utc(saved_reset_at) > _as_utc(now): return None return compute_budget_reset_at( - budget_duration=budget_duration, settings=reset_settings, now=now if annual else None + budget_duration=budget_duration, settings=reset_settings, now=now, previous_reset=saved_reset_at ) @staticmethod @@ -2174,7 +2178,8 @@ class ResetBudgetJob: item.budget_reset_at = compute_budget_reset_at( budget_duration=item.budget_duration, settings=reset_settings, - now=current_time if is_annual_budget_duration(item.budget_duration) else None, + now=current_time, + previous_reset=item.budget_reset_at, ) return item except Exception as e: diff --git a/litellm/proxy/common_utils/timezone_utils.py b/litellm/proxy/common_utils/timezone_utils.py index 2253966776b..6e01da9392c 100644 --- a/litellm/proxy/common_utils/timezone_utils.py +++ b/litellm/proxy/common_utils/timezone_utils.py @@ -64,7 +64,11 @@ def get_budget_reset_settings() -> BudgetResetSettings: def compute_budget_reset_at( - budget_duration: str, settings: BudgetResetSettings, now: datetime | None = None + budget_duration: str, + settings: BudgetResetSettings, + now: datetime | None = None, + *, + previous_reset: datetime | None = None, ) -> datetime: """Compute the next reset time for a budget duration using injected settings.""" return get_next_standardized_reset_time( @@ -72,6 +76,7 @@ def compute_budget_reset_at( current_time=now if now is not None else datetime.now(timezone.utc), timezone_str=settings.timezone, reset_time_of_day=settings.reset_time_of_day, + elapsed_anchor=previous_reset, ) @@ -84,13 +89,8 @@ def get_budget_reset_time(budget_duration: str) -> datetime: return compute_budget_reset_at(budget_duration, get_budget_reset_settings()) -def keeps_due_budget_reset( - requested_duration: str, stored_duration: str | None, stored_reset_at: datetime | None -) -> bool: - if stored_reset_at is None or requested_duration != stored_duration: - return False - stored_utc: Final = stored_reset_at if stored_reset_at.tzinfo else stored_reset_at.replace(tzinfo=timezone.utc) - return stored_utc <= datetime.now(timezone.utc) +def keeps_budget_reset(requested_duration: str, stored_duration: str | None, stored_reset_at: datetime | None) -> bool: + return stored_reset_at is not None and requested_duration == stored_duration def _is_persistable_budget_duration(budget_duration: str) -> bool: diff --git a/litellm/proxy/management_endpoints/budget_management_endpoints.py b/litellm/proxy/management_endpoints/budget_management_endpoints.py index 18f31b4e52b..53c088ceccd 100644 --- a/litellm/proxy/management_endpoints/budget_management_endpoints.py +++ b/litellm/proxy/management_endpoints/budget_management_endpoints.py @@ -15,7 +15,6 @@ All /budget management endpoints import math from collections.abc import Mapping from datetime import datetime, timezone -from types import MappingProxyType from typing import ( TYPE_CHECKING, Annotated, @@ -41,6 +40,7 @@ from litellm.proxy.common_utils.auth_cache_invalidation_pubsub import evict_and_ from litellm.proxy.common_utils.timezone_utils import ( get_budget_reset_settings, get_budget_reset_time, + keeps_budget_reset, ) from litellm.proxy.common_utils.user_api_key_cache import app_budget_cache_key from litellm.proxy.management_endpoints.common_utils import ( # noqa: F401 # legacy module exports @@ -94,28 +94,53 @@ async def _write_budget_update( data: Mapping[str, object], limits: tuple[BudgetLimit, ...] | None, ) -> "prisma_models.LiteLLM_BudgetTable | None": - if "budget_limits" not in data: + if "budget_limits" not in data and "budget_duration" not in data: return await BudgetRepository(prisma_client).table.update(where={"budget_id": budget_id}, data=data) async with prisma_client.tx() as tx_ctx: tx: Final = cast("_BudgetUpdateTx", tx_ctx) # cast-ok: transaction exposes the same table actions current: Final = await lock_budget_limits(tx, "LiteLLM_BudgetTable", budget_id) + duration: Final = data.get("budget_duration") + stored: Final = ( + await tx.litellm_budgettable.find_unique(where={"budget_id": budget_id}) + if isinstance(duration, str) and "budget_reset_at" not in data + else None + ) + reset_data: Final = ( + {"budget_reset_at": get_budget_reset_time(budget_duration=duration)} + if isinstance(duration, str) + and "budget_reset_at" not in data + and not keeps_budget_reset( + duration, + stored.budget_duration if stored is not None else None, + stored.budget_reset_at if stored is not None else None, + ) + else {"budget_reset_at": None} + if "budget_duration" in data and duration is None and "budget_reset_at" not in data + else {} + ) previous: Final = tuple( limit for window in current or () if (limit := _stored_budget_limit(window)) is not None ) - window_data: Final = budget_row_values( - { - "budget_limits": initialize_budget_limits( - carry_budget_limit_resets(limits, previous), - get_budget_reset_settings(), - datetime.now(timezone.utc), - ) - if limits is not None - else None - } + window_data: Final[Mapping[str, object]] = ( + budget_row_values( + { + "budget_limits": initialize_budget_limits( + carry_budget_limit_resets(limits, previous), + get_budget_reset_settings(), + datetime.now(timezone.utc), + ) + if limits is not None + else None + } + ) + if "budget_limits" in data + else {} ) if limits: await validate_budget_windows_update(tx, budget_id) - return await tx.litellm_budgettable.update(where={"budget_id": budget_id}, data={**data, **window_data}) + return await tx.litellm_budgettable.update( + where={"budget_id": budget_id}, data={**data, **window_data, **reset_data} + ) async def new_budget( @@ -272,22 +297,10 @@ async def update_budget( except ValueError as e: raise HTTPException(status_code=400, detail={"error": str(e)}) - # recompute budget_reset_at when the duration changes, unless the caller pinned a reset time explicitly - recomputed_reset_at: Final = ( - {"budget_reset_at": get_budget_reset_time(budget_duration=budget_obj.budget_duration)} - if budget_obj.budget_duration is not None and "budget_reset_at" not in budget_obj.model_fields_set - else MappingProxyType({"budget_reset_at": None}) - if "budget_duration" in budget_obj.model_fields_set - and budget_obj.budget_duration is None - and "budget_reset_at" not in budget_obj.model_fields_set - else {} - ) - budget_obj_jsonified: Final = _WRITE_VALUES.validate_python( jsonify_object( { **budget_obj.model_dump(exclude_unset=True), - **recomputed_reset_at, "updated_by": user_api_key_dict.user_id or litellm_proxy_admin_name, } ) diff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.py index 5fbec41016a..b88dfb0887d 100644 --- a/litellm/proxy/management_endpoints/internal_user_endpoints.py +++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py @@ -54,7 +54,7 @@ from litellm.proxy.auth.password_policy import ( from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.common_utils.auth_cache_invalidation_pubsub import evict_and_broadcast from litellm.proxy.common_utils.openai_error_payload import openai_shaped_proxy_exception, proxy_exception_for -from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time, keeps_due_budget_reset +from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time, keeps_budget_reset from litellm.proxy.common_utils.user_api_key_cache import ( AUTH_OBJECTS_TARGET, object_permission_cache_key, @@ -1637,7 +1637,7 @@ async def _write_user_update( data: Mapping[str, object], original: LiteLLM_UserTable | None, ) -> Mapping[str, object] | None: - if "budget_limits" not in data: + if "budget_limits" not in data and "budget_duration" not in data: return cast( # cast-ok: the user branch returns a user_id/data dictionary "Mapping[str, object] | None", await prisma_client.update_data(user_id=user_id, data=data, table_name="user"), @@ -1704,7 +1704,7 @@ async def _update_single_user_helper( if ( "budget_reset_at" in non_default_values and isinstance(non_default_values["budget_duration"], str) - and keeps_due_budget_reset( + and keeps_budget_reset( non_default_values["budget_duration"], existing_user_row.budget_duration, existing_user_row.budget_reset_at, diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index 21df5251da7..98edb299d1d 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -92,7 +92,7 @@ from litellm.proxy.common_utils.customer_usage import ( from litellm.proxy.common_utils.key_expiry_alerts import key_expiry_alert_metadata_error from litellm.proxy.common_utils.openai_error_payload import openai_error_param, proxy_exception_for from litellm.proxy.common_utils.rbac_utils import check_org_admin_can_generate_keys -from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time, keeps_due_budget_reset +from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time, keeps_budget_reset from litellm.proxy.common_utils.user_api_key_cache import AUTH_OBJECTS_TARGET, UserApiKeyCache, is_user_key_cache_key from litellm.proxy.db.master_key_migration import reencrypt_stored_values from litellm.proxy.guardrails.guardrail_helpers import validate_guardrail_names @@ -3114,7 +3114,7 @@ async def _write_key_update( existing_key_row: LiteLLM_VerificationToken, include: Mapping[str, object] | None = None, ) -> "prisma_models.LiteLLM_VerificationToken | None": - if "budget_limits" not in data: + if "budget_limits" not in data and "budget_duration" not in data: return await VerificationTokenRepository(prisma_client).table.update( where={"token": hashed_token}, data=data, include=include ) @@ -3132,7 +3132,7 @@ async def _update_key_row( update_values: Mapping[str, object], existing_key_row: LiteLLM_VerificationToken, ) -> _KeyUpdateResult | None: - if "budget_limits" in update_values: + if "budget_limits" in update_values or "budget_duration" in update_values: hashed_token: Final = hash_token_if_needed(key) updated: Final = await _write_key_update( prisma_client, @@ -3227,7 +3227,7 @@ async def prepare_key_update_data( non_default_values["budget_reset_at"] = None elif isinstance(budget_duration, str) and len(budget_duration) > 0: non_default_values["budget_duration"] = budget_duration - if not keeps_due_budget_reset( + if not keeps_budget_reset( budget_duration, existing_key_row.budget_duration, existing_key_row.budget_reset_at ): non_default_values["budget_reset_at"] = get_budget_reset_time(budget_duration=budget_duration) @@ -7000,23 +7000,16 @@ def _validate_reset_spend_value(reset_to: object, key_in_db: LiteLLM_Verificatio def _window_with_reset_at( window: Mapping[str, object], stored_windows: Sequence[BudgetLimitEntry] ) -> Mapping[str, object]: - """A resubmitted window keeps its running period, so editing one window never restarts the others.""" + """A cap edit keeps the saved schedule, including a reset waiting for the job.""" duration: Final = str(window["budget_duration"]) - now: Final = datetime.now(timezone.utc) - open_reset_at: Final = next( - (w.reset_at for w in stored_windows if w.budget_duration == duration and _is_open_reset_at(w.reset_at, now)), + saved_reset_at: Final = next( + (w.reset_at for w in stored_windows if w.budget_duration == duration and w.reset_at is not None), None, ) - reset_at: Final = open_reset_at if open_reset_at is not None else get_budget_reset_time(budget_duration=duration) + reset_at: Final = saved_reset_at if saved_reset_at is not None else get_budget_reset_time(budget_duration=duration) return {**window, "reset_at": reset_at.isoformat()} -def _is_open_reset_at(reset_at: datetime | None, now: datetime) -> bool: - if reset_at is None: - return False - return (reset_at if reset_at.tzinfo is not None else reset_at.replace(tzinfo=timezone.utc)) > now - - def _advance_one_key_budget_window(window: Mapping[str, object]) -> Mapping[str, object]: """Restart one budget window from now, by advancing its `reset_at`. diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.py index d950745b962..2cc7e76958d 100644 --- a/litellm/proxy/management_endpoints/team_endpoints.py +++ b/litellm/proxy/management_endpoints/team_endpoints.py @@ -138,7 +138,7 @@ from litellm.proxy.common_utils.auth_cache_invalidation_pubsub import ( from litellm.proxy.common_utils.callback_utils import encrypt_callback_vars from litellm.proxy.common_utils.json_merge_patch import apply_json_merge_patch from litellm.proxy.common_utils.openai_error_payload import proxy_exception_for -from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time, keeps_due_budget_reset +from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time, keeps_budget_reset from litellm.proxy.common_utils.user_api_key_cache import ( UserApiKeyCache, team_membership_auth_cache_key, @@ -231,6 +231,7 @@ from litellm.proxy.management_helpers.team_metadata_validation import ( from litellm.proxy.management_helpers.utils import ( MemberWriteTx, add_new_member, + budget_windows_json, management_endpoint_wrapper, ) from litellm.proxy.spend_tracking.committed_spend import drop_committed_spend @@ -1549,7 +1550,7 @@ async def _write_team_update( max_budget_guard: _MaxBudgetGuard | None, original_windows: Sequence[BudgetLimitEntry] | None, ) -> "prisma_models.LiteLLM_TeamTable | None": - if "budget_limits" in team_update_data and prisma_client is not None: + if ("budget_limits" in team_update_data or "budget_duration" in team_update_data) and prisma_client is not None: async with prisma_client.tx() as tx_ctx: tx: Final = cast("_TeamUpdateTx", tx_ctx) # cast-ok: transaction exposes the same table actions rebased: Final = await rebase_budget_limits_update( @@ -3161,7 +3162,7 @@ async def patch_team( def _set_budget_reset_at(data: UpdateTeamRequest, updated_kv: dict, existing_team: LiteLLM_TeamTable) -> None: """Set budget_reset_at in updated_kv if budget_duration is provided.""" - if data.budget_duration is not None and not keeps_due_budget_reset( + if data.budget_duration is not None and not keeps_budget_reset( data.budget_duration, existing_team.budget_duration, existing_team.budget_reset_at ): updated_kv["budget_reset_at"] = get_budget_reset_time(budget_duration=data.budget_duration) @@ -3169,12 +3170,7 @@ def _set_budget_reset_at(data: UpdateTeamRequest, updated_kv: dict, existing_tea updated_kv["budget_reset_at"] = None if data.budget_limits is not None and len(data.budget_limits) > 0: - initialized_windows: Final = [] - for window in data.budget_limits: - w = window if isinstance(window, dict) else window.model_dump() - w["reset_at"] = get_budget_reset_time(budget_duration=w["budget_duration"]).isoformat() - initialized_windows.append(w) - updated_kv["budget_limits"] = json.dumps(initialized_windows) + updated_kv["budget_limits"] = budget_windows_json(data.budget_limits, existing_team.budget_limits) async def handle_update_object_permission( diff --git a/litellm/proxy/spend_tracking/budget_reservation.py b/litellm/proxy/spend_tracking/budget_reservation.py index 752baa7bcfe..443986efe14 100644 --- a/litellm/proxy/spend_tracking/budget_reservation.py +++ b/litellm/proxy/spend_tracking/budget_reservation.py @@ -139,7 +139,9 @@ def _customer_window_counter( if limit.reset_at is not None and limit.reset_at.tzinfo is None else limit.reset_at ) - standard_reset: Final = compute_budget_reset_at(limit.budget_duration, settings, now) + standard_reset: Final = compute_budget_reset_at( + limit.budget_duration, settings, now, previous_reset=configured_reset + ) reset_at: Final = configured_reset if configured_reset is not None and configured_reset > now else standard_reset start: Final = calendar_budget_window_start( limit.budget_duration, reset_at.astimezone(standard_reset.tzinfo) diff --git a/litellm/repositories/budget_limits_repository.py b/litellm/repositories/budget_limits_repository.py index 17025d66ae8..f169ec1e1a1 100644 --- a/litellm/repositories/budget_limits_repository.py +++ b/litellm/repositories/budget_limits_repository.py @@ -6,6 +6,7 @@ from typing import Final, Literal, Protocol, TypeAlias from pydantic import TypeAdapter, ValidationError from litellm.models.team import BudgetLimitEntry +from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time BudgetLimitsTable: TypeAlias = Literal[ "LiteLLM_VerificationToken", "LiteLLM_TeamTable", "LiteLLM_UserTable", "LiteLLM_BudgetTable" @@ -87,13 +88,14 @@ async def rebase_budget_limits_update( data: Mapping[str, object], ) -> Mapping[str, object]: """Lock and rebase the payload before the caller writes it in this same transaction.""" - if "budget_limits" not in data: - return data + scheduled: Final = await _rebase_budget_duration_update(transaction, table, row_id, data) + if "budget_limits" not in scheduled: + return scheduled current: Final = await lock_budget_limits(transaction, table, row_id) - raw: Final = data["budget_limits"] + raw: Final = scheduled["budget_limits"] requested: Final = _WINDOWS.validate_json(raw) if isinstance(raw, str) else _WINDOWS.validate_python(raw) if not requested or current is None: - return data + return scheduled before: Final = MappingProxyType( { original_duration: window @@ -111,5 +113,31 @@ async def rebase_budget_limits_update( ) rebased: Final = tuple(_rebase_window(window, before, after) for window in requested) if rebased == requested: + return scheduled + return {**scheduled, "budget_limits": json.dumps(rebased)} + + +async def _rebase_budget_duration_update( + transaction: BudgetLimitsTransaction, + table: BudgetLimitsTable, + row_id: str, + data: Mapping[str, object], +) -> Mapping[str, object]: + if "budget_duration" not in data: return data - return {**data, "budget_limits": json.dumps(rebased)} + rows: Final = await transaction.query_raw( + f'SELECT budget_duration, budget_reset_at FROM "{table}" WHERE "{_ID_COLUMNS[table]}" = $1::text FOR UPDATE', + row_id, + ) + current: Final[Mapping[str, object]] = rows[0] if rows else {} + duration: Final = data["budget_duration"] + if ( + isinstance(duration, str) + and duration == current.get("budget_duration") + and current.get("budget_reset_at") is not None + ): + return {key: value for key, value in data.items() if key != "budget_reset_at"} + return { + **data, + "budget_reset_at": get_budget_reset_time(duration) if isinstance(duration, str) else None, + } diff --git a/pyproject.toml b/pyproject.toml index 2e5284c0570..0072384a81f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -255,6 +255,7 @@ dev = [ "vcrpy==8.2.1", "pytest-recording==0.13.4", "nvidia-riva-client==2.16.0", + "time-machine==2.19.0", ] e2e-dev = [ "playwright==1.61.0", @@ -298,6 +299,7 @@ ci = [ # The Riva tests serve NVIDIA's own message definitions, which checks # LiteLLM's hand-written copy of them on every run. "nvidia-riva-client==2.16.0", + "time-machine==2.19.0", "Pillow==12.3.0; python_version == '3.10'", "Pillow==13.0.0; python_version >= '3.11'", # Azure batch E2E tests still import psycopg2 directly. diff --git a/tests/unit/litellm_core_utils/test_duration_parser.py b/tests/unit/litellm_core_utils/test_duration_parser.py index c0b86594da5..ca9b608f03f 100644 --- a/tests/unit/litellm_core_utils/test_duration_parser.py +++ b/tests/unit/litellm_core_utils/test_duration_parser.py @@ -1,5 +1,5 @@ import unittest -from datetime import datetime, time, timezone +from datetime import datetime, time, timedelta, timezone from typing import Final from unittest.mock import patch from zoneinfo import ZoneInfo @@ -553,3 +553,143 @@ def test_a_month_starting_now_matches_duration_in_seconds(): if __name__ == "__main__": unittest.main() + + +@pytest.mark.parametrize("duration", ("1h", "60m", "3600s")) +@pytest.mark.parametrize( + "end", + ("2026-11-01T06:30:00Z", "2026-11-01T07:30:00Z", "2026-03-08T07:30:00Z"), +) +def test_elapsed_window_bounds_do_not_depend_on_passing_the_zone_separately(duration: str, end: str) -> None: + zone: Final = ZoneInfo("America/New_York") + reset: Final = datetime.fromisoformat(end).astimezone(zone) + start: Final = datetime.fromisoformat(end) - timedelta(hours=1) + + assert get_budget_window_start(duration, reset).astimezone(timezone.utc) == start + assert get_budget_window_end(duration, start, zone.key, reset_at=reset) == reset.astimezone(timezone.utc) + assert get_budget_window_end(duration, start, zone.key) == reset.astimezone(timezone.utc) + + +@pytest.mark.parametrize("duration", ("1h", "60m", "3600s")) +@pytest.mark.parametrize( + "now", + ("2026-11-01T05:15:00Z", "2026-11-01T06:15:00Z", "2026-03-08T06:45:00Z", "2026-03-08T07:15:00Z"), +) +def test_scheduled_elapsed_window_contains_now_through_both_dst_transitions(duration: str, now: str) -> None: + instant: Final = datetime.fromisoformat(now) + end: Final = get_next_standardized_reset_time(duration, instant, "America/New_York") + start: Final = get_budget_window_start(duration, end) + + assert start.astimezone(timezone.utc) <= instant < end.astimezone(timezone.utc) + assert end.astimezone(timezone.utc) - start.astimezone(timezone.utc) == timedelta(hours=1) + + +@pytest.mark.parametrize("duration", ("12h", "5h", "90m", "45s")) +@pytest.mark.parametrize( + "now,zone", + ( + ("2026-11-01T05:59:40Z", "America/New_York"), + ("2026-03-08T06:59:40Z", "America/New_York"), + ("2026-04-04T14:59:40Z", "Australia/Lord_Howe"), + ("2026-10-03T15:29:40Z", "Australia/Lord_Howe"), + ), +) +@pytest.mark.parametrize("saved_schedule", (False, True)) +def test_elapsed_schedule_never_shortens_a_later_allowance( + duration: str, now: str, zone: str, saved_schedule: bool +) -> None: + current: Final = datetime.fromisoformat(now) + anchor: Final = datetime(2026, 1, 1, 4, 17, tzinfo=timezone.utc) if saved_schedule else None + interval: Final = timedelta(seconds=duration_in_seconds(duration)) + first: Final = get_next_standardized_reset_time( + duration, current, zone, elapsed_anchor=anchor + ).astimezone(timezone.utc) + assert first - interval <= current < first + for offset in range(6): + boundary: Final = first + offset * interval + following: Final = get_next_standardized_reset_time( + duration, boundary, zone, elapsed_anchor=boundary + ).astimezone(timezone.utc) + assert following - boundary == interval + + +@pytest.mark.parametrize( + "duration,zone,expected", + ( + ("45m", "UTC", "2026-07-15T10:45:00Z"), + ("5h", "UTC", "2026-07-15T15:00:00Z"), + ("daily", "Asia/Tokyo", "2026-07-16T00:00:00+09:00"), + ("1h", "Asia/Kolkata", "2026-07-15T16:00:00+05:30"), + ("24h", "America/New_York", "2026-07-16T00:00:00-04:00"), + ("1d", "Asia/Tokyo", "2026-07-16T00:00:00+09:00"), + ("1mo", "UTC", "2026-08-01T00:00:00Z"), + ), +) +def test_new_schedules_keep_their_local_alignment(duration: str, zone: str, expected: str) -> None: + now: Final = datetime(2026, 7, 15, 10, 17, tzinfo=timezone.utc) + + assert get_next_standardized_reset_time(duration, now, zone) == datetime.fromisoformat(expected) + + +@pytest.mark.parametrize( + "duration,boundary,expected", + ( + ("45m", "2026-07-15T11:30:00Z", "2026-07-15T12:15:00Z"), + ("5h", "2026-07-16T01:00:00Z", "2026-07-16T06:00:00Z"), + ("45s", "2026-07-15T10:18:30Z", "2026-07-15T10:19:15Z"), + ), +) +def test_saved_elapsed_schedules_do_not_shorten_at_local_unit_rollover( + duration: str, boundary: str, expected: str +) -> None: + saved_reset: Final = datetime.fromisoformat(boundary) + + assert get_next_standardized_reset_time( + duration, saved_reset, "UTC", elapsed_anchor=saved_reset + ) == datetime.fromisoformat(expected) + + +@pytest.mark.parametrize("duration", ("24h", "daily")) +@pytest.mark.parametrize( + "zone,now,expected", + ( + ("Asia/Tokyo", "2026-07-15T10:17:00Z", "2026-07-16T00:00:00+09:00"), + ("Asia/Kolkata", "2026-07-15T10:17:00Z", "2026-07-16T00:00:00+05:30"), + ("America/New_York", "2026-07-15T10:17:00Z", "2026-07-16T00:00:00-04:00"), + ("UTC", "2026-07-15T10:17:00Z", "2026-07-16T00:00:00+00:00"), + ("America/New_York", "2026-11-01T05:30:00Z", "2026-11-02T00:00:00-05:00"), + ("America/New_York", "2026-11-01T06:30:00Z", "2026-11-02T00:00:00-05:00"), + ("America/New_York", "2026-03-08T06:30:00Z", "2026-03-09T00:00:00-04:00"), + ), +) +def test_whole_day_hour_durations_reset_at_local_midnight(duration: str, zone: str, now: str, expected: str) -> None: + current: Final = datetime.fromisoformat(now) + reset: Final = get_next_standardized_reset_time( + duration, current, zone, time(1, 30), elapsed_anchor=datetime(2020, 1, 1, 7, 13, tzinfo=timezone.utc) + ) + start: Final = get_budget_window_start(duration, reset) + previous_midnight: Final = datetime( + current.astimezone(ZoneInfo(zone)).year, current.astimezone(ZoneInfo(zone)).month, + current.astimezone(ZoneInfo(zone)).day, tzinfo=ZoneInfo(zone), + ) + + assert reset == datetime.fromisoformat(expected) + assert start.astimezone(timezone.utc) == previous_midnight.astimezone(timezone.utc) + assert start.astimezone(timezone.utc) <= current < reset.astimezone(timezone.utc) + assert get_budget_window_end(duration, start, zone) == reset.astimezone(timezone.utc) + + +@pytest.mark.parametrize( + "duration,expected", + (("48h", "2026-07-17T00:00:00+09:00"), ("168h", "2026-07-22T00:00:00+09:00"), ("720h", "2026-08-14T00:00:00+09:00")), +) +def test_multi_day_hour_durations_count_local_days_from_today(duration: str, expected: str) -> None: + reset: Final = get_next_standardized_reset_time(duration, datetime(2026, 7, 15, 10, 17, tzinfo=timezone.utc), "Asia/Tokyo") + + assert reset == datetime.fromisoformat(expected) + + +def test_zero_hours_still_expires_immediately() -> None: + now: Final = datetime(2026, 7, 15, 10, 17, tzinfo=timezone.utc) + + assert get_next_standardized_reset_time("0h", now, "Asia/Tokyo") == now diff --git a/tests/unit/proxy/common_utils/test_reset_budget_job.py b/tests/unit/proxy/common_utils/test_reset_budget_job.py index 9f08aadbe40..0aa9c4c4c04 100644 --- a/tests/unit/proxy/common_utils/test_reset_budget_job.py +++ b/tests/unit/proxy/common_utils/test_reset_budget_job.py @@ -9,10 +9,12 @@ from datetime import datetime, timedelta, timezone from datetime import time as dt_time from typing import Any, Dict, Final, List, Optional, TypeVar, cast from unittest.mock import ANY, AsyncMock, MagicMock, patch +from zoneinfo import ZoneInfo import httpx import prisma import pytest +from pydantic import TypeAdapter from litellm.constants import ( PROXY_BUDGET_RESCHEDULER_MIN_TIME, @@ -32,7 +34,7 @@ from litellm.proxy.common_utils.timezone_utils import BudgetResetSettings from litellm.proxy.management_endpoints.budget_management_endpoints import update_budget from litellm.proxy.spend_tracking.budget_reservation import get_budget_window_start from litellm.proxy.utils import PrismaClient -from litellm.redis.stores.spend_counters import user_window_counter +from litellm.redis.stores.spend_counters import SpendCounterStore, user_window_counter from litellm.repositories.budget_repository import BudgetRepository from tests.unit.proxy.db.fake_prisma_engine import engine_call from tests.unit.redis.stores.spend_counters_double import FakeSpendCounters @@ -1271,9 +1273,7 @@ def _run_reset_at_fixed_now(job, fixed_now): """Run the budget-table reset with `now` pinned for reset-time math.""" from unittest.mock import patch - with patch("litellm.proxy.common_utils.timezone_utils.datetime") as mock_dt: - mock_dt.now.return_value = fixed_now - mock_dt.side_effect = lambda *args, **kwargs: datetime(*args, **kwargs) + with patch(f"{__name__}._FROZEN_NOW", fixed_now): asyncio.run(job.reset_budget_for_litellm_budget_table()) @@ -4577,12 +4577,24 @@ class _EndUserLedger: self.advances = 0 self.stale_due_budgets: list[types.SimpleNamespace] | None = None replica: Final = [types.SimpleNamespace(**vars(budget)) for budget in self.budgets.values()] + + async def find_stored_budget(*, where: Mapping[str, str]) -> types.SimpleNamespace | None: + return next((budget for budget in replica if budget.budget_id == where["budget_id"]), None) + self.client = types.SimpleNamespace( + tx=self._transaction, writer_db=types.SimpleNamespace( - litellm_budgettable=types.SimpleNamespace(find_many=self._find_budgets), + litellm_budgettable=types.SimpleNamespace( + find_many=self._find_budgets, + find_unique=lambda where: _async_value(self.budgets.get(where["budget_id"])), + update=self._write_budget, + ), + tx=self._transaction, + query_raw=AsyncMock(return_value=[]), ), db=types.SimpleNamespace( litellm_budgettable=types.SimpleNamespace( + find_unique=find_stored_budget, find_many=lambda where: _async_value( [budget for budget in replica if _row_matches(vars(budget), where)] ), @@ -4603,6 +4615,10 @@ class _EndUserLedger: get_data=self._due_budgets, ) + @asynccontextmanager + async def _transaction(self) -> AsyncIterator[types.SimpleNamespace]: + yield self.client.writer_db + def spend(self) -> dict[str, _Cell]: return {user_id: row["spend"] for user_id, row in self.rows.items()} @@ -6241,3 +6257,98 @@ async def test_reset_budget_for_litellm_team_members_called(): assert len(team_member_writes) == 1 assert team_member_writes[0]["where"]["budget_id"]["in"] == ["budget1"] assert team_member_writes[0]["data"] == {"spend": 0} + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "duration,saved,expected", + ( + ("45m", "2026-07-15T11:30:00Z", "2026-07-15T12:15:00Z"), + ("5h", "2026-07-16T01:00:00Z", "2026-07-16T06:00:00Z"), + ("45s", "2026-07-15T10:18:30Z", "2026-07-15T10:19:15Z"), + ), +) +async def test_scalar_and_inline_elapsed_resets_keep_a_full_interval( + duration: str, saved: str, expected: str +) -> None: + boundary: Final = datetime.fromisoformat(saved) + now: Final = boundary + timedelta(seconds=1) + settings: Final = BudgetResetSettings() + key: Final = LiteLLM_VerificationToken( + token="interval-key", spend=10, max_budget=10, budget_duration=duration, budget_reset_at=boundary + ) + + scalar: Final = await ResetBudgetJob._reset_budget_for_key(key, now, settings) + inline: Final = ResetBudgetJob._next_window_reset( + {"budget_duration": duration, "reset_at": saved}, now, settings + ) + + assert scalar is not None + assert scalar.spend == 0 + assert scalar.budget_reset_at == datetime.fromisoformat(expected) + assert inline == scalar.budget_reset_at + + +async def _reset_inline_window( + window: Mapping[str, object], row_id: str, store: SpendCounterStore, now: datetime, settings: BudgetResetSettings +) -> Mapping[str, object]: + client: Final = _window_prisma_client() + job: Final = ResetBudgetJob(proxy_logging_obj=MagicMock(), prisma_client=client, reset_settings=settings) + source: Final = next(source for source in _WINDOW_SOURCES if source.table == "LiteLLM_VerificationToken") + await job._reset_window_row(source, row_id, (window,), now, store) + writes: Final = _window_cas_writes(client) + return TypeAdapter(tuple[dict[str, object], ...]).validate_json(writes[0][3])[0] if writes else window + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "now,previous_reset,expected", + ( + ("2026-11-01T05:15:00Z", "2026-11-01T05:00:00Z", "2026-11-01T06:00:00Z"), + ("2026-11-01T06:15:00Z", "2026-11-01T06:00:00Z", "2026-11-01T07:00:00Z"), + ), +) +async def test_scalar_and_inline_hourly_resets_follow_both_occurrences_of_the_hour( + now: str, previous_reset: str, expected: str +) -> None: + instant: Final = datetime.fromisoformat(now) + settings: Final = BudgetResetSettings(timezone="America/New_York") + key: Final = LiteLLM_VerificationToken( + token="hourly-key", spend=10.0, max_budget=10.0, budget_duration="1h", + budget_reset_at=datetime.fromisoformat(previous_reset), + ) + window: Final = {"budget_duration": "1h", "max_budget": 10.0, "reset_at": previous_reset} + client: Final = MagicMock(spec=PrismaClient) + client.db = MagicMock() + client.db.execute_raw = AsyncMock(return_value=1) + + scalar: Final = await ResetBudgetJob._reset_budget_for_key(key, instant, settings) + changed: Final = await _reset_inline_window(window, "hourly-key", FakeSpendCounters().store(), instant, settings) + + assert scalar is not None and scalar.budget_reset_at is not None + assert scalar.budget_reset_at.astimezone(timezone.utc) == datetime.fromisoformat(expected) + assert datetime.fromisoformat(str(changed["reset_at"])) == scalar.budget_reset_at.astimezone(timezone.utc) + assert get_budget_window_start(changed, settings) == datetime.fromisoformat(previous_reset) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("duration", ("24h", "daily")) +async def test_existing_daily_budgets_stay_on_local_midnight_after_fall_back(duration: str) -> None: + settings: Final = BudgetResetSettings(timezone="America/New_York") + zone: Final = ZoneInfo("America/New_York") + first: Final = datetime(2026, 11, 1, tzinfo=zone).astimezone(timezone.utc) + key: Final = LiteLLM_VerificationToken( + token="daily-key", spend=10.0, max_budget=10.0, budget_duration=duration, budget_reset_at=first, + ) + window: Final = {"budget_duration": duration, "max_budget": 10.0, "reset_at": first.isoformat()} + client: Final = MagicMock(spec=PrismaClient) + client.db = MagicMock() + client.db.execute_raw = AsyncMock(return_value=1) + for offset in range(4): + boundary: Final = datetime(2026, 11, 1 + offset, tzinfo=zone).astimezone(timezone.utc) + expected: Final = datetime(2026, 11, 2 + offset, tzinfo=zone).astimezone(timezone.utc) + scalar: Final = await ResetBudgetJob._reset_budget_for_key(key, boundary, settings) + changed: Final = await _reset_inline_window(window, "daily-key", FakeSpendCounters().store(), boundary, settings) + assert scalar is not None and scalar.budget_reset_at is not None + assert scalar.budget_reset_at.astimezone(timezone.utc) == expected + assert datetime.fromisoformat(str(changed["reset_at"])) == expected diff --git a/tests/unit/proxy/management_endpoints/test_budget_endpoints.py b/tests/unit/proxy/management_endpoints/test_budget_endpoints.py index 4926d700d49..f789ba3fc3e 100644 --- a/tests/unit/proxy/management_endpoints/test_budget_endpoints.py +++ b/tests/unit/proxy/management_endpoints/test_budget_endpoints.py @@ -3,7 +3,7 @@ import json import types from collections.abc import Mapping -from datetime import datetime, timedelta, timezone +from datetime import datetime, timedelta, timezone, tzinfo from typing import Final from unittest.mock import AsyncMock, MagicMock @@ -624,6 +624,69 @@ def _capture_update_data(mock_table): return captured +@pytest.mark.parametrize("duration", ("24h", "30d")) +@pytest.mark.parametrize("year", (2020, 2099)) +def test_shared_budget_cap_edit_keeps_the_saved_schedule( + client_and_mocks: tuple[TestClient, MagicMock, MagicMock], duration: str, year: int +) -> None: + client, _, table = client_and_mocks + table.find_unique = AsyncMock(return_value=types.SimpleNamespace( + budget_duration=duration, budget_reset_at=datetime(year, 7, 16, 4, tzinfo=timezone.utc), + )) + written: Final = _capture_update_data(table) + + response: Final = client.post( + "/budget/update", json={"budget_id": "saved-schedule", "max_budget": 20, "budget_duration": duration} + ) + + assert response.status_code == 200 + assert written["max_budget"] == 20 + assert "budget_reset_at" not in written + + +def test_daily_budget_edit_does_not_keep_a_monthly_reset_from_a_lagging_replica( + client_and_mocks: tuple[TestClient, MagicMock, MagicMock], + monkeypatch: pytest.MonkeyPatch, +) -> None: + from litellm.proxy.common_utils import timezone_utils + + client, database, reader_table = client_and_mocks + now: Final = datetime(2026, 11, 3, 5, 15, tzinfo=timezone.utc) + daily_reset: Final = datetime(2026, 11, 4, tzinfo=timezone.utc) + monthly_reset: Final = datetime(2026, 12, 1, tzinfo=timezone.utc) + + class FixedClock(datetime): + @classmethod + def now(cls, tz: tzinfo | None = None) -> datetime: + return now if tz is None else now.astimezone(tz) + + monkeypatch.setattr(timezone_utils, "datetime", FixedClock) + reader_table.find_unique.return_value = types.SimpleNamespace( + budget_duration="1d", + budget_reset_at=daily_reset, + ) + writer_table: Final = MagicMock() + writer_table.find_unique = AsyncMock( + return_value=types.SimpleNamespace( + budget_duration="30d", + budget_reset_at=monthly_reset, + ) + ) + + async def write(*, where: Mapping[str, object], data: Mapping[str, object]) -> Mapping[str, object]: + return {"budget_reset_at": monthly_reset, **where, **data} + + reader_table.update = AsyncMock(side_effect=write) + writer_table.update = AsyncMock(side_effect=write) + database.tx.return_value.__aenter__.return_value.litellm_budgettable = writer_table + + response: Final = client.post("/budget/update", json={"budget_id": "lagging-schedule", "budget_duration": "1d"}) + + assert response.status_code == 200, response.text + assert response.json()["budget_duration"] == "1d" + assert datetime.fromisoformat(response.json()["budget_reset_at"]) == daily_reset + + @pytest.mark.asyncio async def test_update_budget_recomputes_reset_at_when_duration_changes( client_and_mocks, diff --git a/tests/unit/proxy/management_endpoints/test_internal_user_endpoints.py b/tests/unit/proxy/management_endpoints/test_internal_user_endpoints.py index bd222cd32ec..de7f5c8808f 100644 --- a/tests/unit/proxy/management_endpoints/test_internal_user_endpoints.py +++ b/tests/unit/proxy/management_endpoints/test_internal_user_endpoints.py @@ -2605,12 +2605,12 @@ async def test_user_status_update_refreshes_cached_user( ("request_fields", "role_default_duration", "stored_reset_at", "moves_reset"), [ ({"budget_duration": "30d"}, None, datetime(2020, 1, 1, tzinfo=timezone.utc), False), - ({"budget_duration": "30d"}, None, datetime(2099, 1, 1, tzinfo=timezone.utc), True), + ({"budget_duration": "30d"}, None, datetime(2099, 1, 1, tzinfo=timezone.utc), False), ({"budget_duration": "7d"}, None, datetime(2020, 1, 1, tzinfo=timezone.utc), True), ({"user_role": LitellmUserRoles.INTERNAL_USER}, "30d", datetime(2020, 1, 1, tzinfo=timezone.utc), False), ], ) -async def test_user_update_keeps_a_due_budget_reset_when_the_duration_is_resent( +async def test_user_update_keeps_existing_budget_reset_when_the_duration_is_resent( mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch, request_fields: dict[str, object], @@ -2631,6 +2631,10 @@ async def test_user_update_keeps_a_due_budget_reset_when_the_duration_is_resent( prisma_client: Final = mocker.MagicMock() prisma_client.db.litellm_usertable.find_first = mocker.AsyncMock(return_value=saved_user) prisma_client.update_data = mocker.AsyncMock(return_value={"user_id": saved_user.user_id, "data": saved_user}) + prisma_client.jsonify_object = PrismaClient.jsonify_object.__get__(prisma_client) + transaction: Final = prisma_client.tx.return_value.__aenter__.return_value + transaction.query_raw = mocker.AsyncMock(return_value=[saved_user.model_dump()]) + transaction.litellm_usertable.upsert = mocker.AsyncMock(return_value=saved_user) mocker.patch( "litellm.proxy.proxy_server.prisma_client", prisma_client ) # test-quality-ok: substitute the database dependency @@ -2644,7 +2648,7 @@ async def test_user_update_keeps_a_due_budget_reset_when_the_duration_is_resent( user_api_key_dict=UserAPIKeyAuth(user_id="admin-spruce", user_role=LitellmUserRoles.PROXY_ADMIN), ) - written: Final = prisma_client.update_data.call_args.kwargs["data"] + written: Final = transaction.litellm_usertable.upsert.call_args.kwargs["data"]["update"] reset_at: Final = written.get("budget_reset_at") assert (isinstance(reset_at, datetime) and reset_at > datetime.now(timezone.utc)) is moves_reset assert ("budget_reset_at" in written) is moves_reset @@ -6202,3 +6206,30 @@ async def test_user_info_v2_without_budget_windows_reads_no_window_spend(mocker) assert response.budget_limits_usage is None get_current_spend.assert_not_awaited() + + +@pytest.mark.asyncio +@pytest.mark.parametrize("stored_duration,stored_reset,expected", [ + ("5h", "2026-07-15T15:00:00Z", "2026-07-15T10:45:00Z"), + ("45m", "2026-07-15T11:30:00Z", "2026-07-15T11:30:00Z"), + ("45m", "2026-07-15T10:00:00Z", "2026-07-15T10:00:00Z"), +]) +async def test_user_duration_edits_use_the_writers_current_schedule( + stored_duration: str, stored_reset: str, expected: str, +) -> None: + import time_machine + from litellm.proxy.management_endpoints.internal_user_endpoints import _write_user_update + from litellm.proxy.utils import PrismaClient + + stored: Final = {"budget_duration": stored_duration, "budget_reset_at": datetime.fromisoformat(stored_reset)} + database: Final = MagicMock() + database.jsonify_object = PrismaClient.jsonify_object.__get__(database) + transaction: Final = database.tx.return_value.__aenter__.return_value + transaction.query_raw = AsyncMock(return_value=[stored]) + transaction.litellm_usertable.upsert = AsyncMock(return_value=LiteLLM_UserTable(user_id="scalar-user")) + payload: Final = {"budget_duration": "45m", "budget_reset_at": datetime(2026, 7, 15, 10, 45, tzinfo=timezone.utc)} + with time_machine.travel("2026-07-15T10:17:00Z", tick=False): + await _write_user_update(database, "scalar-user", payload, None) + persisted: Final = {**stored, **transaction.litellm_usertable.upsert.call_args.kwargs["data"]["update"]} + assert persisted["budget_duration"] == "45m" + assert persisted["budget_reset_at"] == datetime.fromisoformat(expected) diff --git a/tests/unit/proxy/management_endpoints/test_key_management_endpoints.py b/tests/unit/proxy/management_endpoints/test_key_management_endpoints.py index 5592557e3e8..126f0bf0f30 100644 --- a/tests/unit/proxy/management_endpoints/test_key_management_endpoints.py +++ b/tests/unit/proxy/management_endpoints/test_key_management_endpoints.py @@ -2185,12 +2185,12 @@ async def test_update_key_end_user_budget_id_folds_into_metadata_and_survives_om [ ("30d", datetime(2020, 1, 1, tzinfo=timezone.utc), False), ("30d", datetime(2020, 1, 1), False), - ("30d", datetime(2099, 1, 1, tzinfo=timezone.utc), True), + ("30d", datetime(2099, 1, 1, tzinfo=timezone.utc), False), ("7d", datetime(2020, 1, 1, tzinfo=timezone.utc), True), ("30d", None, True), ], ) -async def test_update_key_keeps_a_due_budget_reset_when_the_duration_is_resent( +async def test_update_key_keeps_existing_budget_reset_when_the_duration_is_resent( stored_duration: str, stored_reset_at: datetime | None, moves_reset: bool ) -> None: existing_key: Final = LiteLLM_VerificationToken( @@ -2207,6 +2207,7 @@ async def test_update_key_keeps_a_due_budget_reset_when_the_duration_is_resent( assert ("budget_reset_at" in updated) is moves_reset + @pytest.mark.asyncio async def test_update_key_clears_end_user_budget_id_with_empty_string(): """Sending an empty end_user_budget_id detaches the key default without touching any budget row, @@ -2659,14 +2660,15 @@ async def test_prepare_key_update_data_keeps_a_resubmitted_window_mid_period(wee @pytest.mark.asyncio -async def test_prepare_key_update_data_restarts_a_resubmitted_window_whose_period_ended() -> None: - stale_reset_at: Final = datetime.now(timezone.utc) - timedelta(days=1) +async def test_prepare_key_update_data_leaves_due_windows_for_the_reset_job() -> None: + stale_reset_at: Final = datetime(2024, 7, 15, tzinfo=timezone.utc) windows: Final = await _updated_windows_by_duration( _key_with_weekly_window(stale_reset_at), [{"budget_duration": "7d", "max_budget": 50.0}] ) - assert datetime.fromisoformat(windows["7d"]["reset_at"]) > datetime.now(timezone.utc) + assert datetime.fromisoformat(windows["7d"]["reset_at"]) == stale_reset_at + @pytest.mark.asyncio @@ -7839,6 +7841,13 @@ async def _run_bulk_update_on_one_key( return_value=MagicMock(object_permission_id="objperm-bulk") ) mock_prisma_client.update_data = AsyncMock(return_value={"data": {"token": _BULK_UPDATE_TOKEN}}) + from litellm.proxy.utils import PrismaClient + + mock_prisma_client.jsonify_object = PrismaClient.jsonify_object.__get__(mock_prisma_client) + mock_prisma_client.tx = MagicMock() + transaction: Final = mock_prisma_client.tx.return_value.__aenter__.return_value + transaction.query_raw = AsyncMock(return_value=[key_in_db.model_dump()]) + transaction.litellm_verificationtoken.update = AsyncMock(return_value=key_in_db) _setup_update_key_mocks(monkeypatch, mock_prisma_client) if user_api_key_cache is not None: monkeypatch.setattr("litellm.proxy.proxy_server.user_api_key_cache", user_api_key_cache) @@ -7878,7 +7887,14 @@ async def _bulk_update_one_key(monkeypatch, item_payload: Mapping[str, object]) def _written_key_row(prisma: AsyncMock) -> Mapping[str, object]: - return prisma.update_data.call_args.kwargs["data"] + if prisma.update_data.call_args is not None: + return prisma.update_data.call_args.kwargs["data"] + written: Final = prisma.tx.return_value.__aenter__.return_value.litellm_verificationtoken.update.call_args.kwargs["data"] + assert isinstance(written["settings_updated_at"], datetime) + return { + **{key: value for key, value in written.items() if key != "settings_updated_at"}, + "metadata": json.loads(written["metadata"]), + } @pytest.mark.asyncio @@ -25246,3 +25262,63 @@ def test_public_key_requests_cannot_assign_the_server_owned_key_identity( ) -> None: request: Final = request_type.model_validate({"key": "key-reference", "key_id": "caller-supplied-identity"}) assert "key_id" not in request.model_dump(exclude_unset=True) + + +@pytest.mark.asyncio +async def test_key_cap_edit_retains_an_existing_elapsed_schedule() -> None: + existing: Final = LiteLLM_VerificationToken( + token="hashed", max_budget=10, budget_duration="24h", + budget_reset_at=datetime(2099, 7, 16, 4, tzinfo=timezone.utc), + ) + updated: Final = await prepare_key_update_data( + data=UpdateKeyRequest(key="sk-1", max_budget=20, budget_duration="24h"), existing_key_row=existing + ) + + assert updated["max_budget"] == 20 + assert "budget_reset_at" not in updated + + +@pytest.mark.asyncio +@pytest.mark.parametrize("writer", ["ordinary", "project", "soft_budget", "regeneration"]) +@pytest.mark.parametrize("stored_duration,stored_reset,expected", [ + ("5h", "2026-07-15T15:00:00Z", "2026-07-15T10:45:00Z"), + ("45m", "2026-07-15T11:30:00Z", "2026-07-15T11:30:00Z"), + ("45m", "2026-07-15T10:00:00Z", "2026-07-15T10:00:00Z"), +]) +async def test_key_duration_edits_use_the_writers_current_schedule( + writer: str, stored_duration: str, stored_reset: str, expected: str, +) -> None: + import time_machine + from litellm.proxy.management_endpoints.key_management_endpoints import ( + _update_key_row, _update_key_row_with_soft_budget, _write_key_update, + ) + from litellm.proxy.utils import PrismaClient + + stale: Final = LiteLLM_VerificationToken( + token="scalar-key", budget_duration="45m", budget_reset_at=datetime(2026, 7, 15, 10, 45, tzinfo=timezone.utc), + ) + stored: Final = {"budget_duration": stored_duration, "budget_reset_at": datetime.fromisoformat(stored_reset)} + database: Final = MagicMock() + database.jsonify_object = PrismaClient.jsonify_object.__get__(database) + tx: Final = database.tx.return_value.__aenter__.return_value + tx.query_raw = AsyncMock(return_value=[stored]) + tx.litellm_verificationtoken.update = AsyncMock(return_value=stale) + tx.litellm_verificationtoken.update_many = AsyncMock(return_value=1) + tx.litellm_verificationtoken.find_unique = AsyncMock(return_value=stale) + tx.litellm_budgettable.create = AsyncMock(return_value=SimpleNamespace(budget_id="scalar-budget")) + request: Final = UpdateKeyRequest(key=stale.token, budget_duration="45m", max_budget=50) + with time_machine.travel("2026-07-15T10:17:00Z", tick=False): + payload: Final = await prepare_key_update_data(request, stale) + if writer == "ordinary": + await _update_key_row(database, stale.token, payload, stale) + elif writer == "project": + await _update_key_row_assigning_project(database, stale.token, {**payload, "project_id": "p"}, stale) + elif writer == "soft_budget": + await _update_key_row_with_soft_budget(database, stale.token, request, payload, stale, "admin") + else: + await _write_key_update(database, stale.token, {**payload, "token": "rotated"}, stale) + write: Final = tx.litellm_verificationtoken.update_many if writer == "project" else tx.litellm_verificationtoken.update + persisted: Final = {**stored, **write.call_args.kwargs["data"]} + assert persisted["budget_duration"] == "45m" + assert persisted["budget_reset_at"] == datetime.fromisoformat(expected) + assert persisted["max_budget"] == 50 diff --git a/tests/unit/proxy/management_endpoints/test_team_endpoints.py b/tests/unit/proxy/management_endpoints/test_team_endpoints.py index 3783ee5f0e3..1bce322b077 100644 --- a/tests/unit/proxy/management_endpoints/test_team_endpoints.py +++ b/tests/unit/proxy/management_endpoints/test_team_endpoints.py @@ -3296,6 +3296,8 @@ async def test_upsert_team_member_budget_table_clears_duration_kept_budget(mock_ team_table = MagicMock(spec=LiteLLM_TeamTable) team_table.metadata = {"team_member_budget_id": "existing_budget_123"} + mock_db_client.tx.return_value.__aenter__.return_value = mock_db_client.db + mock_db_client.db.query_raw = AsyncMock(return_value=[]) mock_db_client.db.litellm_customermembertable.find_many = AsyncMock(return_value=[]) mock_db_client.db.litellm_customerteamtable.find_many = AsyncMock(return_value=[]) mock_db_client.db.litellm_customerorganizationtable.find_many = AsyncMock(return_value=[]) @@ -12308,6 +12310,8 @@ async def test_upsert_team_member_model_max_budget_updates_default_budget_and_ev budget_cache: Final = MagicMock() budget_cache.async_delete_cache = AsyncMock() prisma: Final = MagicMock() + prisma.tx.return_value.__aenter__.return_value = prisma.db + prisma.db.query_raw = AsyncMock(return_value=[]) prisma.db.litellm_customermembertable.find_many = AsyncMock(return_value=[]) prisma.db.litellm_customerteamtable.find_many = AsyncMock(return_value=[]) prisma.db.litellm_customerorganizationtable.find_many = AsyncMock(return_value=[]) @@ -12364,6 +12368,8 @@ async def test_update_team_clears_explicitly_null_member_model_budget_and_evicts updated.litellm_model_table = None update_budget_response: Final = MagicMock(budget_id="member-budget-1") prisma: Final = MagicMock() + prisma.tx.return_value.__aenter__.return_value = prisma.db + prisma.db.query_raw = AsyncMock(return_value=[]) prisma.db.litellm_customermembertable.find_many = AsyncMock(return_value=[]) prisma.db.litellm_customerteamtable.find_many = AsyncMock(return_value=[]) prisma.db.litellm_customerorganizationtable.find_many = AsyncMock(return_value=[]) @@ -12424,6 +12430,8 @@ async def test_update_team_persists_member_model_budget_to_default_budget_row( updated.litellm_model_table = None update_budget_response: Final = MagicMock(budget_id="member-budget-1") prisma: Final = MagicMock() + prisma.tx.return_value.__aenter__.return_value = prisma.db + prisma.db.query_raw = AsyncMock(return_value=[]) prisma.db.litellm_customermembertable.find_many = AsyncMock(return_value=[]) prisma.db.litellm_customerteamtable.find_many = AsyncMock(return_value=[]) prisma.db.litellm_customerorganizationtable.find_many = AsyncMock(return_value=[]) @@ -13621,12 +13629,12 @@ def test_set_budget_reset_at_sets_value_when_budget_duration_provided(): [ ("30d", datetime(2020, 1, 1, tzinfo=timezone.utc), False), ("30d", datetime(2020, 1, 1), False), - ("30d", datetime(2099, 1, 1, tzinfo=timezone.utc), True), + ("30d", datetime(2099, 1, 1, tzinfo=timezone.utc), False), ("7d", datetime(2020, 1, 1, tzinfo=timezone.utc), True), ("30d", None, True), ], ) -def test_set_budget_reset_at_keeps_a_due_reset_when_the_duration_is_resent( +def test_set_budget_reset_at_keeps_existing_reset_when_the_duration_is_resent( stored_duration: str, stored_reset_at: datetime | None, moves_reset: bool ) -> None: from litellm.proxy._types import UpdateTeamRequest @@ -20206,3 +20214,30 @@ async def test_team_info_reports_current_spend_per_budget_window(): window_duration="1d", window_start=datetime(2026, 8, 15, 0, 0, tzinfo=timezone.utc), ) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("stored_duration,stored_reset,expected", [ + ("5h", "2026-07-15T15:00:00Z", "2026-07-15T10:45:00Z"), + ("45m", "2026-07-15T11:30:00Z", "2026-07-15T11:30:00Z"), + ("45m", "2026-07-15T10:00:00Z", "2026-07-15T10:00:00Z"), +]) +async def test_team_duration_edits_use_the_writers_current_schedule( + stored_duration: str, stored_reset: str, expected: str, +) -> None: + import time_machine + from litellm.proxy.management_endpoints.team_endpoints import _write_team_update + from litellm.proxy.utils import PrismaClient + + stored: Final = {"budget_duration": stored_duration, "budget_reset_at": datetime.fromisoformat(stored_reset)} + database: Final = MagicMock() + database.jsonify_object = PrismaClient.jsonify_object.__get__(database) + transaction: Final = database.tx.return_value.__aenter__.return_value + transaction.query_raw = AsyncMock(return_value=[stored]) + transaction.litellm_teamtable.update = AsyncMock(return_value=LiteLLM_TeamTable(team_id="scalar-team")) + payload: Final = {"budget_duration": "45m", "budget_reset_at": datetime(2026, 7, 15, 10, 45, tzinfo=timezone.utc)} + with time_machine.travel("2026-07-15T10:17:00Z", tick=False): + await _write_team_update(database, "scalar-team", payload, None, None) + persisted: Final = {**stored, **transaction.litellm_teamtable.update.call_args.kwargs["data"]} + assert persisted["budget_duration"] == "45m" + assert persisted["budget_reset_at"] == datetime.fromisoformat(expected) diff --git a/tests/unit/proxy/spend_tracking/test_budget_reservation.py b/tests/unit/proxy/spend_tracking/test_budget_reservation.py index 0de72ffc367..c62bbf9305c 100644 --- a/tests/unit/proxy/spend_tracking/test_budget_reservation.py +++ b/tests/unit/proxy/spend_tracking/test_budget_reservation.py @@ -11,7 +11,7 @@ from fastapi import Request import litellm from litellm.caching import DualCache -from litellm.models.budget import LiteLLM_BudgetTable +from litellm.models.budget import BudgetLimit, LiteLLM_BudgetTable from litellm.proxy import proxy_server from litellm.proxy._types import ( LiteLLM_TeamMembership, @@ -20,6 +20,7 @@ from litellm.proxy._types import ( LiteLLM_UserTable, UserAPIKeyAuth, ) +from litellm.proxy.common_utils.timezone_utils import BudgetResetSettings from litellm.proxy.common_utils.user_api_key_cache import ( UserApiKeyCache, team_membership_reservation_cache_key, @@ -28,6 +29,7 @@ from litellm.proxy.spend_tracking.budget_reservation import ( _get_budget_counters, _get_team_member_budget_counter, count_request_input_tokens, + customer_window_counters, estimate_request_input_cost, estimate_request_max_cost, get_budget_window_start, @@ -790,3 +792,93 @@ def test_fixed_budget_window_requires_duration_and_reset_boundary(window: object from litellm.proxy.spend_tracking.budget_reservation import fixed_budget_window assert fixed_budget_window(window) is None + + +@pytest.mark.parametrize( + "duration,zone,expected", + ( + ("daily", "Asia/Tokyo", "2026-07-16T00:00:00+09:00"), + ("1h", "Asia/Kolkata", "2026-07-15T16:00:00+05:30"), + ("45m", "UTC", "2026-07-15T10:45:00Z"), + ("5h", "UTC", "2026-07-15T15:00:00Z"), + ), +) +def test_created_customer_windows_keep_local_alignment_and_full_intervals( + duration: str, zone: str, expected: str +) -> None: + from litellm.litellm_core_utils.duration_parser import duration_in_seconds + from litellm.models.budget import initialize_budget_limits + + now: Final = datetime(2026, 7, 15, 10, 17, tzinfo=timezone.utc) + settings: Final = BudgetResetSettings(timezone=zone) + limits: Final = initialize_budget_limits((BudgetLimit(budget_duration=duration, max_budget=10),), settings, now) + first: Final = datetime.fromisoformat(expected) + interval: Final = timedelta(seconds=duration_in_seconds(duration)) + + assert limits[0].reset_at == first + for period in range(3): + current: Final = first + period * interval + counter: Final = customer_window_counters( + "customer_team", "schedule-team", limits, now=current, reset_settings=settings + )[0] + assert counter.window_start == current + assert counter.reset_at == current + interval + + +@pytest.mark.parametrize( + "now,expected_start,expected_end", + ( + ("2026-11-01T05:15:00Z", "2026-11-01T05:00:00Z", "2026-11-01T06:00:00Z"), + ("2026-11-01T06:15:00Z", "2026-11-01T06:00:00Z", "2026-11-01T07:00:00Z"), + ("2026-03-08T06:45:00Z", "2026-03-08T06:00:00Z", "2026-03-08T07:00:00Z"), + ), +) +def test_new_customer_hourly_window_includes_current_usage_through_dst( + now: str, expected_start: str, expected_end: str +) -> None: + counter: Final = customer_window_counters( + "customer_team", + "hourly-team", + (BudgetLimit(budget_duration="1h", max_budget=1),), + now=datetime.fromisoformat(now), + reset_settings=BudgetResetSettings(timezone="America/New_York"), + )[0] + + assert counter.window_start == datetime.fromisoformat(expected_start) + assert counter.reset_at == datetime.fromisoformat(expected_end) + + +@pytest.mark.parametrize("days_after_reset", (0, 1, 2, 30)) +def test_expired_customer_elapsed_schedule_keeps_its_saved_anchor(days_after_reset: int) -> None: + saved_reset: Final = datetime(2026, 11, 1, 4, tzinfo=timezone.utc) + start: Final = saved_reset + timedelta(days=days_after_reset) + counter: Final = customer_window_counters( + "customer_team", "daily-team", + (BudgetLimit(budget_duration="12h", max_budget=1, reset_at=saved_reset),), + now=start + timedelta(minutes=1), + reset_settings=BudgetResetSettings(timezone="America/New_York"), + )[0] + + assert counter.window_start == start + assert counter.reset_at == start + timedelta(hours=12) + + +@pytest.mark.parametrize("duration", ("24h", "daily")) +@pytest.mark.parametrize( + "now,start,end", + ( + ("2026-11-01T04:01:00Z", "2026-11-01T04:00:00Z", "2026-11-02T05:00:00Z"), + ("2026-11-01T12:00:00Z", "2026-11-01T04:00:00Z", "2026-11-02T05:00:00Z"), + ("2026-11-02T05:01:00Z", "2026-11-02T05:00:00Z", "2026-11-03T05:00:00Z"), + ), +) +def test_expired_customer_daily_window_follows_local_midnight(duration: str, now: str, start: str, end: str) -> None: + counter: Final = customer_window_counters( + "customer_team", "daily-team", + (BudgetLimit(budget_duration=duration, max_budget=1, reset_at=datetime(2026, 11, 1, 4, tzinfo=timezone.utc)),), + now=datetime.fromisoformat(now), + reset_settings=BudgetResetSettings(timezone="America/New_York"), + )[0] + + assert counter.window_start == datetime.fromisoformat(start) + assert counter.reset_at == datetime.fromisoformat(end) diff --git a/uv.lock b/uv.lock index e526a18b055..529a49ed1c5 100644 --- a/uv.lock +++ b/uv.lock @@ -5250,6 +5250,7 @@ ci = [ { name = "pytest-codspeed" }, { name = "pytest-retry" }, { name = "tenacity" }, + { name = "time-machine" }, { name = "traceloop-sdk" }, { name = "tzdata" }, ] @@ -5288,6 +5289,7 @@ dev = [ { name = "responses" }, { name = "respx" }, { name = "ruff" }, + { name = "time-machine" }, { name = "tomli", marker = "python_full_version < '3.11'" }, { name = "types-boto3", extra = ["bedrock", "bedrock-agent", "bedrock-runtime", "kms", "s3", "sagemaker-runtime", "sts"] }, { name = "types-pyyaml" }, @@ -5501,6 +5503,7 @@ ci = [ { name = "pytest-codspeed", specifier = "==4.3.0" }, { name = "pytest-retry", specifier = "==1.7.0" }, { name = "tenacity", specifier = "==8.5.0" }, + { name = "time-machine", specifier = "==2.19.0" }, { name = "traceloop-sdk", specifier = "==0.34.0" }, { name = "tzdata", specifier = "==2026.2" }, ] @@ -5538,6 +5541,7 @@ dev = [ { name = "responses", specifier = "==0.26.0" }, { name = "respx", specifier = "==0.22.0" }, { name = "ruff", specifier = "==0.15.3" }, + { name = "time-machine", specifier = "==2.19.0" }, { name = "tomli", marker = "python_full_version < '3.11'", specifier = "==2.4.1" }, { name = "types-boto3", extras = ["bedrock", "bedrock-agent", "bedrock-runtime", "kms", "s3", "sagemaker-runtime", "sts"], specifier = "==1.43.30" }, { name = "types-pyyaml", specifier = "==6.0.12.20250915" }, @@ -11023,6 +11027,94 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/35/5e/9b01afd037bfa22a0033963fa091e0f75b6fb15cd85bffb42ff86e697323/tiktoken-0.14.0-cp315-cp315t-win_amd64.whl", hash = "sha256:561e7580f84a79859af1ef6f676968e9030fcc3fe195700b15235bca64f009c9", size = 987929, upload-time = "2026-08-17T19:49:38.947Z" }, ] +[[package]] +name = "time-machine" +version = "2.19.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "python-dateutil" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f8/a4/1b5fdd165f61b67f445fac2a7feb0c655118edef429cd09ff5a8067f7f1d/time_machine-2.19.0.tar.gz", hash = "sha256:7c5065a8b3f2bbb449422c66ef71d114d3f909c276a6469642ecfffb6a0fcd29", size = 14576, upload-time = "2025-08-19T17:22:08.402Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9d/8f/19125611ebbcb3a14da14cd982b9eb4573e2733db60c9f1fbf6a39534f40/time_machine-2.19.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b5169018ef47206997b46086ce01881cd3a4666fd2998c9d76a87858ca3e49e9", size = 19659, upload-time = "2025-08-19T17:20:30.062Z" }, + { url = "https://files.pythonhosted.org/packages/74/da/9b0a928321e7822a3ff96dbd1eae089883848e30e9e1b149b85fb96ba56b/time_machine-2.19.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:85bb7ed440fccf6f6d0c8f7d68d849e7c3d1f771d5e0b2cdf871fa6561da569f", size = 15157, upload-time = "2025-08-19T17:20:31.931Z" }, + { url = "https://files.pythonhosted.org/packages/36/ff/d7e943422038f5f2161fe2c2d791e64a45be691ef946020b20f3a6efc4d4/time_machine-2.19.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:a3b12028af1cdc09ccd595be2168b7b26f206c1e190090b048598fbe278beb8e", size = 32860, upload-time = "2025-08-19T17:20:33.241Z" }, + { url = "https://files.pythonhosted.org/packages/fc/80/2b0f1070ed9808ee7da7a6da62a4a0b776957cb4d861578348f86446e778/time_machine-2.19.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c261f073086cf081d1443cbf7684148c662659d3d139d06b772bfe3fe7cc71a6", size = 34510, upload-time = "2025-08-19T17:20:34.221Z" }, + { url = "https://files.pythonhosted.org/packages/ef/b4/48038691c8d89924b36c83335a73adeeb68c884f5a1da08a5b17b8a956f3/time_machine-2.19.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:011954d951230a9f1079f22b39ed1a3a9abb50ee297dfb8c557c46351659d94d", size = 36204, upload-time = "2025-08-19T17:20:35.163Z" }, + { url = "https://files.pythonhosted.org/packages/37/2e/60e8adb541df195e83cb74b720b2cfb1f22ed99c5a7f8abf2a9ab3442cb5/time_machine-2.19.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:b0f83308b29c7872006803f2e77318874eb84d0654f2afe0e48e3822e7a2e39b", size = 34936, upload-time = "2025-08-19T17:20:36.61Z" }, + { url = "https://files.pythonhosted.org/packages/5e/72/e8cee59c6cd99dd3b25b8001a0253e779a286aa8f44d5b40777cbd66210b/time_machine-2.19.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:39733ef844e2984620ec9382a42d00cccc4757d75a5dd572be8c2572e86e50b9", size = 32932, upload-time = "2025-08-19T17:20:37.901Z" }, + { url = "https://files.pythonhosted.org/packages/2c/eb/83f300d93c1504965d944e03679f1c943a923bce2d0fdfadef0e2e22cc13/time_machine-2.19.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f8db99f6334432e9ffbf00c215caf2ae9773f17cec08304d77e9e90febc3507b", size = 34010, upload-time = "2025-08-19T17:20:39.202Z" }, + { url = "https://files.pythonhosted.org/packages/e1/77/f35f2500e04daac5033a22fbfd17e68467822b8406ee77966bf222ccaa26/time_machine-2.19.0-cp310-cp310-win32.whl", hash = "sha256:72bf66cd19e27ffd26516b9cbe676d50c2e0b026153289765dfe0cf406708128", size = 17121, upload-time = "2025-08-19T17:20:40.108Z" }, + { url = "https://files.pythonhosted.org/packages/db/df/32d3e0404be1760a64a44caab2af34b07e952bfe00a23134fea9ddba3e8a/time_machine-2.19.0-cp310-cp310-win_amd64.whl", hash = "sha256:46f1c945934ce3d6b4f388b8e581fce7f87ec891ea90d7128e19520e434f96f0", size = 17957, upload-time = "2025-08-19T17:20:41.079Z" }, + { url = "https://files.pythonhosted.org/packages/66/df/598a71a1afb4b509a4587273b76590b16d9110a3e9106f01eedc68d02bb2/time_machine-2.19.0-cp310-cp310-win_arm64.whl", hash = "sha256:fb4897c7a5120a4fd03f0670f332d83b7e55645886cd8864a71944c4c2e5b35b", size = 16821, upload-time = "2025-08-19T17:20:41.967Z" }, + { url = "https://files.pythonhosted.org/packages/1d/ed/4815ebcc9b6c14273f692b9be38a9b09eae52a7e532407cc61a51912b121/time_machine-2.19.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5ee91664880434d98e41585c3446dac7180ec408c786347451ddfca110d19296", size = 19342, upload-time = "2025-08-19T17:20:43.207Z" }, + { url = "https://files.pythonhosted.org/packages/ee/08/154cce8b11b60d8238b0b751b8901d369999f4e8f7c3a5f917caa5d95b0b/time_machine-2.19.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ed3732b83a893d1c7b8cabde762968b4dc5680ee0d305b3ecca9bb516f4e3862", size = 14978, upload-time = "2025-08-19T17:20:44.134Z" }, + { url = "https://files.pythonhosted.org/packages/c7/b7/b689d8c8eeca7af375cfcd64973e49e83aa817cc00f80f98548d42c0eb50/time_machine-2.19.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:6ba0303e9cc9f7f947e344f501e26bedfb68fab521e3c2729d370f4f332d2d55", size = 30964, upload-time = "2025-08-19T17:20:45.366Z" }, + { url = "https://files.pythonhosted.org/packages/80/91/38bf9c79674e95ce32e23c267055f281dff651eec77ed32a677db3dc011a/time_machine-2.19.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:2851825b524a988ee459c37c1c26bdfaa7eff78194efb2b562ea497a6f375b0a", size = 32606, upload-time = "2025-08-19T17:20:46.693Z" }, + { url = "https://files.pythonhosted.org/packages/19/4a/e9222d85d4de68975a5e799f539a9d32f3a134a9101fca0a61fa6aa33d68/time_machine-2.19.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:68d32b09ecfd7fef59255c091e8e7c24dd117f882c4880b5c7ab8c5c32a98f89", size = 34405, upload-time = "2025-08-19T17:20:48.032Z" }, + { url = "https://files.pythonhosted.org/packages/14/e2/09480d608d42d6876f9ff74593cfc9197a7eb2c31381a74fb2b145575b65/time_machine-2.19.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:60c46ab527bf2fa144b530f639cc9e12803524c9e1f111dc8c8f493bb6586eeb", size = 33181, upload-time = "2025-08-19T17:20:48.937Z" }, + { url = "https://files.pythonhosted.org/packages/84/64/f9359e000fad32d9066305c48abc527241d608bcdf77c19d67d66e268455/time_machine-2.19.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:56f26ab9f0201c453d18fe76bb7d1cf05fe58c1b9d9cb0c7d243d05132e01292", size = 31036, upload-time = "2025-08-19T17:20:50.276Z" }, + { url = "https://files.pythonhosted.org/packages/71/0d/fab2aacec71e3e482bd7fce0589381f9414a4a97f8766bddad04ad047b7b/time_machine-2.19.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6c806cf3c1185baa1d807b7f51bed0db7a6506832c961d5d1b4c94c775749bc0", size = 32145, upload-time = "2025-08-19T17:20:51.449Z" }, + { url = "https://files.pythonhosted.org/packages/44/fb/faeba2405fb27553f7b28db441a500e2064ffdb2dcba001ee315fdd2c121/time_machine-2.19.0-cp311-cp311-win32.whl", hash = "sha256:b30039dfd89855c12138095bee39c540b4633cbc3684580d684ef67a99a91587", size = 17004, upload-time = "2025-08-19T17:20:52.38Z" }, + { url = "https://files.pythonhosted.org/packages/2f/84/87e483d660ca669426192969280366635c845c3154a9fe750be546ed3afc/time_machine-2.19.0-cp311-cp311-win_amd64.whl", hash = "sha256:13ed8b34430f1de79905877f5600adffa626793ab4546a70a99fb72c6a3350d8", size = 17822, upload-time = "2025-08-19T17:20:53.348Z" }, + { url = "https://files.pythonhosted.org/packages/41/f4/ebf7bbf5047854a528adaf54a5e8780bc5f7f0104c298ab44566a3053bf8/time_machine-2.19.0-cp311-cp311-win_arm64.whl", hash = "sha256:cc29a50a0257d8750b08056b66d7225daab47606832dea1a69e8b017323bf511", size = 16680, upload-time = "2025-08-19T17:20:54.26Z" }, + { url = "https://files.pythonhosted.org/packages/9b/aa/7e00614d339e4d687f6e96e312a1566022528427d237ec639df66c4547bc/time_machine-2.19.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:c85cf437dc3c07429456d8d6670ac90ecbd8241dcd0fbf03e8db2800576f91ff", size = 19308, upload-time = "2025-08-19T17:20:55.25Z" }, + { url = "https://files.pythonhosted.org/packages/ab/3c/bde3c757394f5bca2fbc1528d4117960a26c38f9b160bf471b38d2378d8f/time_machine-2.19.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d9238897e8ef54acdf59f5dff16f59ca0720e7c02d820c56b4397c11db5d3eb9", size = 15019, upload-time = "2025-08-19T17:20:56.204Z" }, + { url = "https://files.pythonhosted.org/packages/c8/e0/8ca916dd918018352d377f1f5226ee071cfbeb7dbbde2b03d14a411ac2b1/time_machine-2.19.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:e312c7d5d6bfffb96c6a7b39ff29e3046de100d7efaa3c01552654cfbd08f14c", size = 33079, upload-time = "2025-08-19T17:20:57.166Z" }, + { url = "https://files.pythonhosted.org/packages/48/69/184a0209f02dd0cb5e01e8d13cd4c97a5f389c4e3d09b95160dd676ad1e7/time_machine-2.19.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:714c40b2c90d1c57cc403382d5a9cf16e504cb525bfe9650095317da3c3d62b5", size = 34925, upload-time = "2025-08-19T17:20:58.117Z" }, + { url = "https://files.pythonhosted.org/packages/43/42/4bbf4309e8e57cea1086eb99052d97ff6ddecc1ab6a3b07aa4512f8bf963/time_machine-2.19.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2eaa1c675d500dc3ccae19e9fb1feff84458a68c132bbea47a80cc3dd2df7072", size = 36384, upload-time = "2025-08-19T17:20:59.108Z" }, + { url = "https://files.pythonhosted.org/packages/b1/af/9f510dc1719157348c1a2e87423aed406589070b54b503cb237d9bf3a4fe/time_machine-2.19.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e77a414e9597988af53b2b2e67242c9d2f409769df0d264b6d06fda8ca3360d4", size = 34881, upload-time = "2025-08-19T17:21:00.116Z" }, + { url = "https://files.pythonhosted.org/packages/ca/28/61764a635c70cc76c76ba582dfdc1a84834cddaeb96789023af5214426b2/time_machine-2.19.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:cd93996970e11c382b04d4937c3cd0b0167adeef14725ece35aae88d8a01733c", size = 32931, upload-time = "2025-08-19T17:21:01.095Z" }, + { url = "https://files.pythonhosted.org/packages/b6/e0/f028d93b266e6ade8aca5851f76ebbc605b2905cdc29981a2943b43e1a6c/time_machine-2.19.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8e20a6d8d6e23174bd7e931e134d9610b136db460b249d07e84ecdad029ec352", size = 34241, upload-time = "2025-08-19T17:21:02.052Z" }, + { url = "https://files.pythonhosted.org/packages/7d/a6/36d1950ed1d3f613158024cf1dcc73db1d9ef0b9117cf51ef2e37dc06499/time_machine-2.19.0-cp312-cp312-win32.whl", hash = "sha256:95afc9bc65228b27be80c2756799c20b8eb97c4ef382a9b762b6d7888bc84099", size = 17021, upload-time = "2025-08-19T17:21:03.374Z" }, + { url = "https://files.pythonhosted.org/packages/b1/0d/e2dce93355abda3cac69e77fe96566757e98b8fe7fdcbddce89c9ced3f5f/time_machine-2.19.0-cp312-cp312-win_amd64.whl", hash = "sha256:e84909af950e2448f4e2562ea5759c946248c99ab380d2b47d79b62bd76fa236", size = 17857, upload-time = "2025-08-19T17:21:04.331Z" }, + { url = "https://files.pythonhosted.org/packages/eb/28/50ae6fb83b7feeeca7a461c0dc156cf7ef5e6ef594a600d06634fde6a2cb/time_machine-2.19.0-cp312-cp312-win_arm64.whl", hash = "sha256:0390a1ea9fa7e9d772a39b7c61b34fdcca80eb9ffac339cc0441c6c714c81470", size = 16677, upload-time = "2025-08-19T17:21:05.39Z" }, + { url = "https://files.pythonhosted.org/packages/a9/b8/24ebce67aa531bae2cbe164bb3f4abc6467dc31f3aead35e77f5a075ea3e/time_machine-2.19.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:5e172866753e6041d3b29f3037dc47c20525176a494a71bbd0998dfdc4f11f2f", size = 19373, upload-time = "2025-08-19T17:21:06.701Z" }, + { url = "https://files.pythonhosted.org/packages/53/a5/c9a5240fd2f845d3ff9fa26f8c8eaa29f7239af9d65007e61d212250f15b/time_machine-2.19.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f70f68379bd6f542ae6775cce9a4fa3dcc20bf7959c42eaef871c14469e18097", size = 15056, upload-time = "2025-08-19T17:21:07.667Z" }, + { url = "https://files.pythonhosted.org/packages/b9/92/66cce5d2fb2a5e68459aca85fd18a7e2d216f725988940cd83f96630f2f1/time_machine-2.19.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:e69e0b0f694728a00e72891ef8dd00c7542952cb1c87237db594b6b27d504a96", size = 33172, upload-time = "2025-08-19T17:21:08.619Z" }, + { url = "https://files.pythonhosted.org/packages/ae/20/b499e9ab4364cd466016c33dcdf4f56629ca4c20b865bd4196d229f31d92/time_machine-2.19.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3ae0a8b869574301ec5637e32c270c7384cca5cd6e230f07af9d29271a7fa293", size = 35042, upload-time = "2025-08-19T17:21:09.622Z" }, + { url = "https://files.pythonhosted.org/packages/41/32/b252d3d32791eb16c07d553c820dbc33d9c7fa771de3d1c602190bded2b7/time_machine-2.19.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:554e4317de90e2f7605ff80d153c8bb56b38c0d0c0279feb17e799521e987b8c", size = 36535, upload-time = "2025-08-19T17:21:10.571Z" }, + { url = "https://files.pythonhosted.org/packages/98/cf/4d0470062b9742e1b040ab81bad04d1a5d1de09806507bb6188989cfa1a7/time_machine-2.19.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6567a5ec5538ed550539ac29be11b3cb36af1f9894e2a72940cba0292cc7c3c9", size = 34945, upload-time = "2025-08-19T17:21:11.538Z" }, + { url = "https://files.pythonhosted.org/packages/24/71/2f741b29d98b1c18f6777a32236497c3d3264b6077e431cea4695684c8a1/time_machine-2.19.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:82e9ffe8dfff07b0d810a2ad015a82cd78c6a237f6c7cf185fa7f747a3256f8a", size = 33014, upload-time = "2025-08-19T17:21:12.858Z" }, + { url = "https://files.pythonhosted.org/packages/e8/83/ca8dba6106562843fd99f672e5aaf95badbc10f4f13f7cfe8d8640a7019d/time_machine-2.19.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7e1c4e578cdd69b3531d8dd3fbcb92a0cd879dadb912ee37af99c3a9e3c0d285", size = 34350, upload-time = "2025-08-19T17:21:13.923Z" }, + { url = "https://files.pythonhosted.org/packages/21/7f/34fe540450e18d0a993240100e4b86e8d03d831b92af8bb6ddb2662dc6fc/time_machine-2.19.0-cp313-cp313-win32.whl", hash = "sha256:72dbd4cbc3d96dec9dd281ddfbb513982102776b63e4e039f83afb244802a9e5", size = 17047, upload-time = "2025-08-19T17:21:14.874Z" }, + { url = "https://files.pythonhosted.org/packages/bf/5d/c8be73df82c7ebe7cd133279670e89b8b110af3ce1412c551caa9d08e625/time_machine-2.19.0-cp313-cp313-win_amd64.whl", hash = "sha256:e17e3e089ac95f9a145ce07ff615e3c85674f7de36f2d92aaf588493a23ffb4b", size = 17868, upload-time = "2025-08-19T17:21:15.819Z" }, + { url = "https://files.pythonhosted.org/packages/92/13/2dfd3b8fb285308f61cd7aa9bfa96f46ddf916e3549a0f0afd094c556599/time_machine-2.19.0-cp313-cp313-win_arm64.whl", hash = "sha256:149072aff8e3690e14f4916103d898ea0d5d9c95531b6aa0995251c299533f7b", size = 16710, upload-time = "2025-08-19T17:21:16.748Z" }, + { url = "https://files.pythonhosted.org/packages/05/c1/deebb361727d2c5790f9d4d874be1b19afd41f4375581df465e6718b46a2/time_machine-2.19.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:f3589fee1ed0ab6ee424a55b0ea1ec694c4ba64cc26895bcd7d99f3d1bc6a28a", size = 20053, upload-time = "2025-08-19T17:21:17.704Z" }, + { url = "https://files.pythonhosted.org/packages/45/e8/fe3376951e6118d8ec1d1f94066a169b791424fe4a26c7dfc069b153ee08/time_machine-2.19.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:7887e85275c4975fe54df03dcdd5f38bd36be973adc68a8c77e17441c3b443d6", size = 15423, upload-time = "2025-08-19T17:21:18.668Z" }, + { url = "https://files.pythonhosted.org/packages/9c/c7/f88d95cd1a87c650cf3749b4d64afdaf580297aa18ad7f4b44ec9d252dfc/time_machine-2.19.0-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ce0be294c209928563fcce1c587963e60ec803436cf1e181acd5bc1e425d554b", size = 39630, upload-time = "2025-08-19T17:21:19.645Z" }, + { url = "https://files.pythonhosted.org/packages/cc/5d/65a5c48a65357e56ec6f032972e4abd1c02d4fca4b0717a3aaefd19014d4/time_machine-2.19.0-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a62fd1ab380012c86f4c042010418ed45eb31604f4bf4453e17c9fa60bc56a29", size = 41242, upload-time = "2025-08-19T17:21:20.979Z" }, + { url = "https://files.pythonhosted.org/packages/f6/f9/fe5209e1615fde0a8cad6c4e857157b150333ed1fe31a7632b08cfe0ebdd/time_machine-2.19.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b25ec853a4530a5800731257f93206b12cbdee85ede964ebf8011b66086a7914", size = 44278, upload-time = "2025-08-19T17:21:21.984Z" }, + { url = "https://files.pythonhosted.org/packages/4a/3a/a5e5fe9c5d614cde0a9387ff35e8dfd12c5ef6384e4c1a21b04e6e0b905d/time_machine-2.19.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:a430e4d0e0556f021a9c78e9b9f68e5e8910bdace4aa34ed4d1a73e239ed9384", size = 42321, upload-time = "2025-08-19T17:21:23.755Z" }, + { url = "https://files.pythonhosted.org/packages/a1/c5/56eca774e9162bc1ce59111d2bd69140dc8908c9478c92ec7bd15d547600/time_machine-2.19.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:2415b7495ec4364c8067071e964fbadfe746dd4cdb43983f2f0bd6ebed13315c", size = 39270, upload-time = "2025-08-19T17:21:26.009Z" }, + { url = "https://files.pythonhosted.org/packages/9b/69/5dd0c420667578169a12acc8c8fd7452e8cfb181e41c9b4ac7e88fa36686/time_machine-2.19.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:dbfc6b90c10f288594e1bf89a728a98cc0030791fd73541bbdc6b090aff83143", size = 40193, upload-time = "2025-08-19T17:21:27.054Z" }, + { url = "https://files.pythonhosted.org/packages/75/a7/de974d421bd55c9355583427c2a38fb0237bb5fd6614af492ba89dacb2f9/time_machine-2.19.0-cp313-cp313t-win32.whl", hash = "sha256:16f5d81f650c0a4d117ab08036dc30b5f8b262e11a4a0becc458e7f1c011b228", size = 17542, upload-time = "2025-08-19T17:21:28.674Z" }, + { url = "https://files.pythonhosted.org/packages/76/0a/aa0d05becd5d06ae8d3f16d657dc8cc9400c8d79aef80299de196467ff12/time_machine-2.19.0-cp313-cp313t-win_amd64.whl", hash = "sha256:645699616ec14e147094f601e6ab9553ff6cea37fad9c42720a6d7ed04bcd5dc", size = 18703, upload-time = "2025-08-19T17:21:29.663Z" }, + { url = "https://files.pythonhosted.org/packages/1f/c0/f785a4c7c73aa176510f7c48b84b49c26be84af0d534deb222e0327f750e/time_machine-2.19.0-cp313-cp313t-win_arm64.whl", hash = "sha256:b32daa965d13237536ea3afaa5ad61ade2b2d9314bc3a20196a0d2e1d7b57c6a", size = 17020, upload-time = "2025-08-19T17:21:30.653Z" }, + { url = "https://files.pythonhosted.org/packages/ed/97/c5fb51def06c0b2b6735332ad118ab35b4d9b85368792e5b638e99b1b686/time_machine-2.19.0-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:31cb43c8fd2d961f31bed0ff4e0026964d2b35e5de9e0fabbfecf756906d3612", size = 19360, upload-time = "2025-08-19T17:21:31.94Z" }, + { url = "https://files.pythonhosted.org/packages/2d/4e/2d795f7d6b7f5205ffe737a05bb1cf19d8038233b797062b2ef412b8512b/time_machine-2.19.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:bdf481a75afc6bff3e520db594501975b652f7def21cd1de6aa971d35ba644e6", size = 15033, upload-time = "2025-08-19T17:21:32.934Z" }, + { url = "https://files.pythonhosted.org/packages/dd/32/9bad501e360b4e758c58fae616ca5f8c7ad974b343f2463a15b2bf77a366/time_machine-2.19.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:00bee4bb950ac6a08d62af78e4da0cf2b4fc2abf0de2320d0431bf610db06e7c", size = 33379, upload-time = "2025-08-19T17:21:33.925Z" }, + { url = "https://files.pythonhosted.org/packages/a3/45/eda0ca4d793dfd162478d6163759b1c6ce7f6e61daa7fd7d62b31f21f87f/time_machine-2.19.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:9f02199490906582302ce09edd32394fb393271674c75d7aa76c7a3245f16003", size = 35123, upload-time = "2025-08-19T17:21:34.945Z" }, + { url = "https://files.pythonhosted.org/packages/f0/5a/97e16325442ae5731fcaac794f0a1ef9980eff8a5491e58201d7eb814a34/time_machine-2.19.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e35726c7ba625f844c13b1fc0d4f81f394eefaee1d3a094a9093251521f2ef15", size = 36588, upload-time = "2025-08-19T17:21:35.975Z" }, + { url = "https://files.pythonhosted.org/packages/e8/9d/bf0b2ccc930cc4a316f26f1c78d3f313cd0fa13bb7480369b730a8f129db/time_machine-2.19.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:304315023999cd401ff02698870932b893369e1cfeb2248d09f6490507a92e97", size = 35013, upload-time = "2025-08-19T17:21:37.017Z" }, + { url = "https://files.pythonhosted.org/packages/f0/5a/39ac6a3078174f9715d88364871348b249631f12e76de1b862433b3f8862/time_machine-2.19.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:9765d4f003f263ea8bfd90d2d15447ca4b3dfa181922cf6cf808923b02ac180a", size = 33303, upload-time = "2025-08-19T17:21:38.352Z" }, + { url = "https://files.pythonhosted.org/packages/b3/ac/d8646baf9f95f2e792a6d7a7b35e92fca253c4a992afff801beafae0e5c2/time_machine-2.19.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:7837ef3fd5911eb9b480909bb93d922737b6bdecea99dfcedb0a03807de9b2d3", size = 34440, upload-time = "2025-08-19T17:21:39.382Z" }, + { url = "https://files.pythonhosted.org/packages/ce/8b/8b6568c5ae966d80ead03ab537be3c6acf2af06fb501c2d466a3162c6295/time_machine-2.19.0-cp314-cp314-win32.whl", hash = "sha256:4bb5bd43b1bdfac3007b920b51d8e761f024ed465cfeec63ac4296922a4ec428", size = 17162, upload-time = "2025-08-19T17:21:40.381Z" }, + { url = "https://files.pythonhosted.org/packages/46/a5/211c1ab4566eba5308b2dc001b6349e3a032e3f6afa67ca2f27ea6b27af5/time_machine-2.19.0-cp314-cp314-win_amd64.whl", hash = "sha256:f583bbd0aa8ab4a7c45a684bf636d9e042d466e30bcbae1d13e7541e2cbe7207", size = 18040, upload-time = "2025-08-19T17:21:41.363Z" }, + { url = "https://files.pythonhosted.org/packages/b8/fc/4c2fb705f6371cb83824da45a8b967514a922fc092a0ef53979334d97a70/time_machine-2.19.0-cp314-cp314-win_arm64.whl", hash = "sha256:f379c6f8a6575a8284592179cf528ce89373f060301323edcc44f1fa1d37be12", size = 16752, upload-time = "2025-08-19T17:21:42.336Z" }, + { url = "https://files.pythonhosted.org/packages/79/ab/6437d18f31c666b5116c97572a282ac2590a82a0a9867746a6647eaf4613/time_machine-2.19.0-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:a3b8981f9c663b0906b05ab4d0ca211fae4b63b47c6ec26de5374fe56c836162", size = 20057, upload-time = "2025-08-19T17:21:43.35Z" }, + { url = "https://files.pythonhosted.org/packages/6c/a2/e03639ec2ba7200328bbcad8a2b2b1d5fccca9cceb9481b164a1cabdcb33/time_machine-2.19.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:8e9c6363893e7f52c226afbebb23e825259222d100e67dfd24c8a6d35f1a1907", size = 15430, upload-time = "2025-08-19T17:21:44.725Z" }, + { url = "https://files.pythonhosted.org/packages/5d/ff/39e63a48e840f3e36ce24846ee51dd99c6dba635659b1750a2993771e88e/time_machine-2.19.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:206fcd6c9a6f00cac83db446ad1effc530a8cec244d2780af62db3a2d0a9871b", size = 39622, upload-time = "2025-08-19T17:21:45.821Z" }, + { url = "https://files.pythonhosted.org/packages/9a/2e/ee5ac79c4954768705801e54817c7d58e07e25a0bb227e775f501f3e2122/time_machine-2.19.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bf33016a1403c123373ffaeff25e26e69d63bf2c63b6163932efed94160db7ef", size = 41235, upload-time = "2025-08-19T17:21:46.783Z" }, + { url = "https://files.pythonhosted.org/packages/3a/3e/9af5f39525e779185c77285b8bbae15340eeeaa0afb33d458bc8b47d459b/time_machine-2.19.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9247c4bb9bbd3ff584ef4efbdec8efd9f37aa08bcfc4728bde1e489c2cb445bd", size = 44276, upload-time = "2025-08-19T17:21:47.759Z" }, + { url = "https://files.pythonhosted.org/packages/59/fe/572c7443cc27140bbeae3947279bbd4a120f9e8622253a20637f260b7813/time_machine-2.19.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:77f9bb0b86758d1f2d9352642c874946ad5815df53ef4ca22eb9d532179fe50d", size = 42330, upload-time = "2025-08-19T17:21:48.881Z" }, + { url = "https://files.pythonhosted.org/packages/cf/24/1a81c2e08ee7dae13ec8ceed27a29afa980c3d63852e42f1e023bf0faa03/time_machine-2.19.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:0b529e262df3b9c449f427385f4d98250828c879168c2e00eec844439f40b370", size = 39281, upload-time = "2025-08-19T17:21:49.907Z" }, + { url = "https://files.pythonhosted.org/packages/d2/60/6f0d6e5108978ca1a2a4ffb4d1c7e176d9199bb109fd44efe2680c60b52a/time_machine-2.19.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9199246e31cdc810e5d89cb71d09144c4d745960fdb0824da4994d152aca3303", size = 40201, upload-time = "2025-08-19T17:21:50.953Z" }, + { url = "https://files.pythonhosted.org/packages/73/b9/3ea4951e8293b0643feb98c0b9a176fa822154f1810835db3f282968ab10/time_machine-2.19.0-cp314-cp314t-win32.whl", hash = "sha256:0fe81bae55b7aefc2c2a34eb552aa82e6c61a86b3353a3c70df79b9698cb02ca", size = 17743, upload-time = "2025-08-19T17:21:51.948Z" }, + { url = "https://files.pythonhosted.org/packages/e4/8b/cd802884ca8a98e2b6cdc2397d57dd12ff8a7d1481e06fc3fad3d4e7e5ff/time_machine-2.19.0-cp314-cp314t-win_amd64.whl", hash = "sha256:7253791b8d7e7399fbeed7a8193cb01bc004242864306288797056badbdaf80b", size = 18956, upload-time = "2025-08-19T17:21:52.997Z" }, + { url = "https://files.pythonhosted.org/packages/c6/49/cabb1593896082fd55e34768029b8b0ca23c9be8b2dc127e0fc14796d33e/time_machine-2.19.0-cp314-cp314t-win_arm64.whl", hash = "sha256:536bd1ac31ab06a1522e7bf287602188f502dc19d122b1502c4f60b1e8efac79", size = 17068, upload-time = "2025-08-19T17:21:54.064Z" }, +] + [[package]] name = "tokenizers" version = "0.23.1"