Skip to content

Commit

Permalink
Merge branch 'main' into release/2
Browse files Browse the repository at this point in the history
  • Loading branch information
vsalvino committed Jul 27, 2023
2 parents a9c64c5 + 9b3e7f9 commit 4a7f7e1
Show file tree
Hide file tree
Showing 29 changed files with 154 additions and 189 deletions.
25 changes: 16 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ stages:
vmImage: 'ubuntu-latest'
strategy:
matrix:
py3.7:
PYTHON_VERSION: '3.7'
py3.8:
py3.8_wag3:
PYTHON_VERSION: '3.8'
py3.9:
WAGTAIL: '3.*'
py3.9_wag4:
PYTHON_VERSION: '3.9'
py3.10:
WAGTAIL: '4.*'
py3.10_wag5:
PYTHON_VERSION: '3.10'
WAGTAIL: '5.*'
py3.11_wag5:
PYTHON_VERSION: '3.11'
WAGTAIL: '5.*'

steps:
- task: UsePythonVersion@0
Expand All @@ -46,7 +50,7 @@ stages:
versionSpec: '$(PYTHON_VERSION)'
architecture: 'x64'

- script: python -m pip install -r requirements-dev.txt
- script: python -m pip install -r requirements-dev.txt wagtail==$(WAGTAIL)
displayName: 'CR-QC: Install from local repo'

- script: |
Expand Down Expand Up @@ -86,7 +90,7 @@ stages:
- task: UsePythonVersion@0
displayName: 'Use Python version'
inputs:
versionSpec: '3.10'
versionSpec: '3.11'
architecture: 'x64'

- script: python -m pip install -r requirements-dev.txt
Expand All @@ -98,8 +102,11 @@ stages:
- script: flake8 .
displayName: 'CR-QC: Static analysis (flake8)'

- script: isort --check .
displayName: 'CR-QC: Format check (isort)'

- script: black --check .
displayName: 'CR-QC: Format check'
displayName: 'CR-QC: Format check (black)'

- script: mypy ./wagtailcache/
displayName: 'CR-QC: Type check (mypy)'
Expand Down Expand Up @@ -134,7 +141,7 @@ stages:
- task: UsePythonVersion@0
displayName: 'Use Python version'
inputs:
versionSpec: '3.10'
versionSpec: '3.11'
architecture: 'x64'

- script: python -m pip install -r requirements-dev.txt
Expand Down
15 changes: 2 additions & 13 deletions docs/_templates/sponsor.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
<a class="card mt-5" href="https://www.coderedcorp.com/"
style="font-size:0.9em; line-height: 1.2em; max-width: 275px; text-decoration:none;">
<div class="row no-gutters">
<div class="col-3">
<img src="https://docs.coderedcorp.com/logo-square-red-128.png" class="w-100" alt=""/>
</div>
<div class="col-9">
<p class="p-2 m-0">
<strong>Get Pro Support</strong><br>
This project is commercially supported by CodeRed.
</p>
</div>
</div>
<a href="https://www.codered.cloud/?utm_source=docs-wagtail-cache&utm_medium=banner">
<img src="https://docs.coderedcorp.com/crcloud-docs-ad.webp" alt="Wagtail Hosting by CodeRed" class="w-100">
</a>
40 changes: 17 additions & 23 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
"""
Configuration file for the Sphinx documentation builder.
This file does only contain a selection of the most common options. For a
full list see the documentation:
http://www.sphinx-doc.org/en/master/config
-- Path setup --------------------------------------------------------------
If extensions (or modules to document with autodoc) are in another directory,
add these directories to sys.path here. If the directory is relative to the
documentation root, use os.path.abspath to make it absolute, like shown here.
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
"""
import datetime

from wagtailcache import __shortversion__


Expand All @@ -23,31 +25,23 @@
project = "wagtail-cache"
author = "CodeRed LLC"
copyright = f"2018–{str(datetime.datetime.now().year)}, {author}"

# The short X.Y version
version = __shortversion__
# The full version, including alpha/beta/rc tags
release = __shortversion__


# -- General configuration ---------------------------------------------------

source_suffix = ".rst"

master_doc = "index"

language = "en"

exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

extensions = ["sphinx_wagtail_theme"]


# -- Options for HTML output -------------------------------------------------

html_show_sourcelink = False

html_theme = "sphinx_wagtail_theme"
Expand Down
4 changes: 3 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ development tools:
Write some code.

Next, run the static analysis tools (``flake8`` and ``mypy``)
Next, run the formatters and static analysis tools:

.. code-block:: console
$ isort .
$ black .
$ flake8 ./wagtailcache/
$ mypy ./wagtailcache/
Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started/hooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For example:

.. code-block:: python
from wagtail.core import hooks
from wagtail import hooks
@hooks.register("is_request_cacheable")
def nocache_in_query(request, curr_cache_decision):
Expand All @@ -54,7 +54,7 @@ For example:

.. code-block:: python
from wagtail.core import hooks
from wagtail import hooks
@hooks.register("is_response_cacheable")
def nocache_secrets(response, curr_cache_decision):
Expand Down
8 changes: 4 additions & 4 deletions docs/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ adding the Wagtail Cache middleware.
2. Define a cache
-----------------

Next a cache must be configured in the settings. If you use django-redis, see :doc:`Supported Cache Backends </getting_started/supported_backends>`. Here is an example file cache,
Next a cache must be configured in the settings. Here is an example file cache,
which is suitable for use on any web server:

.. code-block:: python
Expand Down Expand Up @@ -200,11 +200,11 @@ To this:
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from wagtail.core.urls import serve_pattern, WAGTAIL_FRONTEND_LOGIN_TEMPLATE
from wagtail.core import views as wagtail_views
from wagtail.urls import serve_pattern, WAGTAIL_FRONTEND_LOGIN_TEMPLATE
from wagtail import views as wagtail_views
from wagtailcache.cache import cache_page
# Copied from wagtail.core.urls:
# Copied from wagtail.urls:
url(r'^_util/authenticate_with_password/(\d+)/(\d+)/$', wagtail_views.authenticate_with_password,
name='wagtailcore_authenticate_with_password'),
url(r'^_util/login/$', auth_views.LoginView.as_view(template_name=WAGTAIL_FRONTEND_LOGIN_TEMPLATE),
Expand Down
13 changes: 0 additions & 13 deletions docs/getting_started/supported_backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ Built-in Django cache backends
Wagtail Cache may or may not work correctly with 3rd party backends. If you experience an issue, please
`report it on our GitHub page <https://github.com/coderedcorp/wagtail-cache/issues>`_.

django-redis
------------

Wagtail Cache provides a compatibility backend to support ``django-redis``. Install as follows:

#. Install wagtail-cache :doc:`following the installation guide </getting_started/install>`.

#. `Install django-redis <http://niwinz.github.io/django-redis/latest/#_user_guide>`_ and define
a Redis cache in your settings.py.

#. Replace ``django_redis.cache.RedisCache`` with ``wagtailcache.compat_backends.django_redis.RedisCache``
in your cache definition.

.. note::
If you are currently using Redis or have other code that uses a Redis cache, It is advised to use
separate cache definitions for wagtail-cache and your other uses.
10 changes: 9 additions & 1 deletion docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ Release Notes
=============


2.3.0
=====

* Support Wagtail 5 and Django 4.2.

* Remove ``django-redis`` compatibility backend. Django 4.0+ has a native redis backend.


2.2.0
=====

* Support Wagtail 4 and Django 4.1
* Support Wagtail 4 and Django 4.1.


2.1.1
Expand Down
16 changes: 15 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 80
target-version = ['py37', 'py38', 'py39', 'py310']
target-version = ['py38', 'py39', 'py310', 'py311']
# Regular expression of files to exclude.
exclude = '''
/(
Expand All @@ -9,3 +9,17 @@ exclude = '''
| migrations
)/
'''

[tool.isort]
force_alphabetical_sort_within_sections = true
force_single_line = true
lines_after_imports = 2
lines_before_imports = 0
lines_between_sections = 1
lines_between_types = 0
line_length = 80
profile = "black"
skip_gitignore = true
extend_skip = ["migrations"]
# Specific to this project
known_first_party = ["home", "wagtailcache"]
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
black
codespell
flake8
isort
mypy
pytest
pytest-cov
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exclude = .*,migrations

[mypy]
ignore_missing_imports = True
check_untyped_defs = True

[tool:pytest]
DJANGO_SETTINGS_MODULE = testproject.settings
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from setuptools import setup, find_packages
from setuptools import find_packages
from setuptools import setup

from wagtailcache import __version__


with open("README.md", encoding="utf8") as readme_file:
readme = readme_file.read()

Expand All @@ -16,7 +19,7 @@
license="BSD license",
include_package_data=True,
packages=find_packages(),
install_requires=["wagtail>=3.0,<5.0"],
install_requires=["wagtail>=3.0,<6"],
classifiers=[
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
Expand All @@ -27,5 +30,7 @@
"Framework :: Django",
"Framework :: Wagtail",
"Framework :: Wagtail :: 3",
"Framework :: Wagtail :: 4",
"Framework :: Wagtail :: 5",
],
)
1 change: 1 addition & 0 deletions testproject/home/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from wagtail.models import Page

from wagtailcache.cache import WagtailCacheMixin


Expand Down
Loading

0 comments on commit 4a7f7e1

Please sign in to comment.