gradio
1export function verifyRequirements(requirements: string[]): void {
2requirements.forEach((req) => {
3let url: URL;
4try {
5url = new URL(req);
6} catch {
7// `req` is not a URL -> OK
8return;
9}
10
11// Ref: The scheme checker in the micropip implementation is https://github.com/pyodide/micropip/blob/v0.1.0/micropip/_compat_in_pyodide.py#L23-L26
12if (url.protocol === "emfs:" || url.protocol === "file:") {
13throw new Error(
14`"emfs:" and "file:" protocols are not allowed for the requirement (${req})`
15);
16}
17});
18}
19