Skip to main content

IPython-style introspection (signatures, docstrings, members, source, call graphs, class hierarchy) for any Python package — standalone module from the SciTeX ecosystem

Project description

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 Tests Coverage Docs License: AGPL v3


Installation

pip install scitex-introspect
pip install "scitex-introspect[mcp]"   # + MCP server for AI agents

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

Pure-stdlib core — every module is a thin layer over inspect, importlib, ast, and typing. Zero runtime deps.

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.

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"]
>>> 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']

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

Status

Standalone fork of scitex.introspect. Pure stdlib core — zero runtime deps. 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scitex_introspect-0.1.7.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scitex_introspect-0.1.7-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file scitex_introspect-0.1.7.tar.gz.

File metadata

  • Download URL: scitex_introspect-0.1.7.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_introspect-0.1.7.tar.gz
Algorithm Hash digest
SHA256 3723c5e1ca69f2f2ef8e7f8b385cb73312fd0da8844f6f8d687c254ae8ccd9d3
MD5 996f3d21f1ab18e44b1f456e17e82891
BLAKE2b-256 105b42a2cf74231073703d03273d80b36ec9b3160979107324be6b0f02c6755c

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_introspect-0.1.7.tar.gz:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-introspect

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scitex_introspect-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for scitex_introspect-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6eda41eeb68775f5d5a11a2665cc040ad5090023feecc1f008aea4845e6dda23
MD5 0d5df20c7a3a9a049d6057e16b807ca6
BLAKE2b-256 62b7373999049d6289a7acf945abcd03e49cda255ed0a9eb4558d136c293ea3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_introspect-0.1.7-py3-none-any.whl:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-introspect

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page