Skip to main content

nano-slug

PyPI License Size CI

Tiny text → URL slug converter — ~1 KB, zero deps. Lowercases, strips accents, replaces whitespace/punct with -, collapses dashes. Perfect for code-golf, minimal containers, or just for fun.


✨ Features

  • ✅ Unicode → ASCII (Café au lait → cafe-au-lait)
  • ✅ Punctuation/whitespace → -, multi-dash collapse, trim ends
  • ✅ Returns slug if result would be empty
  • ✅ Zero dependencies • single tiny file • CLI included

🚀 Usage

# Local (from repo)
python app_min.py "Hello, World!"                        # hello-world
python app_min.py "Türkçe Çalışma — Şaşırtıcı!"          # turkce-calisma-sasirtici

After installing:

# CLI
pip install nano-slug
nano-slug "Café au lait"                                  # cafe-au-lait
echo "  multiple   spaces  " | nano-slug                  # multiple-spaces

🤓 Why so small?

  • Pure stdlib: unicodedata (NFKD) + tiny re replacements
  • No transliteration tables, no locale deps
  • Single tiny file + tiny CLI: perfect for scripts, containers, CI.

🎉 Fun Ideas

  • Batch rename files
for f in *.md; do mv "$f" "$(nano-slug "${f%.md}").md"; done
  • Make anchors for headings
awk '/^#/{sub(/^#* /,""); cmd="nano-slug \""$0"\""; cmd | getline s; close(cmd); print "- ["$0"]( #"s")"}' README.md
  • Slug from git branch
nano-slug "$(git rev-parse --abbrev-ref HEAD)"

Notes: ASCII-only output by design. Non-Latin scripts may collapse to empty → returns "slug".


📜 License

MIT © 2025

Release files for nano-slug 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nano-slug 0.1.1
File Size Uploaded
nano_slug-0.1.1.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nano-slug 0.1.1
File Interpreter ABI Platform
nano_slug-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / nano_slug-0.1.1.tar.gz

Download URL nano_slug-0.1.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d98a2f2c4a9e68073f38189aafc16e61373db98c6a59c46d32c465c65822fb9a
BLAKE2b-256 checksum
How to use checksums
cc6d5e00b0f5afbcf863f9a78bc882b22bce6b896f6e80b782057b8c6ca1f5d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / nano_slug-0.1.1-py3-none-any.whl

Download URL nano_slug-0.1.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe94ef944bfc6ab7bb7498ced466a50dbd3bda5248152968318cb256574be9eb
BLAKE2b-256 checksum
How to use checksums
28f4f1c575605085dc81344e472b2ef30131c8abc41c7f01dfc6af4903a793da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page