From b8be7d69119dcceb9a3e0ce64a509415737190ac Mon Sep 17 00:00:00 2001 From: Val Neekman Date: Sun, 3 Mar 2019 12:40:56 -0500 Subject: Promote text-unidecode to primary decoding api (#73) * enable raw re pattern * conditional text_unidecode install * update readme, changelog, manifest * update ci * readme * drop test for py 2.6 and 3.3 * clean up readme * readme * add support user-specific replacements (#66) thx * clean up, up version * add text-unidecode option as extra * Upgrade Unidecode, add text-unidecode as extra option (#71) * Add replacements option (#67) * add text-unidecode option as extra * remove req.txt files * Optional Extra Requirements (#72) * Add replacements option (#67) * Upgrade Unidecode, add text-unidecode as extra option (#71) * Add replacements option (#67) * add text-unidecode option as extra * remove req.txt files * use text-unidecode as primary decoding package * add dev reqs --- CHANGELOG.md | 5 +++++ README.md | 18 +++++------------- dev.requirements.txt | 1 + requirements.txt | 1 - requirements_alt.txt | 1 - setup.py | 9 +++------ slugify/__init__.py | 2 +- slugify/slugify.py | 4 ++-- 8 files changed, 17 insertions(+), 24 deletions(-) create mode 100644 dev.requirements.txt delete mode 100644 requirements.txt delete mode 100644 requirements_alt.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index e2eed12..b5a37aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.0.0 + - Upgrade Unidecode + - Promote text-unidecode as the primary decoding package + - Add Unidecode as an optional extra. "pip install python-slugify[unidecode]" + ## 2.0.1 - Add replacements option e.g. [['|', 'or'], ['%', 'percent'], ['-', '_']] (@andriyor) diff --git a/README.md b/README.md index bc4d9e8..13c94a7 100644 --- a/README.md +++ b/README.md @@ -15,24 +15,16 @@ Overview Notice ==================== -By default, this modules installs and uses [Unidecode](https://github.com/avian2/unidecode) *(GPL)* for its decoding needs. However if you wish to use [text-unidecode](https://github.com/kmike/text-unidecode) *(GPL & Perl Artistic)* instead, please ensure it is installed prior to `python-slugify` installation. +This module, by default installs and uses [text-unidecode](https://github.com/kmike/text-unidecode) *(GPL & Perl Artistic)* for its decoding needs. -In cases where both `Unidecode` and `text-unidecode` are installed, `Unidecode` is used as the default decoding module. +However, there is an alternative decoding package called [Unidecode](https://github.com/avian2/unidecode) *(GPL)*. It can be installed as `python-slugify[unidecode]` for those who prefer it. How to install ==================== - - 1. easy_install python-slugify - 2. pip install python-slugify - 3. git clone http://github.com/un33k/python-slugify - a. cd python-slugify - b. python setup.py install - 4. wget https://github.com/un33k/python-slugify/zipball/master - a. unzip the downloaded file - b. cd python-slugify-* - c. python setup.py install - + easy_install python-slugify |OR| easy_install python-slugify[unidecode] + -- OR -- + pip install python-slugify |OR| pip install python-slugify[unidecode] How to use ==================== diff --git a/dev.requirements.txt b/dev.requirements.txt new file mode 100644 index 0000000..f87605e --- /dev/null +++ b/dev.requirements.txt @@ -0,0 +1 @@ +pycodestyle==2.5.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 656daab..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Unidecode>=0.04.16 diff --git a/requirements_alt.txt b/requirements_alt.txt deleted file mode 100644 index 980e50a..0000000 --- a/requirements_alt.txt +++ /dev/null @@ -1 +0,0 @@ -text-unidecode>=1.2 \ No newline at end of file diff --git a/setup.py b/setup.py index ab59194..a78b672 100755 --- a/setup.py +++ b/setup.py @@ -7,12 +7,6 @@ import os import sys import codecs -install_requires = [] -try: - import text_unidecode -except ImportError: - install_requires.append('Unidecode>=0.04.16') - name = 'python-slugify' package = 'slugify' description = 'A Python Slugify application that handles Unicode' @@ -20,6 +14,8 @@ url = 'https://github.com/un33k/python-slugify' author = 'Val Neekman' author_email = 'info@neekware.com' license = 'MIT' +install_requires = ['text-unidecode==1.2'] +extras_require = {'unidecode': ['Unidecode==1.0.23']} classifiers = [ 'Development Status :: 5 - Production/Stable', @@ -70,6 +66,7 @@ setup( author_email=author_email, packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES), install_requires=install_requires, + extras_require=extras_require, classifiers=classifiers, entry_points={'console_scripts': ['slugify=slugify.slugify:main']}, ) diff --git a/slugify/__init__.py b/slugify/__init__.py index 7358b99..c2e205b 100644 --- a/slugify/__init__.py +++ b/slugify/__init__.py @@ -3,4 +3,4 @@ from .slugify import * __author__ = 'Val Neekman @ Neekware Inc. [@vneekman]' __description__ = 'A Python slugify application that also handles Unicode' -__version__ = '2.0.1' +__version__ = '3.0.0' diff --git a/slugify/slugify.py b/slugify/slugify.py index 59e9672..fcd1d22 100644 --- a/slugify/slugify.py +++ b/slugify/slugify.py @@ -14,9 +14,9 @@ except ImportError: unichr = chr try: - import unidecode -except ImportError: import text_unidecode as unidecode +except ImportError: + import unidecode __all__ = ['slugify', 'smart_truncate'] -- cgit v1.2.1