Skip to content

Commit

Permalink
Add support for Django 4.2 / django CMS 3.11 (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Apr 20, 2023
1 parent 615491d commit d37c2db
Show file tree
Hide file tree
Showing 28 changed files with 149 additions and 167 deletions.
22 changes: 22 additions & 0 deletions .bumpversion.cfg
@@ -0,0 +1,22 @@
[bumpversion]
current_version = 0.10.1.dev1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.?)(?P<release>[a-z]*)(?P<relver>\d*)
serialize =
{major}.{minor}.{patch}.{release}{relver}
{major}.{minor}.{patch}
commit = True
tag = True
sign_tags = True
tag_name = {new_version}
message = Release {new_version}

[bumpversion:part:release]
optional_value = gamma
values =
dev
a
b
rc
gamma

[bumpversion:file:djangocms_apphook_setup/__init__.py]
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Expand Up @@ -8,26 +8,26 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
python-version: [3.8]
toxenv: [pep8, isort, black, pypi-description, towncrier]
python-version: ["3.11.x"]
toxenv: [ruff, 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') }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Expand Up @@ -8,20 +8,20 @@ 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') }}
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/test.yml
Expand Up @@ -8,27 +8,29 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.7, 3.6]
django: [31, 30, 22]
cms: [38, 37]
python-version: ["3.11", "3.10", "3.9"]
django: [42, 41, 32]
cms: [311, 39]
exclude:
- django: 31
cms: 37
- django: 41
cms: 39
- django: 42
cms: 39
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 Down
43 changes: 17 additions & 26 deletions .pre-commit-config.yaml
Expand Up @@ -3,9 +3,10 @@
exclude: "(.idea|node_modules|.tox)"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: "setup.cfg"
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
Expand All @@ -16,42 +17,29 @@ repos:
- id: fix-encoding-pragma
args:
- --remove
- repo: https://github.com/timothycrosley/isort
rev: "5.6.4"
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 23.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.262'
hooks:
- id: flake8
additional_dependencies:
- flake8-broken-line
- flake8-bugbear
- flake8-builtins
- flake8-coding
- flake8-commas
- flake8-comprehensions
- flake8-eradicate
- flake8-quotes
- flake8-tidy-imports
- pep8-naming
- repo: https://github.com/econchick/interrogate
rev: 1.3.2
hooks:
- id: interrogate
args:
- "-cpyproject.toml"
- "--quiet"
- id: ruff
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.4
rev: v3.3.1
hooks:
- id: pyupgrade
args:
- --py3-plus
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.13.0"
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
- repo: local
hooks:
- id: towncrier
Expand All @@ -60,3 +48,6 @@ repos:
language: system
pass_filenames: false
always_run: true
ci:
skip:
- towncrier
1 change: 1 addition & 0 deletions changes/16.feature
@@ -0,0 +1 @@
Add support for Django 4.2 / django CMS 3.11
1 change: 0 additions & 1 deletion djangocms_apphook_setup/base.py
Expand Up @@ -4,7 +4,6 @@


class AutoCMSAppMixin:

auto_setup = {
"enabled": True,
"home title": None,
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Expand Up @@ -28,3 +28,22 @@ verbose = 0
quiet = false
whitelist-regex = []
color = true

[tool.isort]
profile = "black"
combine_as_imports = true
default_section = "THIRDPARTY"
force_grid_wrap = 0
include_trailing_comma = true
known_first_party = "knocker"
line_length = 119
multi_line_output = 3
use_parentheses = true

[tool.ruff]
ignore = []
line-length = 119
target-version = "py310"

[tool.ruff.mccabe]
max-complexity = 10
47 changes: 13 additions & 34 deletions setup.cfg
@@ -1,26 +1,3 @@
[bumpversion]
current_version = 0.10.1.dev1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.?)(?P<release>[a-z]*)(?P<relver>\d*)
serialize =
{major}.{minor}.{patch}.{release}{relver}
{major}.{minor}.{patch}
commit = True
tag = True
sign_tags = True
tag_name = {new_version}
message = Release {new_version}

[bumpversion:part:release]
optional_value = gamma
values =
dev
a
b
rc
gamma

[bumpversion:file:djangocms_apphook_setup/__init__.py]

[metadata]
name = djangocms-apphook-setup
version = attr: djangocms_apphook_setup.__version__
Expand All @@ -34,18 +11,20 @@ license = BSD
license_file = LICENSE
keywords = djangocms-apphook-setup, django CMS, apphook
classifiers =
Development Status :: 4 - Beta
Framework :: Django
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Framework :: Django
Framework :: Django :: 2.2
Framework :: Django :: 3.0
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Development Status :: 5 - Production/Stable
Framework :: Django
Framework :: Django :: 3.2
Framework :: Django :: 4.1
Framework :: Django :: 4.2
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11

[options]
include_package_data = True
Expand All @@ -54,7 +33,7 @@ install_requires =
setup_requires =
setuptools
packages = djangocms_apphook_setup
python_requires = >=3.6
python_requires = >=3.7
test_suite = cms_helper.run
zip_safe = False

Expand Down
20 changes: 10 additions & 10 deletions tasks.py
Expand Up @@ -12,7 +12,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 @@ -23,19 +23,19 @@ def clean(c):

@task
def lint(c):
""" Run linting tox environments. """
c.run("tox -epep8,isort,black,pypi-description")
"""Run linting tox environments."""
c.run("tox -eruff,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 @@ -88,31 +88,31 @@ 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)
2 changes: 1 addition & 1 deletion tests/sample_app_1/cms_appconfig.py
Expand Up @@ -3,7 +3,7 @@
from app_data import AppDataForm
from django import forms
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class AppConfig(AppHookConfig):
Expand Down
2 changes: 1 addition & 1 deletion tests/sample_app_1/cms_apps.py
@@ -1,6 +1,6 @@
from aldryn_apphooks_config.app_base import CMSConfigApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from djangocms_apphook_setup.base import AutoCMSAppMixin

Expand Down
4 changes: 2 additions & 2 deletions tests/sample_app_1/urls.py
@@ -1,7 +1,7 @@
from django.conf.urls import url
from django.urls import path

from .views import BaseView

urlpatterns = [
url(r"^$", BaseView.as_view(), name="base-view-1"),
path("", BaseView.as_view(), name="base-view-1"),
]
2 changes: 1 addition & 1 deletion tests/sample_app_2/cms_apps.py
@@ -1,6 +1,6 @@
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from djangocms_apphook_setup.base import AutoCMSAppMixin

Expand Down

0 comments on commit d37c2db

Please sign in to comment.