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.6.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.6-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scitex_introspect-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 75e1b718230b6b47ba3439c3b74f692920707276b45af3096b2beb9b37a7f7ac
MD5 bde579393757da1aff2eff3cace193b1
BLAKE2b-256 0b1060deffc453f3510879d3419781be544511dbfe4d5d7d192fae269a95ee56

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.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.6-py3-none-any.whl.

File metadata

File hashes

Hashes for scitex_introspect-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1b58b25c3a359eafc9d8344603aa1a894f5900e277c71b63eafb143238cf0761
MD5 7336f9f0c10dea03650c97dc7e91ad01
BLAKE2b-256 a71e3f5972ee0776a70ebb3bd31dad8c4f38370fdbf54159c56bab3c156a0b47

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.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