Metadata-Version: 2.4
Name: python-introspect
Version: 0.1.0
Summary: Pure Python introspection toolkit for function signatures, dataclasses, and type hints
Author-email: Tristan Simas <tristan.simas@mail.mcgill.ca>
License: MIT
Project-URL: Homepage, https://github.com/OpenHCSDev/python-introspect
Project-URL: Repository, https://github.com/OpenHCSDev/python-introspect
Project-URL: Issues, https://github.com/OpenHCSDev/python-introspect/issues
Keywords: introspection,reflection,signature,dataclass,type-hints,docstring
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
Dynamic: license-file

# python-introspect

**Pure Python introspection toolkit for function signatures, dataclasses, and type hints**

[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/trissim/python-introspect/actions/workflows/ci.yml/badge.svg)](https://github.com/trissim/python-introspect/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/python-introspect.svg)](https://badge.fury.io/py/python-introspect)

## Features

- 🔍 **Function/Method Signature Analysis** - Extract parameter info from any callable
- 📦 **Dataclass Field Extraction** - Analyze dataclass fields and types
- 📝 **Docstring Parsing** - Extract and parse docstrings (Google, NumPy, Sphinx styles)
- 🏷️ **Type Hint Resolution** - Resolve complex type hints and annotations
- 🎯 **Unified API** - Single interface for all parameter sources
- 🚀 **Pure Python** - No external dependencies, pure stdlib

## Installation

```bash
pip install python-introspect
```

## Quick Start

```python
from python_introspect import SignatureAnalyzer

def example_function(name: str, age: int = 25, *, active: bool = True):
    """
    Example function with parameters.
    
    Args:
        name: The person's name
        age: The person's age
        active: Whether the person is active
    """
    pass

# Analyze the function
analyzer = SignatureAnalyzer()
params = analyzer.analyze_function(example_function)

for param in params:
    print(f"{param.name}: {param.annotation} = {param.default}")
```

## Use Cases

- **Form Generation** - Generate UI forms from function signatures
- **API Documentation** - Auto-generate API docs from code
- **Configuration Validation** - Validate config against function parameters
- **Dynamic UI** - Build dynamic UIs based on function signatures
- **Parameter Analysis** - Analyze and validate function parameters

## Documentation

Full documentation available at: https://github.com/trissim/python-introspect

## Development

### Setup

```bash
# Clone the repository
git clone https://github.com/trissim/python-introspect.git
cd python-introspect

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode with dev dependencies
pip install -e ".[dev]"
```

### Running Tests

```bash
# Run all tests
pytest tests/

# Run with coverage
pytest tests/ --cov=python_introspect --cov-report=term --cov-report=html

# Run linting and formatting checks
ruff check src/ tests/
black --check src/ tests/
mypy src/python_introspect/
```

## Contributing

Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## Credits

Developed by Tristan Simas as part of the OpenHCS project.
