Skip to content

Commit aa648b8

Browse files
committed
WIP: more packages details
1 parent de34024 commit aa648b8

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

rollup/build_pyodide_graph.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { fileURLToPath } from "node:url";
77
// avoid fetching details for version below this one
88
const IGNORE_BELOW = '0.27';
99

10+
// query pypi to find Web Environment related packages
11+
const QUERY_ALL_PACKAGES = false;
12+
1013
const __dirname = dirname(fileURLToPath(import.meta.url));
1114
const pyodideVersion = join(__dirname, '..', 'versions', 'pyodide');
1215
const pyodideGraph = join(__dirname, 'pyodide_graph.json');
@@ -67,6 +70,42 @@ const json = existsSync(pyodideGraph) ? JSON.parse(readFileSync(pyodideGraph)) :
6770
writeFileSync(join(__dirname, 'pyodide_graph.json'), JSON.stringify(json, null, '\t'));
6871
})();
6972

73+
const packages = [];
74+
for (const version in json) {
75+
packages.push(...Object.keys(json[version]));
76+
}
77+
78+
(async () => {
79+
if (!QUERY_ALL_PACKAGES) return;
80+
let i = 0;
81+
const braile = '⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏'.split(' ');
82+
const browser = await chromium.launch();
83+
const page = await browser.newPage();
84+
const webEnvironment = [];
85+
console.log('');
86+
for (const pkg of new Set(packages.sort())) {
87+
console.log(`\x1b[1B\x1b[1A\x1b[1K${braile[i++ % braile.length]}`);
88+
await page.goto(`https://pypi.org/project/${pkg}/`);
89+
await page.waitForLoadState();
90+
if (await page.evaluate(() => {
91+
const ul = 'ul.sidebar-section__classifiers';
92+
const we = 'a[href="/search/?c=Environment+%3A%3A+Web+Environment"]';
93+
return !!document.querySelector(ul)?.querySelector(we);
94+
})) {
95+
console.log([
96+
`\x1b[1B\x1b[1A\x1b[1K${braile[i++ % braile.length]}`,
97+
`\x1b[1m${pkg}\x1b[0m has a Web Environment`,
98+
].join(' '));
99+
webEnvironment.push(pkg);
100+
}
101+
await new Promise(resolve => setTimeout(resolve, 250));
102+
}
103+
await browser.close();
104+
console.log('\x1b[1B\x1b[1A\x1b[1K', ' '.repeat(80));
105+
console.log('\x1b[1mWeb Environment Packages:\x1b[0m');
106+
console.log('\n \u2022', webEnvironment.join('\n \u2022'));
107+
})();
108+
70109
// store the graph as JS module so we can optionally import it
71110
writeFileSync(
72111
join(__dirname, '..', 'esm', 'interpreter', 'pyodide_graph.js'),

rollup/pyodide_dependencies.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"Jinja2": [],
3+
"MarkupSafe": [],
4+
"bleach": [],
5+
"bokeh": {
6+
"js": [
7+
"https://cdn.bokeh.org/bokeh/release/bokeh-${VERSION}.min.js",
8+
"https://cdn.bokeh.org/bokeh/release/bokeh-gl-${VERSION}.min.js",
9+
"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-${VERSION}.min.js",
10+
"https://cdn.bokeh.org/bokeh/release/bokeh-tables-${VERSION}.min.js",
11+
"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-${VERSION}.min.js",
12+
"https://cdn.bokeh.org/bokeh/release/bokeh-api-${VERSION}.min.js"
13+
]
14+
},
15+
"fastapi": [],
16+
"httpcore": [],
17+
"httpx": [],
18+
"pyinstrument": [],
19+
"requests": [],
20+
"starlette": [],
21+
"urllib3": []
22+
}

0 commit comments

Comments
 (0)