Built-in sandbox SHIM: a bs4 (BeautifulSoup)-compatible module for the
model's Python sandbox, implemented in PURE Python on the stdlib
html.parser — NO host/JVM bridge, NOT a line of Clojure or babashka. bs4 is
a third-party wheel that does not ship in GraalPy, so agents that reach for
from bs4 import BeautifulSoup (the natural partner to the requests shim:
fetch then parse) would otherwise hit ModuleNotFoundError; this extension
contributes a :ext/sandbox-shims entry that env-python/build-agent-context
installs into every sandbox Context (main + every sub_loop fork).
It builds a Tag / NavigableString tree via html.parser, with
find/find_all (name/attrs/class_/id/string/recursive/limit), CSS .select
/ .select_one (type / #id / .class / [attr]/[attr=v]/~=/^=/$=/
*=, descendant + > child combinators, comma groups), get_text,
.string/.strings/.stripped_strings, sibling/parent navigation, dynamic
soup.tagname access, and HTML serialization. A deliberate subset of full
bs4 (no lxml, no advanced CSS pseudo-classes).
Like shim-requests there are NO :shim/bindings: the shim is a
self-contained Python preamble with zero host callables. It publishes a bs4
module (+ bs4.element) into sys.modules (so from bs4 import BeautifulSoup
works) and staples BeautifulSoup onto builtins.
Built-in sandbox SHIM: a `bs4` (BeautifulSoup)-compatible module for the model's Python sandbox, implemented in PURE Python on the stdlib `html.parser` — NO host/JVM bridge, NOT a line of Clojure or babashka. bs4 is a third-party wheel that does not ship in GraalPy, so agents that reach for `from bs4 import BeautifulSoup` (the natural partner to the `requests` shim: fetch then parse) would otherwise hit ModuleNotFoundError; this extension contributes a `:ext/sandbox-shims` entry that `env-python/build-agent-context` installs into every sandbox Context (main + every `sub_loop` fork). It builds a `Tag` / `NavigableString` tree via `html.parser`, with `find`/`find_all` (name/attrs/class_/id/string/recursive/limit), CSS `.select` / `.select_one` (type / `#id` / `.class` / `[attr]`/`[attr=v]`/`~=`/`^=`/`$=`/ `*=`, descendant + `>` child combinators, comma groups), `get_text`, `.string`/`.strings`/`.stripped_strings`, sibling/parent navigation, dynamic `soup.tagname` access, and HTML serialization. A deliberate subset of full bs4 (no lxml, no advanced CSS pseudo-classes). Like `shim-requests` there are NO `:shim/bindings`: the shim is a self-contained Python preamble with zero host callables. It publishes a `bs4` module (+ `bs4.element`) into `sys.modules` (so `from bs4 import BeautifulSoup` works) and staples `BeautifulSoup` onto builtins.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |