Библиотека Python для генерации URL-дружественных слогов
python-slugify
A Python library and command-line tool that creates URL-friendly 'slugs' from unicode text, with a focus on robust transliteration.
Context
Developer
A software developer who uses the system either as a library in their Python code or as a command-line tool to generate slugs.
Context
text-unidecode
The default external dependency used for transliterating unicode characters into ASCII equivalents.
Context
Unidecode
An optional, alternative external dependency for unicode transliteration.
Context
The core component responsible for transforming Unicode text into a URL-friendly slug. It handles HTML entity conversion, Unicode normalization, character transliteration (via dependencies), regex-based character removal, stopword filtering, and truncation.
Component
slugify/slugify.py
Provides a command-line entry point for the system. It uses `argparse` to map command-line flags to the parameters of the 'Slugification Engine' and prints the result to standard output.
Component
slugify/__main__.py
Slugification Engine
A data component that provides pre-defined character transliteration rules for specific languages (e.g., Cyrillic, German, Greek). These rules can be passed to the 'Slugification Engine' via its `replacements` parameter.
Component
slugify/special.py
A comprehensive test suite using Python's unittest framework, executed via GitHub Actions CI pipelines. The pipeline runs across multiple Python versions (3.7-3.12, PyPy), performs linting (flake8, pycodestyle), and reports test coverage to Coveralls. This ensures code quality, correctness, and compatibility. A local format.sh script is also provided for developer convenience.
Component
.github/workflows/ci.yml
.github/workflows/main.yml
.github/workflows/dev.yml
Slugification Engine
Command-Line Interface
Подписывайтесь на Telegram Глеб про AI.