Skip to main content

scitex-introspect

SciTeX

IPython-style introspection for any Python package — `q`, `qq`, `dir`, signatures, source.

Full Documentation · uv pip install scitex-introspect[all]

pypi python docs

tests cov


Quick Start

import scitex_introspect as ix

ix.q(my_func)        # Signature with type hints (like `my_func?`)
ix.qq(my_func)       # Full source code (like `my_func??`)
ix.dir(my_pkg)       # List attributes/methods

Demo

flowchart LR
    A["scitex_introspect.q(obj)"] --> B[".signature + type hints"]
    A2["scitex_introspect.qq(obj)"] --> C[".source"]
    A3["scitex_introspect.dir(pkg)"] --> D[".members + .list_api"]
    A4["scitex_introspect.resolve('a.b.c')"] --> E["dotted-path lookup"]
    B & C & D & E --> F["agent / REPL output"]

Figure 1. Entrypoints fan out to signature, source, member, and resolver helpers.

>>> import scitex_introspect as ix, json
>>> ix.q(json.loads)
json.loads(s, *, cls=None, object_hook=None, ...)
>>> ix.dir(json)[:3]
['JSONDecodeError', 'JSONDecoder', 'JSONEncoder']

Installation

uv pip install "scitex-introspect[all]"

Requires Python ≥ 3.9.

Per-extra installs
Extra Pulls in
mcp stdio MCP server for AI agents (mcp>=1.0.0)
dev tests + lint + dev helpers (pytest, ruff, scitex-dev, …)
docs Sphinx docs build (sphinx, myst-parser, …)

Architecture

scitex_introspect/
├── _core.py              ← q / qq IPython-style entrypoints
├── _signature.py         ← inspect.signature with type hints
├── _docstring.py         ← docstring extraction
├── _source.py            ← getsource with fallback
├── _list_api.py          ← recursive module API tree
├── _members.py           ← attribute / method enumeration
├── _imports.py           ← static import-graph extraction
├── _call_graph.py        ← AST-based caller / callee analysis
├── _class_hierarchy.py   ← MRO + base-class walk
├── _examples.py          ← scrape doctest / examples blocks
├── _resolve.py           ← dotted-path → object resolver
├── _type_hints.py        ← typing.get_type_hints helpers
├── _mcp/                 ← MCP server tools
└── _skills/              ← agent-facing skill pages
flowchart LR
    obj["any Python object"] --> q["q / qq"]
    obj --> sig["signature / docstring / source"]
    pkg["module / package"] --> members["members / dir"]
    pkg --> tree["list_api (recursive tree)"]
    file["source file"] --> stat["imports / call_graph"]
    cls["class"] --> hier["class_hierarchy"]
    sig & members & tree & stat & hier --> out["DataFrame / text"]

Figure 2. Module data flow: objects, packages, files, and classes route to focused helpers.

Thin core over inspect, importlib, ast, and typing — hard runtime deps are just pandas and scitex-logging.

2 Interfaces

Python API
import scitex_introspect as ix

# IPython-style shortcuts
ix.q(my_func)        # Signature with type hints
ix.qq(my_func)       # Full source code
ix.dir(my_pkg)       # List attributes/methods
ix.list_api(my_pkg)  # Recursive module API tree

# Detailed inspection
ix.signature(my_func)
ix.docstring(my_func)
ix.source(my_func)
ix.members(my_pkg)

# Static analysis
ix.imports(file_path)
ix.call_graph(my_func)
ix.class_hierarchy(MyClass)
ix.examples(my_func)
ix.resolve("scitex.io.save")
MCP Server — for AI Agents

Install with pip install "scitex-introspect[mcp]" and the package exposes async handlers for IPython-style introspection over MCP — agents can ask "what's the signature of X?" or "show me the source of Y" without running Python themselves.

Status

Standalone fork of scitex.introspect. Thin core over stdlib inspect / importlib / ast / typing — hard runtime deps are just pandas and scitex-logging. The umbrella package's scitex.introspect import path is preserved via a sys.modules-alias bridge.

Part of SciTeX

scitex-introspect is part of SciTeX. Install via the umbrella with pip install scitex[introspect] to use as scitex.introspect (Python) or scitex introspect ... (CLI).

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.

License

AGPL-3.0-only (see LICENSE).


SciTeX

Metadata

Release files for scitex-introspect 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scitex-introspect 0.1.8
File Size Uploaded
scitex_introspect-0.1.8.tar.gz 35.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scitex-introspect 0.1.8
File Interpreter ABI Platform
scitex_introspect-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 76.1 kB

Release files / scitex_introspect-0.1.8.tar.gz

Download URL scitex_introspect-0.1.8.tar.gz
Size 35.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c23d581b8251343f1b6795bb1968e7086daf51dd2eceb8eca0a6ff1b98823e62
BLAKE2b-256 checksum
How to use checksums
fd2551796ce04f4d168a9be6cefcd3909a54903bf117aa1f6c2c4733406f2a30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / scitex_introspect-0.1.8-py3-none-any.whl

Download URL scitex_introspect-0.1.8-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc106b3deec80597cc6db7f199d739be68117720579950649bf18943e3fa7075
BLAKE2b-256 checksum
How to use checksums
84d72fef1540f33544ec57aa81b3d0faddef0dcd47dffd7bf13283cadc2f71cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page