{# Library install widget: one row of method tabs, one panel per method. Mirrors the mcp-install and cli-install widgets' outer structure. Three methods cover the canonical library-consumption shapes: ``uv-script`` (PEP 723 inline metadata), ``uv-add`` (project), and ``pip`` (traditional). Each panel carries two code blocks whose Pygments lexer differs by method, so the template uses ``panel.code_a_lang`` / ``panel.code_b_lang`` instead of hard-coded language args. The first panel is visible by default; widget.js mirrors localStorage onto and the CSS in widget.css swaps panel visibility based on that attribute. #}
Save this as example.py. The
PEP 723
inline-metadata header declares rampa as a
dependency, so uv
resolves and runs the script in an ephemeral environment:
With {{ panel.method.label }} installed:
{% endif %} {{ panel.code_a_body | highlight(panel.code_a_lang) }} {% if panel.method.id == 'uv-script' %}Then run it:
{% else %}Then drive the library from Python:
{% endif %} {{ panel.code_b_body | highlight(panel.code_b_lang) }}