Slugger is slugging done right
Slugger solves the seemingly simple problem of turning a title into an url frienly slug:
>>> from slugger import Slugger
>>> s = Slugger(lang='en_US')
>>> s.sluggify(u'Headless-body-in-topless-bar')
u'headless-body-in-topless-bar'
Unlike many other slugging libraries, it also handles language-specific ascii-translation. Compare the ä, ö and ü in German
>>> s = Slugger(lang='de_DE')
>>> s.sluggify(u'Türöffner')
u'tueroeffner'
against Swedish:
>>> s = Slugger(lang='sv_SE')
>>> s.sluggify(u'Färsk Ägg')
u'farsk-agg'
Criterias of what makes a good slug vary, common requirements are a maximum length and a reduced character set that is highly URL-friendly.
To generate high-quality slugs, Slugger leverages the locale information from glibc (included in the package), the unihandecode library and some hand-written replacements.
>>> s = Slugger('en_US')
>>> s.sluggify(u'Bed & Breakfast')
u'bed-and-breakfast'
>>> s.sluggify(u'Folding@Home')
u'foldingathome'
These are also language-aware:
>>> s = Slugger('fr_FR')
>>> s.sluggify(u'Toi & Moi')
u'toi-et-moi'
Help out
If you find a badly generated slug, please report on github. Also, any help in implementing better support for more languages is appreciated; see the official documentation on how to get involved in development.
Metadata
Release files for slugger 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| slugger-0.2.2.tar.gz | 4.5 MB | Without provenance | Details for slugger-0.2.2.tar.gz |
Release files / slugger-0.2.2.tar.gz
| Download URL | slugger-0.2.2.tar.gz |
|---|---|
| Size | 4.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed4de21fa1978da42573f96b379e06051b9c837da4a46d4b4364beee680f3908
|
|
BLAKE2b-256 checksum How to use checksums |
18e4e91529925ac1c4b37802ce2c21c4a1f1df0eaa7c63934771f05d0297da17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for slugger 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.