Metadata-Version: 2.4
Name: textutils-hytlot
Version: 1.0.0
Summary: A small Python library of text manipulation functions.
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: black>=24.0; extra == "dev"
Requires-Dist: ruff>=0.5; extra == "dev"
Dynamic: license-file

# TextUtils

TextUtils is a simple Python library that provides useful text manipulation functions.

## Features

- **Word count:** Count the number of words in a text.
- **Character count:** Count the number of characters in a text.
- **Reverse text:** Reverse the characters in a string.
- **Capitalize words:** Capitalize the first letter of each word.
- **Truncate text:** Shorten text to a maximum length, including a configurable suffix.

## Project structure

```text
textutils/
├── textutils/
│   ├── __init__.py
│   ├── transform.py
│   ├── casing/
│   │   ├── __init__.py
│   │   └── _capitalize.py
│   └── truncation/
│       ├── __init__.py
│       └── _truncate.py
├── tests/
│   ├── test_casing.py
│   ├── test_transform.py
│   └── test_truncate.py
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── pyproject.toml
└── README.md
```

## Installation

Clone the repository:

```bash
git clone https://github.com/hytlot/textutils.git
cd textutils
```

Install the project in editable mode:

```bash
python -m pip install -e .
```

## Usage

```python
from textutils.transform import word_count, character_count, reverse
from textutils.casing import capitalize_words
from textutils import truncate

text = "hello open source"

print(word_count(text))         # 3
print(character_count(text))    # 17
print(reverse(text))            # ecruos nepo olleh
print(capitalize_words(text))   # Hello Open Source
print(truncate("Hello World", 8))  # Hello...
```

## Development

Install the project with its development tools:

```bash
python -m pip install -e ".[dev]"
```

Run the tests with coverage:

```bash
python -m pytest --cov --cov-report=term-missing
```

Check formatting and code quality:

```bash
python -m black --check .
python -m ruff check .
```

## License

This project is distributed under the MIT License. See the `LICENSE` file for details.
