Metadata-Version: 2.4
Name: sndtk
Version: 0.1.1
Summary: Add your description here
Author-email: Mirei Itaya <mirei.itaya@gmail.com>
License: Copyright 2025 Mirei Itaya
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE
Keywords: coverage,management,specification,test
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Requires-Dist: pathspec>=0.12.1
Requires-Dist: pydantic>=2.12.4
Requires-Dist: tomli>=2.0.1
Description-Content-Type: text/markdown

Sandhittiko: self-evident and visible test case management tool.

## Overview

Sandhittiko (sndtk) is a Python test case management tool that helps you maintain test coverage by tracking test specifications in JSON files. It analyzes your Python code, identifies functions that need test coverage, and generates test specifications that can be used to guide test implementation.

## Features

- **Function Discovery**: Automatically parses Python files and extracts function definitions (including nested functions and class methods)
- **Test Specification Management**: Maintains test specifications in JSON files (`*_spec.json`) alongside your source code
- **Coverage Reporting**: Reports which functions have test coverage and which scenarios are missing
- **Spec Generation**: Automatically creates test specifications for uncovered functions
- **Smart Filtering**: Filters out test files, gitignored files, and configurable patterns

## Installation

```bash
# Using uv (recommended)
uv sync

# Or using pip
pip install -e .
```

## Usage

### Basic Usage

Scan the project and report test coverage:

```bash
sndtk --root .
```

### Find First Uncovered Function

Find the first function that needs test coverage:

```bash
sndtk --root . --first
```

### Create Test Specification

Create a test specification for the first uncovered function:

```bash
sndtk --root . --create --first
```

### Target Specific Function

Analyze a specific function:

```bash
sndtk --root . --target path/to/file.py::function_name
sndtk --root . --target path/to/file.py::ClassName::method_name
```

### Verbose Output

Get more detailed logging:

```bash
sndtk --root . -v    # INFO level
sndtk --root . -vv   # DEBUG level
```

## Project Structure

```
sndtk/
├── filters/      # File filtering (gitignore, patterns, config)
├── parsers/      # Python code parsing (AST-based)
├── report/       # Test coverage reporting
└── spec/         # Test specification management
```

## Configuration

Configure file exclusions in `pyproject.toml`:

```toml
[tool.sndtk]
exclude = ["*_test.py", "conftest.py"]
```

## How It Works

1. **Parsing**: Uses Python's AST to extract all function definitions from `.py` files
2. **Specification**: Test specifications are stored in `*_spec.json` files containing:
   - Function identifiers
   - Test scenarios with descriptions
   - Test file paths
3. **Reporting**: Compares parsed functions against specifications and checks if test functions exist
4. **Filtering**: Applies multiple filters to exclude test files and other unwanted files

## Test Specification Format

Test specifications are stored in JSON files (e.g., `module_spec.json`):

```json
{
  "filepath": "path/to/module.py",
  "testpath": "path/to/module_test.py",
  "functions": [
    {
      "identifier": "function_name",
      "scenarios": [
        {
          "testname": "test__function_name__placeholder_scenario0",
          "description": "Placeholder scenario 0..."
        }
      ]
    }
  ]
}
```

## Requirements

- Python >= 3.11
- pathspec >= 0.12.1
- pydantic >= 2.12.4
- tomli >= 2.0.1

## Development

Install development dependencies:

```bash
uv sync --dev
```

Run tests:

```bash
pytest
```

Run type checking:

```bash
mypy sndtk
pyright sndtk
```

Run linting:

```bash
ruff check sndtk
```
