Skip to content

Commit c04d84f

Browse files
Try to fix index URLs in requirements file
1 parent a5e9565 commit c04d84f

File tree

1 file changed

+10
-11
lines changed
  • packages/pyodide-kernel/py/piplite/piplite

1 file changed

+10
-11
lines changed

packages/pyodide-kernel/py/piplite/piplite/cli.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ async def get_action_kwargs(argv: list[str]) -> tuple[typing.Optional[str], dict
150150
# Process requirements files
151151
for req_file in args.requirements or []:
152152
context = RequirementsContext()
153-
# If we have a CLI index URL, set it as the initial context
154-
if args.index_url:
155-
context.index_url = args.index_url
156153

157154
if not Path(req_file).exists():
158155
warn(f"piplite could not find requirements file {req_file}")
@@ -168,16 +165,18 @@ async def get_action_kwargs(argv: list[str]) -> tuple[typing.Optional[str], dict
168165
all_requirements.extend(context.requirements)
169166

170167
if all_requirements:
171-
# Group requirements by index URL
172-
by_index = {}
173-
for req, idx in all_requirements:
174-
by_index.setdefault(idx, []).append(req)
175-
176168
kwargs["requirements"] = []
177-
for idx, reqs in by_index.items():
169+
used_index = None
170+
171+
for req, idx in all_requirements:
178172
if idx:
179-
kwargs["index_urls"] = idx
180-
kwargs["requirements"].extend(reqs)
173+
used_index = idx
174+
kwargs["requirements"].append(req)
175+
176+
# Set the index URL if one was found (either passed to the CLI or
177+
# passed within the requirements file)
178+
if used_index:
179+
kwargs["index_urls"] = used_index
181180

182181
if args.pre:
183182
kwargs["pre"] = True

0 commit comments

Comments
 (0)