Skip to content

Commit

Permalink
Add support for Django 3.2 / django CMS 3.10 (#35)
Browse files Browse the repository at this point in the history
* Add support for Django 3.2 / django CMS 3.10

* Fix tox docs environment

* Update minor formatting issues

* Exclude towncrier check on pre-commit CI
  • Loading branch information
yakky authored Aug 27, 2022
1 parent 63ed6b3 commit 69a346b
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 76 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ jobs:
python-version: [3.8]
toxenv: [pep8, isort, black, pypi-description, docs, towncrier]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.toxenv }}
- name: Cache tox
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-lint-${{ matrix.toxenv }}-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-lint-${{ matrix.toxenv }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox>=1.8
python -m pip install --upgrade pip setuptools tox>3.23
- name: Test with tox
run: |
tox -e${{ matrix.toxenv }}
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.toxenv }}
- name: Cache tox
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-tox-release-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-tox-release-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox>=1.8
python -m pip install --upgrade pip setuptools tox>3.23
- name: Build and publish
env:
TWINE_USERNAME: __token__
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,29 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.8, 3.7, 3.6]
django: [31, 30, 22]
cms: [38, 37]
python-version: [3.10.x, 3.9, 3.8, 3.7]
django: [32,22]
cms: [39,38,37]
exclude:
- django: 31
- django: 32
cms: 37
- django: 32
cms: 38
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.toxenv }}
- name: Cache tox
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-tox-${{ format('{{py{0}-django{1}-cms{2}}}', matrix.python-version, matrix.django, matrix.cms) }}-${{ hashFiles('setup.cfg') }}
Expand All @@ -37,7 +39,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get install gettext
python -m pip install --upgrade pip tox>=3.5
python -m pip install --upgrade pip tox>3.23
- name: Test with tox
env:
TOX_ENV: ${{ format('py-django{1}-cms{2}', matrix.python-version, matrix.django, matrix.cms) }}
Expand All @@ -48,11 +50,11 @@ jobs:
tox -e$TOX_ENV
.tox/$TOX_ENV/bin/coverage xml
.tox/$TOX_ENV/bin/coveralls
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
file: ./coverage.xml
files: ./coverage.xml
fail_ci_if_error: false
services:
redis:
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repos:
rev: v4.3.0
hooks:
- id: trailing-whitespace
exclude: "setup.cfg"
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
Expand Down Expand Up @@ -60,3 +61,6 @@ repos:
language: system
pass_filenames: false
always_run: true
ci:
skip:
- towncrier
15 changes: 3 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@ djangocms-page-tags

Tagged pages for django CMS 3

Python: 3.6, 3.7, 3.8
Python: 3.7, 3.8, 3.9, 3.10

Django: 2.2, 3.0, 3.1
Django: 2.2, 3.2

django CMS: 3.7, 3.8

.. warning:: Since version 0.9, the support for Python < 3.5, django CMS < 3.7
has been dropped.

.. warning:: Since version 0.8, the support for Python 3.4, django CMS < 3.6
has been dropped.

.. warning:: Since version 0.7, the support for Python 3.4 and Django<1.11
has been dropped.
django CMS: 3.7 - 3.11

**********
Quickstart
Expand Down
1 change: 1 addition & 0 deletions changes/33.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for Django 3.2 / django CMS 3.10
2 changes: 1 addition & 1 deletion djangocms_page_tags/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from cms.utils.i18n import get_language_list, get_language_object
from cms.utils.permissions import has_page_permission
from django.urls import NoReverseMatch, reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from .models import PageTags, TitleTags

Expand Down
10 changes: 5 additions & 5 deletions djangocms_page_tags/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.core.cache import cache
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from taggit_autosuggest.managers import TaggableManager

from .utils import get_cache_key
Expand All @@ -15,8 +15,8 @@ class PageTags(PageExtension):
tags = TaggableManager()

def copy_relations(self, oldinstance, language):
""" Needed to copy tags when publishing page """
self.tags.set(*oldinstance.tags.all())
"""Copy relation data on page publishc."""
self.tags.set(oldinstance.tags.all())

class Meta:
verbose_name = _("Page tags (all languages)")
Expand All @@ -27,8 +27,8 @@ class TitleTags(TitleExtension):
tags = TaggableManager()

def copy_relations(self, oldinstance, language):
""" Needed to copy tags when publishing page """
self.tags.set(*oldinstance.tags.all())
"""Copy relation data on page publish."""
self.tags.set(oldinstance.tags.all())

class Meta:
verbose_name = _("Page tags (language-dependent)")
Expand Down
9 changes: 4 additions & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-r requirements.txt
coverage<5.0
coveralls
-e .[docs]
coverage>5,<7.0
coveralls>2
mock>=1.0.1
flake8
django-app-helper>=2.2.2
django-app-helper>=2.0.0
24 changes: 12 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
current_version = 0.9.1.dev0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.?)(?P<release>[a-z]*)(?P<relver>\d*)
serialize =
serialize =
{major}.{minor}.{patch}.{release}{relver}
{major}.{minor}.{patch}
commit = True
Expand All @@ -12,7 +12,7 @@ message = Release {new_version}

[bumpversion:part:release]
optional_value = gamma
values =
values =
dev
a
b
Expand All @@ -25,7 +25,7 @@ values =
name = djangocms-page-tags
version = attr: djangocms_page_tags.__version__
url = https://github.com/nephila/djangocms-page-tags
project_urls =
project_urls =
Documentation = https://djangocms-page-tags.readthedocs.io/
author = Iacopo Spalletti
author_email = [email protected]
Expand All @@ -35,31 +35,31 @@ long_description_content_type = text/x-rst
license = BSD
license_file = LICENSE
keywords = djangocms-page-tags
classifiers =
classifiers =
Development Status :: 5 - Production/Stable
Framework :: Django
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Framework :: Django
Framework :: Django :: 2.2
Framework :: Django :: 3.0
Framework :: Django :: 3.1
Programming Language :: Python :: 3.6
Framework :: Django :: 3.2
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

[options]
include_package_data = True
install_requires =
install_requires =
django-cms>=3.7
django-taggit>=0.11.2
django-taggit-autosuggest
django-classy-tags>=0.3.4.1
setup_requires =
setup_requires =
setuptools
packages = djangocms_page_tags
python_requires = >=3.6
python_requires = >=3.7
test_suite = cms_helper.run
zip_safe = False

Expand All @@ -68,8 +68,8 @@ zip_safe = False
djangocms_page_tags = *.html *.png *.gif *js *jpg *jpeg *svg *py *mo *po

[options.extras_require]
docs =
django<3.1
docs =
django<4.0

[upload]
repository = https://upload.pypi.org/legacy/
Expand Down
22 changes: 11 additions & 11 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@task
def clean(c):
""" Remove artifacts and binary files. """
"""Remove artifacts and binary files."""
c.run("python setup.py clean --all")
patterns = ["build", "dist"]
patterns.extend(glob("*.egg*"))
Expand All @@ -25,19 +25,19 @@ def clean(c):

@task
def lint(c):
""" Run linting tox environments. """
"""Run linting tox environments."""
c.run("tox -epep8,isort,black,pypi-description")


@task # NOQA
def format(c): # NOQA
""" Run code formatting tasks. """
"""Run code formatting tasks."""
c.run("tox -eblacken,isort_format")


@task
def towncrier_check(c): # NOQA
""" Check towncrier files. """
"""Check towncrier files."""
output = io.StringIO()
c.run("git branch --contains HEAD", out_stream=output)
skipped_branch_prefix = ["pull/", "develop", "master", "HEAD"]
Expand Down Expand Up @@ -90,47 +90,47 @@ def towncrier_check(c): # NOQA

@task
def test(c):
""" Run test in local environment. """
"""Run test in local environment."""
c.run("python setup.py test")


@task
def test_all(c):
""" Run all tox environments. """
"""Run all tox environments."""
c.run("tox")


@task
def coverage(c):
""" Run test with coverage in local environment. """
"""Run test with coverage in local environment."""
c.run("coverage erase")
c.run("run setup.py test")
c.run("report -m")


@task
def tag_release(c, level):
""" Tag release version. """
"""Tag release version."""
c.run("bumpversion --list %s --no-tag" % level)


@task
def tag_dev(c, level="patch"):
""" Tag development version. """
"""Tag development version."""
c.run("bumpversion --list %s --message='Bump develop version [ci skip]' --no-tag" % level)


@task(pre=[clean])
def docbuild(c):
""" Build documentation. """
"""Build documentation."""
os.chdir("docs")
build_dir = os.environ.get("BUILD_DIR", "_build/html")
c.run("python -msphinx -W -b html -d _build/doctrees . %s" % build_dir)


@task(docbuild)
def docserve(c):
""" Serve docs at http://localhost:$DOCS_PORT/ (default port is 8000). """
"""Serve docs at http://localhost:$DOCS_PORT/ (default port is 8000)."""
from livereload import Server

server = Server()
Expand Down
Loading

0 comments on commit 69a346b

Please sign in to comment.