From ae6a0a61ae3bf25fa248ae7608e5d26e7d0ccda4 Mon Sep 17 00:00:00 2001 From: "Val Neekman (AvidCoder)" Date: Mon, 31 Jan 2022 16:02:39 -0500 Subject: [PATCH] Drop PY2.7 --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++ .github/workflows/dev.yml | 54 ++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 52 +++++++++++++++++++++++++++++++ CHANGELOG.md | 64 ++++++++++++++++++++------------------ requirements.txt | 5 ++- setup.py | 11 +++---- uuslug/__init__.py | 2 +- uuslug/apps.py | 2 +- uuslug/models.py | 4 +-- uuslug/tests/tests.py | 10 +++--- uuslug/uuslug.py | 6 +--- 11 files changed, 208 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ae65611 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: (CI) + +on: + push: + branches: + - ci + +jobs: + build: + name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3] + django-version: [2.2, 3.0, 3.1, 3.2, 4.0] + exclude: + # excludes list + - python-version: 3.6 + django-version: 4.0 + - python-version: 3.7 + django-version: 4.0 + - python-version: pypy3 + django-version: 4.0 + + steps: + - uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install coveralls + pip install "django~=${{ matrix.django-version }}.0" + - name: Run flake8 + run: | + pip install flake8 + flake8 --exclude=migrations,tests --ignore=E501,E241,E225,E128 . + - name: Run pycodestyle + run: | + pip install pycodestyle + pycodestyle --exclude=migrations,tests --ignore=E501,E241,E225,E128 . + - name: Run test + run: | + coverage run --source=ipware manage.py test + - name: Coveralls + run: coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..956ef6f --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,54 @@ +name: DEV + +# Run on push only for dev/sandbox +# Otherwise it may trigger concurrently `push & pull_request` on PRs. +on: + push: + branches: + - sandbox + - dev + +jobs: + build: + name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3] + django-version: [2.2, 3.0, 3.1, 3.2, 4.0] + exclude: + # excludes list + - python-version: 3.6 + django-version: 4.0 + - python-version: 3.7 + django-version: 4.0 + - python-version: pypy3 + django-version: 4.0 + + steps: + - uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install coveralls + pip install "django~=${{ matrix.django-version }}.0" + - name: Run flake8 + run: | + pip install flake8 + flake8 --exclude=migrations,tests --ignore=E501,E241,E225,E128 . + - name: Run pycodestyle + run: | + pip install pycodestyle + pycodestyle --exclude=migrations,tests --ignore=E501,E241,E225,E128 . + - name: Run test + run: | + coverage run --source=ipware manage.py test + - name: Coveralls + run: coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..1ef58da --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: MAIN + +# Run on push only for main +# Otherwise it may trigger concurrently `push & pull_request` on PRs. +on: + push: + branches: + - master + +jobs: + build: + name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3] + django-version: [2.2, 3.0, 3.1, 3.2, 4.0] + exclude: + # excludes list + - python-version: 3.6 + django-version: 4.0 + - python-version: 3.7 + django-version: 4.0 + - python-version: pypy3 + django-version: 4.0 + steps: + - uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install coveralls + pip install "django~=${{ matrix.django-version }}.0" + - name: Run flake8 + run: | + pip install flake8 + flake8 --exclude=migrations,tests --ignore=E501,E241,E225,E128 . + - name: Run pycodestyle + run: | + pip install pycodestyle + pycodestyle --exclude=migrations,tests --ignore=E501,E241,E225,E128 . + - name: Run test + run: | + coverage run --source=ipware manage.py test + - name: Coveralls + run: coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb14ab..31ac9b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,105 +1,109 @@ +## 2.0.0 + +Maintenance: + +- Up version python-slugify, remove support for old Django versions +- Python 2.7 support dropped + ## 1.2.0 Maintenance: - - Up version python-slugify, remove support for old Django versions - +- Up version python-slugify, remove support for old Django versions + ## 1.1.8 Maintenance: - - Up version python-slugify +- Up version python-slugify ## 1.1.7 Enhancement: - - Fix: False alarm on model/instance check. (@titusz) + +- Fix: False alarm on model/instance check. (@titusz) ## 1.1.6 Maintenance: - - Up version python-slugify, fixed broken status links on github +- Up version python-slugify, fixed broken status links on github ## 1.1.5 Enhancement: - - Ability to remove `stopwords` from string - - Ability to auto truncate string to match model field's max_length +- Ability to remove `stopwords` from string +- Ability to auto truncate string to match model field's max_length ## 1.0.5 Fix: - - PyPI Cleanup +- PyPI Cleanup ## 1.0.4 Enhancement: - - Added option to save word order - - Added more tests - - Added Django 1.8 and dropped unsupported Django +- Added option to save word order +- Added more tests +- Added Django 1.8 and dropped unsupported Django ## 1.0.3 Enhancement: - - Support pypy - - Support Django 1.7 - - More test cases - - Update slugify +- Support pypy +- Support Django 1.7 +- More test cases +- Update slugify ## 1.0.2 Enhancement: - - PEP8 Compliant +- PEP8 Compliant ## 1.0.1 Enhancement: - - Added support for Django 1.6.1 - - Added support for Python 3.x +- Added support for Django 1.6.1 +- Added support for Python 3.x Misc: - - Dropped support for Django<=1.4.10 - - Dropped support for Python 2.6 +- Dropped support for Django<=1.4.10 +- Dropped support for Python 2.6 ## 1.0.0 Enhancement: - - Support Django>=1.6 - +- Support Django>=1.6 ## 0.2.0 Features: - - Added an option to choose a non-dash separator - +- Added an option to choose a non-dash separator ## 0.1.0 Features: - - Added the ability to truncate slugs - +- Added the ability to truncate slugs ## 0.0.9 Enhancement: - -- Removed buildout dependency - -- Move Unicode Slug functionality into its own python-slugify module - +-- Removed buildout dependency +-- Move Unicode Slug functionality into its own python-slugify module ## 0.0.1 Features: - - Initial Release +- Initial Release diff --git a/requirements.txt b/requirements.txt index 4728a47..551057a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -Django>=1.8 -python-slugify>=1.2.1 -six>=1.13.0 \ No newline at end of file +Django>=2.2.26 +python-slugify>=5.0.0 diff --git a/setup.py b/setup.py index 011387b..81b3bab 100755 --- a/setup.py +++ b/setup.py @@ -14,20 +14,19 @@ url = 'https://github.com/un33k/django-uuslug' author = 'Val Neekman' author_email = 'info@neekware.com' license = 'BSD' -install_requires = ['python-slugify>=1.2.0'] +install_requires = ['python-slugify>=5.0.0'] classifiers = [ 'Development Status :: 5 - Production/Stable', - 'Framework :: Django :: 1.11', - 'Framework :: Django :: 2.1', - 'Framework :: Django :: 2.2', 'Intended Audience :: Developers', + 'Topic :: Software Development :: Build Tools', 'License :: OSI Approved :: MIT License', - 'Operating System :: POSIX', + 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', ] diff --git a/uuslug/__init__.py b/uuslug/__init__.py index 0463583..b82fa59 100644 --- a/uuslug/__init__.py +++ b/uuslug/__init__.py @@ -2,6 +2,6 @@ from .uuslug import * # noqa __author__ = 'Val Neekman @ Neekware Inc. [@vneekman]' __description__ = 'A Python slugify application that also handles Unicode' -__version__ = '1.2.0' +__version__ = '2.0.0' default_app_config = 'uuslug.apps.AppConfig' diff --git a/uuslug/apps.py b/uuslug/apps.py index f24c56d..440f11f 100644 --- a/uuslug/apps.py +++ b/uuslug/apps.py @@ -1,5 +1,5 @@ from django.apps import AppConfig as DjangoAppConfig -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(DjangoAppConfig): diff --git a/uuslug/models.py b/uuslug/models.py index 29a15fe..98ed7f1 100644 --- a/uuslug/models.py +++ b/uuslug/models.py @@ -50,7 +50,7 @@ if 'testsettings' in os.environ['DJANGO_SETTINGS_MODULE']: self.slug = uuslug(self.name, instance=self, start_no=2, max_length=17, word_boundary=True) super(SmartTruncatedSlug, self).save(*args, **kwargs) - class SmartTruncatedExactWordBoundrySlug(models.Model): + class SmartTruncatedExactWordBoundarySlug(models.Model): name = models.CharField(max_length=19) slug = models.CharField(max_length=19) @@ -59,7 +59,7 @@ if 'testsettings' in os.environ['DJANGO_SETTINGS_MODULE']: def save(self, *args, **kwargs): self.slug = uuslug(self.name, instance=self, start_no=9, max_length=19, word_boundary=True) - super(SmartTruncatedExactWordBoundrySlug, self).save(*args, **kwargs) + super(SmartTruncatedExactWordBoundarySlug, self).save(*args, **kwargs) class CoolSlugDifferentSeparator(models.Model): name = models.CharField(max_length=100) diff --git a/uuslug/tests/tests.py b/uuslug/tests/tests.py index 3509d37..88ebfbe 100644 --- a/uuslug/tests/tests.py +++ b/uuslug/tests/tests.py @@ -7,7 +7,7 @@ from django.test import TestCase from uuslug import slugify, uuslug from uuslug.models import (CoolSlug, AnotherSlug, TruncatedSlug, - SmartTruncatedExactWordBoundrySlug, + SmartTruncatedExactWordBoundarySlug, CoolSlugDifferentSeparator, TruncatedSlugDifferentSeparator, AutoTruncatedSlug) @@ -186,16 +186,16 @@ class SlugUniqueTestCase(TestCase): obj = TruncatedSlug.objects.create(name=name) self.assertEqual(obj.slug, "jaja-lol-mememe-3") # 17 is max_length - def test_max_length_exact_word_boundry(self): + def test_max_length_exact_word_boundary(self): name = 'jaja---lol-méméméoo--a' - obj = SmartTruncatedExactWordBoundrySlug.objects.create(name=name) + obj = SmartTruncatedExactWordBoundarySlug.objects.create(name=name) self.assertEqual(obj.slug, "jaja-lol-mememeoo-a") # 19 is max_length - obj = SmartTruncatedExactWordBoundrySlug.objects.create(name=name) + obj = SmartTruncatedExactWordBoundarySlug.objects.create(name=name) self.assertEqual(obj.slug, "jaja-lol-mememeoo-9") # 19 is max_length, start_no = 9 - obj = SmartTruncatedExactWordBoundrySlug.objects.create(name=name) + obj = SmartTruncatedExactWordBoundarySlug.objects.create(name=name) self.assertEqual(obj.slug, "jaja-lol-mememeo-10") # 19 is max_length, readjust for "-10" diff --git a/uuslug/uuslug.py b/uuslug/uuslug.py index 215ddb3..8f34160 100644 --- a/uuslug/uuslug.py +++ b/uuslug/uuslug.py @@ -1,10 +1,6 @@ from django.db.models.base import ModelBase from slugify import slugify as pyslugify -import six -if six.PY3: - from django.utils.encoding import smart_str -else: - from django.utils.encoding import smart_unicode as smart_str +from django.utils.encoding import smart_str __all__ = ['slugify', 'uuslug']