Code introspection CLI for LLM-assisted development with structured JSON output
Project description
eyeball
Code introspection CLI for LLM-assisted development with structured JSON output.
eyeball gives LLMs "eyes" to see into your code - exploring modules, verifying API usage, running quick probes, and analyzing dependencies.
Installation
# Install as a dev dependency
pip install jaymd96-eyeball
# Or with optional dependencies for full functionality
pip install "jaymd96-eyeball[dev,toml]"
Quick Start
# Discover all public items in a module
eyeball discover mypackage.models
# Inspect a class or function
eyeball inspect mypackage.models:User
# Run a function with arguments
eyeball run mypackage.utils:process_data --kwargs '{"input": "test"}'
# Execute arbitrary code
eyeball exec 'from mypackage import VERSION; print(VERSION)'
# Run tests with structured output
eyeball test mypackage.models
# Quick verification probe
eyeball probe "assert 1 + 1 == 2"
# Analyze dependencies of a function/class
eyeball deps mypackage.models:User
# Find all callers of a target
eyeball callers mypackage.models:User
# Get API documentation for third-party libraries
eyeball api requests:get
Commands
| Command | Description |
|---|---|
discover |
List all public classes and functions in a module |
inspect |
Get detailed information about a module, class, or function |
run |
Execute a function or instantiate a class |
exec |
Execute arbitrary Python code |
test |
Run pytest with structured JSON output |
source |
Show source code of a target |
reload |
Hot-reload a module after changes |
list-tests |
List all test files in the project |
probe |
Run quick verification probes (lightweight testing) |
fixtures |
List available fixtures for probes |
deps |
Analyze dependencies of a function/class using AST |
callers |
Find all references to a target (reverse dependencies) |
module-deps |
Analyze all imports in a module |
api |
Get comprehensive API docs (works on third-party libs) |
search-api |
Search for items in a module by name |
help-json |
Output help as JSON for LLM consumption |
Configuration
Configure eyeball via pyproject.toml:
[tool.eyeball]
package_name = "mypackage" # Auto-detected from project.name
tests_dir = "tests" # Test directory (default: "tests")
fixtures_module = "mypackage.fixtures" # Custom fixtures module
Or use a standalone eyeball.toml file with the same options.
Custom Fixtures
Create custom fixtures for your probes:
# mypackage/fixtures.py
from eyeball.harness import Fixtures
@Fixtures.register("database")
def database_fixture():
"""In-memory database for testing."""
from mypackage.db import create_test_db
db = create_test_db()
return {
"db": db,
"create_user": db.create_user,
"get_user": db.get_user,
}
@Fixtures.register("sample_data")
def sample_data_fixture():
"""Sample test data."""
return {
"users": [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}],
"products": [{"id": 1, "name": "Widget", "price": 9.99}],
}
Then configure:
[tool.eyeball]
fixtures_module = "mypackage.fixtures"
Use in probes:
eyeball probe --fixture database "assert db.get_user(1) is not None"
eyeball probe --fixture sample_data "assert len(users) == 2"
JSON Output
All commands output JSON for easy parsing by LLMs and scripts:
# Pretty-print with -p flag
eyeball -p inspect mypackage.models:User
{
"status": "success",
"target": "mypackage.models:User",
"type": "class",
"class_name": "User",
"attributes": [
{"name": "id", "type": "int", "required": true},
{"name": "name", "type": "str", "required": true},
{"name": "email", "type": "str", "required": false}
],
"methods": [...]
}
API Introspection
Explore third-party libraries to verify correct usage:
# Search for functions in a library
eyeball -p search-api requests get
{
"status": "success",
"module": "requests",
"query": "get",
"results": [
{"name": "get", "type": "function", "signature": "(url, params=None, **kwargs)", "summary": "Sends a GET request."}
]
}
# Get full API documentation
eyeball -p api requests:get
{
"status": "success",
"target": "requests:get",
"type": "function",
"name": "get",
"signature": "(url, params=None, **kwargs)",
"parameters": [
{"name": "url", "required": true, "kind": "POSITIONAL_OR_KEYWORD", "description": "URL for the new Request object."},
{"name": "params", "required": false, "default": "None", "description": "Dictionary or bytes to send in the query string."},
{"name": "kwargs", "required": false, "kind": "VAR_KEYWORD", "description": "Optional arguments that request takes."}
],
"return_type": "Response",
"summary": "Sends a GET request.",
"source_available": true,
"source_preview": "def get(url, params=None, **kwargs):\n ..."
}
Works on any importable Python code - your project, stdlib, or third-party packages.
Dependency Analysis
Analyze what a function or class depends on:
eyeball -p deps mypackage.models:User
{
"status": "success",
"target": "mypackage.models:User",
"target_type": "class",
"imports": [
{"module": "dataclasses", "name": "dataclass"},
{"module": "typing", "name": "Optional"}
],
"calls": [
{"name": "field", "is_method": false, "args_count": 0, "kwargs_count": 1}
],
"instantiations": [
{"name": "UUID", "is_method": false}
],
"summary": {
"imports": 2,
"calls": 3,
"instantiations": 1
}
}
Find all code that uses a target:
eyeball -p callers mypackage.models:User
{
"status": "success",
"target": "mypackage.models:User",
"callers": [
{
"file": "mypackage/services/user_service.py",
"references": [
{"type": "import_from", "line": 3, "text": "from mypackage.models import User"},
{"type": "name", "line": 15, "context": "load"}
]
}
],
"total_files": 5,
"total_references": 12
}
Analyze module-level imports:
eyeball -p module-deps mypackage.models
Use with LLMs
eyeball is designed for LLM-assisted development workflows:
- Exploration: LLMs can use
discoverandinspectto understand your codebase - Verification: Quick
probecommands let LLMs verify their understanding - Testing: Structured test output helps LLMs understand test failures
- Hot-reloading:
reloadenables rapid iteration without restarts - Dependency Analysis:
depsandcallershelp understand code relationships - API Introspection:
apiandsearch-apilet LLMs verify correct library usage
Built-in Fixtures
| Fixture | Description | Provides |
|---|---|---|
mocks |
Mocking utilities | Mock, MagicMock, patch |
async_helpers |
Async testing | asyncio, run_async |
temp_files |
Temporary files | temp_dir, temp_file, Path |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jaymd96_eyeball-0.1.0.tar.gz.
File metadata
- Download URL: jaymd96_eyeball-0.1.0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.13.0 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94a941525caa0f7179c26ac2588a1192b9430f2d296b0f1fb1c23bc373802413
|
|
| MD5 |
eb17956d4ba2ac7a0825154146f84771
|
|
| BLAKE2b-256 |
485d7670c2f17fcb51a9d4c757bfd0acedca05456b044be068f501d44e6ac674
|
File details
Details for the file jaymd96_eyeball-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jaymd96_eyeball-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.13.0 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bd7e4375f0057817789f4363bde9817eb9ad71f364dc8a94f8b2f407325b9fd
|
|
| MD5 |
f313a0aef5ea7772dba1b4722ccdcb77
|
|
| BLAKE2b-256 |
e9ea6a6708331aae65d6e550206f4f96eba40f7d07f44ce1e4a9865b138e9bc5
|