Skip to content

slugany

Multi-language slugify with zero dependencies. A simple, MIT-licensed alternative to python-slugify without GPL dependencies.

Installation

pip install slugany

Requires Python 3.11 or later. No runtime dependencies.

Quickstart

from slugany import slugify

slugify("¡Hola Mundo!")        # "hola-mundo"
slugify("Café résumé naïve")   # "cafe-resume-naive"
slugify("Ñandú coração")       # "nandu-coracao"
slugify("Über Straße", lang="de")  # "ueber-strasse"

Features

  • Zero deps — no GPL, no text-unidecode, no UnicodeData beyond the stdlib
  • Multi-language — built-in tables for Spanish, Portuguese, German, French, and Italian
  • Confusable deconfusion — Cyrillic and Greek homoglyphs mapped to Latin via deconfuse()
  • Emoji modesstrip, text, or keep
  • Smart punctuation — normalizes curly quotes, em-dashes, NBSP, zero-width characters, bullets
  • Case styles — kebab, snake, camel, pascal, dot, train, filename
  • CSS-safe output — valid CSS identifiers even when the slug starts with a digit
  • CLI includedslugany "text" from the terminal with auto-stdin
  • Slugifier — reusable, preconfigured slugifier callable
  • lru_cache — results cached automatically (maxsize=512)
  • Idempotentslugify(slugify(x)) == slugify(x) guaranteed
  • Fully typed — type hints on every public API, py.typed marker included
  • ~550 lines core — auditable, no bloat

Next steps