Merge pull request #292 from JeanChristopheMorinPerso/skip_yanked_pypi_releases

Exclude yanked PyPI releases
This commit is contained in:
依云 2025-02-10 10:26:17 +08:00 committed by GitHub
commit 7cacd9edaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 3 deletions

View File

@ -589,7 +589,7 @@ Check PyPI
source = "pypi"
Check `PyPI <https://pypi.python.org/>`_ for updates.
Check `PyPI <https://pypi.python.org/>`_ for updates. Yanked releases are ignored.
pypi
The name used on PyPI, e.g. ``PySide``.
@ -683,7 +683,7 @@ Check crates.io
source = "cratesio"
Check `crates.io <https://crates.io/>`_ for updates.
Check `crates.io <https://crates.io/>`_ for updates. Yanked releases are ignored.
cratesio
The crate name on crates.io, e.g. ``tokio``.

View File

@ -19,6 +19,10 @@ async def get_version(name, conf, *, cache, **kwargs):
data = await cache.get_json(url)
for version in data['releases'].keys():
# Skip versions that are marked as yanked.
if (vers := data['releases'][version]) and vers[0]['yanked']:
continue
try:
parsed_version = Version(version)
except InvalidVersion:

View File

@ -39,10 +39,10 @@ classifiers =
[options]
zip_safe = True
python_requires = >=3.8
packages = find_namespace:
install_requires =
setuptools; python_version<"3.8"
tomli; python_version<"3.11"
structlog
platformdirs

View File

@ -32,3 +32,8 @@ async def test_pypi_invalid_version(get_version):
"source": "pypi",
})
async def test_pypi_yanked_version(get_version):
assert await get_version("urllib3", {
"source": "pypi",
"include_regex": "^(1\\..*)|(2\\.0\\.[0,1])",
}) == "1.26.20"