* Fetch the latest version of a package from PyPI
(packageName)
| 217 | * Fetch the latest version of a package from PyPI |
| 218 | */ |
| 219 | async function fetchPyPIVersion(packageName) { |
| 220 | const url = `https://pypi.org/pypi/${packageName}/json`; |
| 221 | try { |
| 222 | const response = await fetch(url); |
| 223 | if (!response.ok) { |
| 224 | return null; |
| 225 | } |
| 226 | const data = await response.json(); |
| 227 | return data.info?.version || null; |
| 228 | } catch { |
| 229 | return null; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Read the automation version from env var or config/defaults.json |