Metadata-Version: 2.4
Name: char-counter-alexxstep
Version: 0.1.0
Summary: Count unique characters in text or files
Author-email: Oleksiy Stypanets <astep2004@gmail.com>
License: MIT
License-File: LICENSE
Keywords: characters,cli,counter,text
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# Char Counter

A Python CLI tool and library for counting unique characters in text strings or files.

## Features

- ✅ Count unique characters in text strings
- ✅ Process text files
- ✅ Priority system: `--file` takes precedence over `--string`
- ✅ Comprehensive error handling
- ✅ Can be used as CLI tool or Python library

## Installation

```bash
pip install char-counter-alexxstep
```

## Usage

### Command Line Interface

Count unique characters in a string:

```bash
char-counter --string "abbbccdf"
# Output: 3
```

Count unique characters from a file:

```bash
char-counter --file path/to/file.txt
```

Priority rule - if both arguments provided, file takes precedence:

```bash
char-counter --string "ignored" --file data.txt
# Processes the file, ignores the string argument
```

### As Python Library

```python
from char_counter import count_unique_characters

# Count unique characters
result = count_unique_characters("abbbccdf")
print(result)  # Output: 3

# Characters that appear exactly once: a, d, f
```

### What are "unique characters"?

A character is considered **unique** if it appears **exactly once** in the text.

**Examples:**

- `"abbbccdf"` → 3 unique characters (a, d, f)
- `"aabbcc"` → 0 unique characters (all repeat)
- `"abc"` → 3 unique characters (all unique)

## Development

### Installation for Development

```bash
# Clone the repository
git clone https://git.foxminded.ua/python-web/task5_create_package.git
cd task5_create_package

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

### Running Tests

```bash
# Run all tests
python -m pytest tests/ -v

# Run with coverage
python -m pytest tests/ --cov=char_counter --cov-report=html
```

### Code Quality

This project uses `ruff` for linting and formatting:

```bash
# Format code
uvx ruff format .

# Check and fix linting issues
uvx ruff check . --fix
```

## Requirements

- Python 3.8 or higher
- No external dependencies for core functionality

## License

MIT License - see LICENSE file for details.

## Author

Oleksiy Stypanets (Alex Step)

## Project Structure

```
task5_create_package/
├── src/
│   └── char_counter/
│       ├── __init__.py      # Package initialization
│       ├── counter.py       # Core counting logic
│       └── cli.py           # Command-line interface
├── tests/
│   ├── test_counter.py      # Unit tests for counter
│   └── test_cli.py          # Tests for CLI with mocks
├── pyproject.toml           # Project configuration
├── README.md                # This file
└── LICENSE                  # MIT License
```
