{"id":569,"library":"python-slugify","title":"Python Slugify","description":"Python-slugify is an actively maintained library that generates URL-friendly slugs from strings, with robust Unicode support. It is designed to create clean, human-readable, and SEO-friendly slugs by converting text, handling special characters, and replacing spaces. The library sees regular updates, with an average release cycle of approximately 71 days.","status":"active","version":"8.0.4","language":"python","source_language":"en","source_url":"https://github.com/un33k/python-slugify","tags":["slugification","unicode","string-manipulation","url-friendly","text-processing"],"install":[{"cmd":"pip install python-slugify","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required Python interpreter version for the library.","package":"python","version":">=3.10"},{"reason":"Default dependency for Unicode decoding (permissively licensed).","package":"text-unidecode","version":">=1.3"},{"reason":"Alternative, optional dependency for Unicode decoding. Note: this package is GPL licensed.","package":"Unidecode","version":">=1.1.1","optional":true}],"imports":[{"note":"A different, outdated Python 2-only package named 'slugify' (installed via `pip install slugify`) uses the same import path. Ensure you installed `python-slugify` to avoid conflicts and Python 3 incompatibility.","wrong":"from slugify import slugify","symbol":"slugify","correct":"from slugify import slugify"}],"quickstart":{"code":"from slugify import slugify\n\n# Basic usage\ntext = \"This is a Test String with Unicode: Lörem Ipsüm!\"\nslug = slugify(text)\nprint(f\"Basic Slug: {slug}\")\n\n# Custom separator\nslug_with_underscore = slugify(text, separator='_')\nprint(f\"Slug with underscore: {slug_with_underscore}\")\n\n# Max length\nshort_slug = slugify(\"A very very long title indeed\", max_length=10)\nprint(f\"Short Slug: {short_slug}\")\n\n# Keep unicode characters (requires allow_unicode=True)\nunicode_slug = slugify(\"你好世界\", allow_unicode=True)\nprint(f\"Unicode Slug: {unicode_slug}\")","lang":"python","description":"The primary `slugify` function is imported and used to convert strings into URL-friendly slugs. It supports various customization options like separators, maximum length, and preserving Unicode characters."},"warnings":[{"fix":"Ensure `pip uninstall slugify` is run if the wrong package was installed, then `pip install python-slugify`. If possible, avoid installing both packages in the same environment.","message":"There is a separate, older Python 2-only package also named `slugify` on PyPI. Installing `pip install slugify` will give you the wrong package. Always use `pip install python-slugify` to ensure you get the correct, actively maintained Python 3 library, as both packages use `from slugify import slugify` for import.","severity":"gotcha","affected_versions":"All versions of `python-slugify` when `slugify` (Python 2 package) is also present."},{"fix":"Upgrade your Python interpreter to 3.10 or newer, or pin `python-slugify` to a version compatible with your Python environment (e.g., `<7.0.0` for Python 3.6).","message":"Python 3.6 support was dropped in version 7.0.0. For the latest versions (8.x.x), the minimum required Python version is 3.10. Older Python versions should use earlier library releases.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"If GPL license is a concern, do not install `python-slugify[unidecode]`. The package works with the default `text-unidecode` which is permissively licensed.","message":"The optional `Unidecode` dependency (installed via `pip install python-slugify[unidecode]`) is GPL licensed. If your project's license is incompatible with GPL, ensure you do not install this extra. The default `text-unidecode` dependency is permissively licensed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review and update any custom `regex_pattern` configurations to align with the new 'disallowed characters' logic.","message":"The behavior of the `regex_pattern` parameter was inverted in version 6.0.1. It now defines characters to be *disallowed* rather than *allowed*. This changes how custom character filtering works.","severity":"breaking","affected_versions":">=6.0.1"}],"env_vars":null,"last_verified":"2026-05-12T15:25:21.300Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Use `from slugify import slugify` or `import slugify` to correctly import the library.","cause":"The user attempted to import the library using 'python_slugify' or 'python-slugify' instead of the correct package name, which is 'slugify'.","error":"ModuleNotFoundError: No module named 'python_slugify'"},{"fix":"Import the function directly using `from slugify import slugify` and then call `slugify(\"my string\")`, or if using `import slugify`, call `slugify.slugify(\"my string\")`.","cause":"The user imported the `slugify` module directly using `import slugify` and then attempted to call the module itself as a function, instead of calling the `slugify` function provided within the module.","error":"TypeError: 'module' object is not callable"},{"fix":"Ensure the input passed to the `slugify` function is always a string, converting other types using `str()` if needed (e.g., `slugify(str(my_number))`).","cause":"The `slugify` function received an input that was not a string or bytes-like object (e.g., an integer, list, or None) instead of the required text.","error":"TypeError: expected string or bytes-like object"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":4.6,"disk_size":"18.2M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":4.6,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.17,"mem_mb":5.4,"disk_size":"20.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":5.4,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":4.5,"disk_size":"11.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":4.5,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.1,"mem_mb":4.6,"disk_size":"11.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":4.4,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.07,"mem_mb":5.3,"disk_size":"17.7M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.08,"mem_mb":5.3,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}