Skip to content

Commit ccd723b

Browse files
committed
fix(manager/uv): handle unnamed index
1 parent 93216f9 commit ccd723b

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

lib/modules/manager/pep621/extract.spec.ts

+15
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,21 @@ describe('modules/manager/pep621/extract', () => {
390390
]);
391391
});
392392

393+
it('should extract dependencies from uv when using unnamed index', async () => {
394+
const result = await extractPackageFile(
395+
codeBlock`
396+
[project]
397+
dependencies = ["dep1"]
398+
399+
[[tool.uv.index]]
400+
url = "https://example.com"
401+
`,
402+
'pyproject.toml',
403+
);
404+
405+
expect(result?.deps).toMatchObject([{ depName: 'dep1' }]);
406+
});
407+
393408
it('should extract dependencies from hatch environments', async () => {
394409
const hatchPyProject = Fixtures.get('pyproject_with_hatch.toml');
395410
const result = await extractPackageFile(hatchPyProject, 'pyproject.toml');

lib/modules/manager/pep621/processors/uv.ts

+4
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ async function getUvIndexCredentials(
339339
const entries = [];
340340

341341
for (const { name, url } of uv_indexes) {
342+
if (!name) {
343+
continue;
344+
}
345+
342346
const parsedUrl = parseUrl(url);
343347
// istanbul ignore if
344348
if (!parsedUrl) {

lib/modules/manager/pep621/schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const UvSchema = z.object({
7979
index: z
8080
.array(
8181
z.object({
82-
name: z.string(),
82+
name: z.string().optional(),
8383
url: z.string(),
8484
default: z.boolean().default(false),
8585
explicit: z.boolean().default(false),

0 commit comments

Comments
 (0)