Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions rollup/build_pyodide_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { fileURLToPath } from "node:url";
// avoid fetching details for version below this one
const IGNORE_BELOW = '0.27';

// query pypi to find Web Environment related packages
const QUERY_ALL_PACKAGES = false;

const __dirname = dirname(fileURLToPath(import.meta.url));
const pyodideVersion = join(__dirname, '..', 'versions', 'pyodide');
const pyodideGraph = join(__dirname, 'pyodide_graph.json');
Expand Down Expand Up @@ -67,6 +70,42 @@ const json = existsSync(pyodideGraph) ? JSON.parse(readFileSync(pyodideGraph)) :
writeFileSync(join(__dirname, 'pyodide_graph.json'), JSON.stringify(json, null, '\t'));
})();

const packages = [];
for (const version in json) {
packages.push(...Object.keys(json[version]));
}

(async () => {
if (!QUERY_ALL_PACKAGES) return;
let i = 0;
const braile = '⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏'.split(' ');
const browser = await chromium.launch();
const page = await browser.newPage();
const webEnvironment = [];
console.log('');
for (const pkg of new Set(packages.sort())) {
console.log(`\x1b[1B\x1b[1A\x1b[1K${braile[i++ % braile.length]}`);
await page.goto(`https://pypi.org/project/${pkg}/`);
await page.waitForLoadState();
if (await page.evaluate(() => {
const ul = 'ul.sidebar-section__classifiers';
const we = 'a[href="/search/?c=Environment+%3A%3A+Web+Environment"]';
return !!document.querySelector(ul)?.querySelector(we);
})) {
console.log([
`\x1b[1B\x1b[1A\x1b[1K${braile[i++ % braile.length]}`,
`\x1b[1m${pkg}\x1b[0m has a Web Environment`,
].join(' '));
webEnvironment.push(pkg);
}
await new Promise(resolve => setTimeout(resolve, 250));
}
await browser.close();
console.log('\x1b[1B\x1b[1A\x1b[1K', ' '.repeat(80));
console.log('\x1b[1mWeb Environment Packages:\x1b[0m');
console.log('\n \u2022', webEnvironment.join('\n \u2022'));
})();

// store the graph as JS module so we can optionally import it
writeFileSync(
join(__dirname, '..', 'esm', 'interpreter', 'pyodide_graph.js'),
Expand Down
22 changes: 22 additions & 0 deletions rollup/pyodide_dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Jinja2": [],
"MarkupSafe": [],
"bleach": [],
"bokeh": {
"js": [
"https://cdn.bokeh.org/bokeh/release/bokeh-${VERSION}.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-gl-${VERSION}.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-${VERSION}.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-tables-${VERSION}.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-${VERSION}.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-api-${VERSION}.min.js"
]
},
"fastapi": [],
"httpcore": [],
"httpx": [],
"pyinstrument": [],
"requests": [],
"starlette": [],
"urllib3": []
}