Metadata-Version: 2.4
Name: larzslug
Version: 0.1.0
Summary: Slugify text into URL/filename-safe slugs with Unicode transliteration and uniqueness. Pure Python, zero dependencies.
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzslug
Project-URL: Repository, https://github.com/larz-scripter/larzslug
Project-URL: Issues, https://github.com/larz-scripter/larzslug/issues
Keywords: slug,slugify,url,transliterate,ascii,unicode,permalink,filename,seo,zero-dependency
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzslug

**Slugify text into clean, URL/filename-safe slugs. Pure Python, zero deps.**

Turn any title into `a-clean-url-safe-slug`, correctly handling accented and
non-ASCII characters, with a helper to guarantee uniqueness against slugs you've
already used.

```python
from larzslug import slugify, unique_slug

slugify("Héllo, World! (2026)")            # 'hello-world-2026'
slugify("Straße")                          # 'strasse'
slugify("Café & Bar", separator="_")       # 'cafe_and_bar'
unique_slug("My Post", {"my-post", "my-post-2"})   # 'my-post-3'
```

## Why

- **Real transliteration.** `Héllo` → `hello`, `Straße` → `strasse`, `Øystein` →
  `oystein` — via Unicode decomposition plus a map for letters that don't
  decompose (ß, æ, ø, þ, …). Not just "drop non-ASCII".
- **Uniqueness built in.** `unique_slug(text, existing)` appends `-2`, `-3`, … so
  you never collide — exactly what you need for permalinks and filenames.
- **Word-safe truncation.** `max_length` trims back to a word boundary instead of
  cutting mid-word.
- **Zero dependencies.** No `python-slugify`, no `unidecode`.

## Install

```bash
pip install larzslug
```

## Usage

```python
from larzslug import slugify, unique_slug, transliterate

slugify("Top 10 Tips 2026")                       # 'top-10-tips-2026'
slugify("Hello World", separator="_")             # 'hello_world'
slugify("Keep Case", lowercase=False)             # 'Keep-Case'
slugify("very long title ...", max_length=30)     # word-safe cut
transliterate("naïve café")                       # 'naive cafe'
unique_slug("My Post", existing_slugs)            # collision-free
```

## Tests

```bash
python -m unittest discover -s tests -v   # 17 tests
```

## The Larz stack

One of 30+ pure-Python, zero-dependency libraries at
[github.com/larz-scripter](https://github.com/larz-scripter) — pairs with
[larzmark](https://github.com/larz-scripter/larzmark).

## License

MIT © larz-scripter
