Skip to content

Commit

Permalink
fix(pypi): filter string only and deduplicate (#28865)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed May 6, 2024
1 parent 3afab2a commit abc61d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 0 additions & 3 deletions lib/modules/datasource/pypi/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ exports[`modules/datasource/pypi/index getReleases respects constraints 1`] = `
{
"registryUrl": "https://pypi.org/pypi",
"releases": [
{
"version": "0.4.0",
},
{
"version": "0.4.1",
},
Expand Down
7 changes: 5 additions & 2 deletions lib/modules/datasource/pypi/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import url from 'node:url';
import is from '@sindresorhus/is';
import changelogFilenameRegex from 'changelog-filename-regex';
import { logger } from '../../../logger';
import { coerceArray } from '../../../util/array';
Expand Down Expand Up @@ -156,9 +157,11 @@ export class PypiDatasource extends Datasource {
result.isDeprecated = isDeprecated;
}
// There may be multiple releases with different requires_python, so we return all in an array
const pythonConstraints = releases
.map(({ requires_python }) => requires_python)
.filter(is.string);
result.constraints = {
// TODO: string[] isn't allowed here
python: releases.map(({ requires_python }) => requires_python) as any,
python: Array.from(new Set(pythonConstraints)),
};
return result;
});
Expand Down

0 comments on commit abc61d6

Please sign in to comment.