-
Notifications
You must be signed in to change notification settings - Fork 324
chore: implement dependency cooldowns in more areas #2841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
029a023
3f9d944
c4a4a46
24975da
0bd49eb
88efa8b
ac39bb2
0d39d19
38af4db
8228969
ae4750c
bd0c726
7136435
2555201
90df56e
4e7ead6
29c578d
71e27aa
35d044b
da1b6ed
003db82
f7195d6
7a694c8
d83985a
31507d3
02f4615
cc92301
77d3f69
d370e39
33b168a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The existing pattern for support code for the /bin scripts is for that to go into cibuildwheel/extra.py, could we do the same with these variables? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import os | ||
|
|
||
| # Number of days a release must age before the update scripts will pick it up. | ||
| # This is intentionally different from Dependabot because we want to have these | ||
| # updates coming faster to align with the latest releases. | ||
| # NOTE: Keep this in sync with noxfile.py's update_constraints session. | ||
| COOLDOWN_DAYS = 3 | ||
|
|
||
| # Set CIBW_IGNORE_COOLDOWN to a truthy value to bypass the cooldown and always pick | ||
| # up the very latest releases regardless of age. | ||
| IGNORE_COOLDOWN = os.environ.get("CIBW_IGNORE_COOLDOWN", "").lower() in ("1", "true") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,19 +20,22 @@ | |
| import operator | ||
| import re | ||
| import tomllib | ||
| from collections.abc import Mapping, MutableMapping | ||
| from datetime import UTC, date, datetime, timedelta | ||
| from pathlib import Path | ||
| from typing import Any, Final, Literal, NotRequired, TypedDict | ||
| from xml.etree import ElementTree as ET | ||
|
|
||
| import click | ||
| import requests | ||
| import rich | ||
| from _cooldown import COOLDOWN_DAYS, IGNORE_COOLDOWN | ||
| from packaging.specifiers import Specifier | ||
| from packaging.version import Version | ||
| from rich.logging import RichHandler | ||
| from rich.syntax import Syntax | ||
|
|
||
| from cibuildwheel.extra import dump_python_configurations, get_pyodide_xbuildenv_info | ||
| from cibuildwheel.extra import dump_python_configurations | ||
| from cibuildwheel.platforms.android import android_triplet | ||
|
|
||
| TYPE_CHECKING = False | ||
|
|
@@ -418,9 +421,17 @@ def update_version_ios(self, identifier: str, version: Version) -> ConfigUrl | N | |
|
|
||
|
|
||
| class PyodideVersions: | ||
| def __init__(self) -> None: | ||
| xbuildenv_info = get_pyodide_xbuildenv_info() | ||
| self.releases = xbuildenv_info["releases"] | ||
| def __init__(self, cutoff_date: date) -> None: | ||
| response = requests.get( | ||
| "https://pyodide.github.io/pyodide/api/v2/pyodide-cross-build-environments.json" | ||
| ) | ||
| response.raise_for_status() | ||
| all_releases = response.json()["releases"] | ||
| self.releases = { | ||
| version_str: release | ||
| for version_str, release in all_releases.items() | ||
| if datetime.fromisoformat(release["published_at"]).date() <= cutoff_date | ||
| } | ||
|
Comment on lines
-421
to
+434
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we return to using get_pyodide_xbuildenv_info here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yes, now that we use the v2 API endpoint in both situations and pyodide-build defaults to it, I can reduce some of the repetition that I couldn't previously. Thanks! |
||
|
|
||
| def update_version_pyodide( | ||
| self, identifier: str, version: Version, spec: Specifier, node_version: str | ||
|
|
@@ -457,6 +468,12 @@ def update_version_pyodide( | |
|
|
||
| class AllVersions: | ||
| def __init__(self) -> None: | ||
| cutoff_date: date = ( | ||
| date.max | ||
| if IGNORE_COOLDOWN | ||
| else (datetime.now(tz=UTC) - timedelta(days=COOLDOWN_DAYS)).date() | ||
| ) | ||
|
|
||
| self.windows_32 = WindowsVersions("32", False) | ||
| self.windows_t_32 = WindowsVersions("32", True) | ||
| self.windows_64 = WindowsVersions("64", False) | ||
|
|
@@ -474,7 +491,7 @@ def __init__(self) -> None: | |
|
|
||
| self.graalpy = GraalPyVersions() | ||
|
|
||
| self.pyodide = PyodideVersions() | ||
| self.pyodide = PyodideVersions(cutoff_date) | ||
|
|
||
| def _stream_sha256(self, url: str) -> str: | ||
| """Download a file (streaming) and return its SHA256 hex digest.""" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.