python-api

Look up installed Python package APIs via inspect, pydoc, LSP, and versioned docs, then cache findings.

1|Updated Jun 22, 2026
One-click install
npx skills add https://github.com/probabl-ai/ibm-workshop --skill python-api-probabl-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-api
Source: https://github.com/probabl-ai/ibm-workshop/tree/main/.bob/skills/python-api
Command: npx skills add https://github.com/probabl-ai/ibm-workshop --skill python-api-probabl-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? AI agents often write Python code from training-data memory, which breaks when the installed library version has renamed, re-signatured, or deprecated a symbol. This Skill forces every symbol lookup to happen against the actually installed version and caches the verified result so the work is never repeated. ## Core Features & Use Cases - Four lookup shapes by question type: cache hit first, then inspect.signature + pydoc.render_doc symbol cards, dir/pkgutil module surface dumps, LSP hover via Pyright, and WebSearch/WebFetch of version-pinned narrative docs. - Version-keyed cache: every finding lands in scratch/api/<lib>/<version>/<topic>.md with a source line, verbatim extracts, and an agent-synthesized Usage section (Call / Don't call / Trap / Returns). - Named version traps: ships a list of known renames and footguns (e.g. skrub tabular_learnertabular_pipeline, skore Project.get by id not key) so agents check the right way before writing code. - Use Case: Before writing skore.evaluate(learner, data={...}) in an ML experiment script, the agent resolves the installed skore version, checks the cache, runs a probe if needed, and records the verified signature — instead of guessing from memory. ## Quick Start Ask the agent to look up the signature and docstring of a function in the installed version of a Python package and cache the result for future sessions.

Frequently Asked Questions about python-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check a Python function signature against the installed version?

Resolve the package version with `__version__`, then run `inspect.signature` and `pydoc.render_doc` on the symbol from a scratch script. This Skill wraps that flow and writes the verified result to a version-keyed cache file.

How to look up what a Python module contains programmatically?

Use `dir(module)` for the top-level surface and `pkgutil.iter_modules(module.__path__)` for submodules. The Shape 2 probe template in this Skill dumps both into a `surface.md` cache file under the exact installed version.

Can I use Pyright LSP hover instead of running Python for signatures?

Yes, if Pyright is configured with a `pyrightconfig.json` pointing at the right environment and the LSP was started after the config existed. The Skill defines a one-time session probe to detect availability, falling back to pydoc when hover returns Unknown.

Why does code written from memory fail with ImportError or TypeError?

Libraries rename and re-signature symbols between versions — for example skrub renamed `tabular_learner` to `tabular_pipeline` in 0.7 and dropped the positional argument of `mark_as_y` in 0.9. Always confirm against the installed version before writing the call.

When should I fetch versioned documentation instead of using inspect?

Use narrative doc lookups when the question depends on a condition, such as what a function returns for a specific argument value, or when comparing two approaches. Fetch the URL containing the exact installed version and cache verbatim extracts.