Registry / web-framework / slugify

slugify

JSON →
library0.0.1pypypi✓ verified 85d ago

Slugify (version 0.0.1) is a legacy Python library for generating URL-friendly 'slugs' from strings, primarily for Latin-based scripts. Inspired by Django's `slugify` template filter, it provides a Python function and a command-line tool. The library is considered abandoned and only officially supports Python 2.

pip install slugify
INSTALL
IMPORT
SIG · SLUGIFY
S
slugify
web-frameworkpythonv0.0.1
Install
2.4s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

slugify
from slugify import slugify
from python_slugify import slugify
This specific 'slugify' package imports directly as 'slugify', which conflicts with the more common 'python-slugify' package if both are installed.

A simple example demonstrating the use of the `slugify` function. Note that this library is Python 2 only. Running it in Python 3 will result in errors related to the `unicode()` function.

import sys # This library is for Python 2. Running in Python 3 will cause a NameError. # To test, ensure you are in a Python 2 environment. if sys.version_info.major == 2: from slugify import slugify text_to_slug = u"Hello World! This is a Test 123" slugged_text = slugify(text_to_slug) print("Original:", text_to_slug) print("Slugged:", slugged_text) else: print("This quickstart requires Python 2. Current Python version is", sys.version)
slugify --version
Debug
Known issues
breakingThis `slugify` library (version 0.0.1) is only compatible with Python 2. Attempting to use it in a Python 3 environment will lead to runtime errors, most notably `NameError: name 'unicode' is not defined`.
fix
Use a Python 2 interpreter or, preferably, switch to a modern, Python 3-compatible slugification library like `python-slugify`.
affects: 0.0.1 and likely all subsequent (if any) versions; affects Python 3 environments
gotchaThere is a significant name collision with the more actively maintained and widely used `python-slugify` library. Both packages attempt to expose the `slugify` function via `from slugify import slugify` which can lead to unpredictable behavior and importing the wrong library if both are installed.
fix
Always uninstall `slugify` (the 0.0.1 package) if you intend to use `python-slugify`. Ensure you only have one slugification library installed if they share the same top-level import name.
affects: All versions of `slugify` (0.0.1) and `python-slugify` when installed concurrently.
gotchaThis library is designed for Latin-based scripts only and offers limited to no support for Unicode characters or internationalization. Non-Latin characters will often be stripped or replaced incorrectly, resulting in unusable slugs.
fix
For robust Unicode support, use `python-slugify`, which has built-in or optional dependencies for comprehensive transliteration (e.g., `text-unidecode` or `Unidecode`).
affects: 0.0.1
Errors
Common errors & fixes
NameError: name 'unicode' is not defined
The `slugify` library (0.0.1) uses Python 2's `unicode()` built-in function, which was removed in Python 3.
fix
Run your code in a Python 2 environment. If you need Python 3 support, use `pip uninstall slugify` and then install a Python 3 compatible alternative, such as `pip install python-slugify`.
from slugify import slugify AttributeError: module 'slugify' has no attribute 'slugify' (or similar unexpected behavior)
You likely have multiple packages providing a 'slugify' module (e.g., both 'slugify' and 'python-slugify') installed. The Python interpreter might be importing the wrong one due to package naming conflicts.
fix
Identify which 'slugify' package you intend to use. If it's `python-slugify`, then `pip uninstall slugify` (the old package) and ensure only `python-slugify` is installed.
slugify('你好世界') -> '---' (or similar unhelpful output for non-Latin characters)
The `slugify` library (0.0.1) lacks proper Unicode transliteration and is designed for Latin-based scripts. It often replaces non-Latin characters with hyphens or removes them.
fix
For international character support, switch to `python-slugify`. It offers more comprehensive Unicode handling, often leveraging libraries like `text-unidecode` for accurate transliteration.
Upgrade
Version history
0.0.1latest on PyPI · released Dec 7, 2010
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Resources
slugify — pip install slugify · libregistry