Skip to content
Merged
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
2 changes: 2 additions & 0 deletions packages/engine/src/external-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const PYTHON_STDLIB_ROOTS = new Set([
"tempfile",
"threading",
"time",
"tomllib",
"traceback",
"types",
"typing",
"unittest",
"urllib",
Expand Down
20 changes: 20 additions & 0 deletions tests/external-dependencies-regression.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import assert from "node:assert/strict";
import test from "node:test";

import { isPythonStdlibSpecifier } from "../packages/engine/dist/external-dependencies.js";

test("Python stdlib detection recognizes common Python 3.12 modules", () => {
assert.equal(isPythonStdlibSpecifier("hashlib"), true);
assert.equal(isPythonStdlibSpecifier("types"), true);
assert.equal(isPythonStdlibSpecifier("tomllib"), true);
assert.equal(isPythonStdlibSpecifier("types.SimpleNamespace"), true);
assert.equal(isPythonStdlibSpecifier("tomllib.loads"), true);
});

test("Python stdlib detection does not classify third-party imports as stdlib", () => {
assert.equal(isPythonStdlibSpecifier("requests"), false);
assert.equal(isPythonStdlibSpecifier("pydantic"), false);
assert.equal(isPythonStdlibSpecifier("toml"), false);
assert.equal(isPythonStdlibSpecifier(".") , false);
assert.equal(isPythonStdlibSpecifier("..local_module"), false);
});