From b4f7be2199bd3811844828881f6d374224d44c55 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 15 Oct 2021 09:30:21 +0200 Subject: [PATCH 1/5] Remove support for py37 --- .github/workflows/python-tests.yml | 2 +- docs/changelog.rst | 2 +- setup.cfg | 3 +-- tox.ini | 7 +++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index c9972b5..d3ff4be 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9, "3.10"] + python-version: [3.8, 3.9, "3.10"] steps: - uses: actions/checkout@v2 diff --git a/docs/changelog.rst b/docs/changelog.rst index fe56ed4..326bbc8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,7 +7,7 @@ Version 2.3.dev Not released yet. -Sigal now requires Python 3.7+. +Sigal now requires Python 3.8+. - Add option ``max_img_pixels`` to allow processing huge images (sets ``PIL.Image.MAX_IMAGE_PIXELS``) [:issue:`431`]. diff --git a/setup.cfg b/setup.cfg index e0b3ca7..9166e60 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,7 +15,6 @@ classifiers = License :: OSI Approved :: MIT License Operating System :: OS Independent Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 @@ -27,7 +26,7 @@ classifiers = zip_safe = False include_package_data = True packages = find: -python_requires = >=3.7 +python_requires = >=3.8 install_requires = blinker click diff --git a/tox.ini b/tox.ini index 7eb42ef..8e1bbdf 100644 --- a/tox.ini +++ b/tox.ini @@ -5,16 +5,15 @@ isolated_build = true [gh-actions] python = - 3.7: py37-pillow71 - 3.8: py38-pillow-latest, check - 3.9: py39-pillow-latest + 3.8: py38-pillow71, check + 3.9: py39-pillow80 3.10: py310-pillow-latest pypy3: pypy3 [testenv] deps = - pillow70: Pillow==7.0.0 pillow71: Pillow==7.1.0 + pillow80: Pillow==8.0.0 extras = all tests From 441388cf8f94ceaa4da0c5239c613ef0b10d2c65 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 15 Oct 2021 12:34:29 +0200 Subject: [PATCH 2/5] Replace cached_property with the stdlib one --- sigal/gallery.py | 2 +- sigal/plugins/zip_gallery.py | 2 +- sigal/utils.py | 21 --------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/sigal/gallery.py b/sigal/gallery.py index 048f0ef..96c2585 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -33,6 +33,7 @@ import random import sys from collections import defaultdict from datetime import datetime +from functools import cached_property from itertools import cycle from os.path import isfile, join, splitext from urllib.parse import quote as url_quote @@ -46,7 +47,6 @@ from .image import get_exif_tags, get_image_metadata, get_size, process_image from .settings import Status, get_thumb from .utils import ( Devnull, - cached_property, check_or_create_dir, copy, get_mime, diff --git a/sigal/plugins/zip_gallery.py b/sigal/plugins/zip_gallery.py index a009d60..1e9026d 100644 --- a/sigal/plugins/zip_gallery.py +++ b/sigal/plugins/zip_gallery.py @@ -34,11 +34,11 @@ See :ref:`compatibility with the encrypt plugin `. import logging import os import zipfile +from functools import cached_property from os.path import isfile, join from sigal import signals from sigal.gallery import Album -from sigal.utils import cached_property logger = logging.getLogger(__name__) diff --git a/sigal/utils.py b/sigal/utils.py index f8779ad..9b9b7fd 100644 --- a/sigal/utils.py +++ b/sigal/utils.py @@ -119,24 +119,3 @@ def is_valid_html5_video(ext): def get_mime(ext): """Returns mime type for extension.""" return VIDEO_MIMES[ext] - - -class cached_property: - """A property that is only computed once per instance and then replaces - itself with an ordinary attribute. Deleting the attribute resets the - property. - Source: - https://github.com/pydanny/cached-property (BSD Licensed) - https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76 - - """ - - def __init__(self, func): - self.__doc__ = getattr(func, '__doc__') - self.func = func - - def __get__(self, obj, cls): - if obj is None: - return self - value = obj.__dict__[self.func.__name__] = self.func(obj) - return value From 13a679b29527882a16e738e8d8368f259a48e1f7 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 15 Oct 2021 21:31:28 +0200 Subject: [PATCH 3/5] Fix tox --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8e1bbdf..164d182 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39,310}-pillow{71,-latest},pypy3,check +envlist = py{38,39,310}-pillow{71,80,-latest},pypy3,check skip_missing_interpreters = true isolated_build = true From cbaf3d38e58d053376027b152bbde8ff24f5fe29 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 15 Oct 2021 21:46:28 +0200 Subject: [PATCH 4/5] Fix dynamic creation of cached property --- sigal/plugins/zip_gallery.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sigal/plugins/zip_gallery.py b/sigal/plugins/zip_gallery.py index 1e9026d..b89c50c 100644 --- a/sigal/plugins/zip_gallery.py +++ b/sigal/plugins/zip_gallery.py @@ -108,6 +108,7 @@ def generate_album_zip(album): def nozip_gallery_file(album, settings=None): """Filesystem based switch to disable ZIP generation for an Album""" Album.zip = cached_property(generate_album_zip) + Album.zip.__set_name__(Album, 'zip') def register(settings): From 83260df0e61c87f9f79583d4ab126e61e686f3db Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 15 Oct 2021 22:15:21 +0200 Subject: [PATCH 5/5] Fix RTD --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index b4d0b25..d180ab0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -4,7 +4,7 @@ build: image: latest python: - version: 3.7 + version: 3.8 install: - method: pip path: .