Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate, drop Pillow 9.1.1 support (#155)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 23.9.1 → 23.10.1](psf/black@23.9.1...23.10.1)
- [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.1](astral-sh/ruff-pre-commit@v0.0.292...v0.1.1)
- [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.6.1](pre-commit/mirrors-mypy@v1.5.1...v1.6.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* dropped Pillow 9.1.1 version support

Signed-off-by: Alexander Piskun <[email protected]>

* removed Alpine 3.16 from src build matrix

Signed-off-by: Alexander Piskun <[email protected]>

---------

Signed-off-by: Alexander Piskun <[email protected]>
Signed-off-by: Alexander Piskun <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alexander Piskun <[email protected]>
Co-authored-by: Alexander Piskun <[email protected]>
  • Loading branch information
3 people authored Oct 29, 2023
1 parent c9f2e69 commit ff4da71
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/analysis-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ jobs:
- name: Install from source
run: |
sudo -H python3 -m pip install pillow==9.1.1 pytest defusedxml packaging numpy
sudo -H python3 -m pip install pillow==9.4.0 pytest defusedxml packaging numpy
sudo -H PH_LIGHT_ACTION=1 python3 -m pip -v install --no-build-isolation .
- name: LibHeif info
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-src-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false
matrix:
arch: ["amd64", "arm64", "arm/v7"]
docker_file: ["Alpine_3_16", "Alpine_3_17", "Alpine_3_18", "Debian_11", "Debian_12", "Ubuntu_22_04"]
docker_file: ["Alpine_3_17", "Alpine_3_18", "Debian_11", "Debian_12", "Ubuntu_22_04"]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.10.1
hooks:
- id: black

Expand All @@ -29,12 +29,12 @@ repos:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.1
hooks:
- id: ruff

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.6.1
hooks:
- id: mypy
files: pillow_heif/
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ All notable changes to this project will be documented in this file.

## [0.14.0 - 2023-11-xx]

### Changed

- Minimum supported Pillow version raised to `9.2.0`.

### Fixed

- Support of libheif `1.17.0`. #156
- Support of libheif `1.17.1`. #156

## [0.13.1 - 2023-10-15]

Expand Down
34 changes: 0 additions & 34 deletions docker/from_src/Alpine_3_16.Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion pillow_heif/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide all possible stuff that can be used."""


from . import options
from ._lib_info import libheif_info, libheif_version
from ._version import __version__
Expand Down
1 change: 0 additions & 1 deletion pillow_heif/_deffered_error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""DeferredError class taken from PIL._util.py file."""


class DeferredError: # pylint: disable=too-few-public-methods
"""Allows failing import for doc purposes, as C module will be not build during docs build."""

Expand Down
17 changes: 9 additions & 8 deletions pillow_heif/as_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def load(self):
if self._heif_file:
frame_heif = self._heif_file[self.tell()]
try:
if pil_version[:4] not in ("9.1.", "9.2.", "9.3.", "9.4."):
if pil_version[:4] not in ("9.2.", "9.3.", "9.4."): # noqa: SIM108
data = frame_heif.data
else:
data = bytes(frame_heif.data)
Expand Down Expand Up @@ -124,7 +124,7 @@ def _seek_check(self, frame):
def _init_from_heif_file(self, img_index: int) -> None:
if self._heif_file:
self._size = self._heif_file[img_index].size
if pil_version[:4] not in ("9.1.", "9.2.", "9.3.", "9.4.", "9.5.", "10.0"):
if pil_version[:4] not in ("9.2.", "9.3.", "9.4.", "9.5.", "10.0"):
# starting from Pillow 10.1, `mode` is a readonly property.
self._mode = self._heif_file[img_index].mode
else:
Expand Down Expand Up @@ -194,12 +194,13 @@ def _is_supported_avif(fp) -> bool:
magic = _get_bytes(fp, 12)
if magic[4:8] != b"ftyp":
return False
if magic[8:12] in (
b"avif",
# b"avis",
):
return True
return False
return magic[8:12] == b"avif"
# if magic[8:12] in (
# b"avif",
# b"avis",
# ):
# return True
# return False


def _save_avif(im, fp, _filename):
Expand Down
8 changes: 3 additions & 5 deletions pillow_heif/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from typing import List, Optional

from PIL import Image
from PIL import __version__ as pil_version

from . import options
from .constants import HeifChroma, HeifColorspace, HeifCompressionFormat
Expand Down Expand Up @@ -217,10 +216,9 @@ def _exif_from_pillow(img: Image.Image) -> Optional[bytes]:
if "exif" in img.info:
return img.info["exif"]
if hasattr(img, "getexif"): # noqa
if pil_version[:4] not in ("9.1.",):
exif = img.getexif()
if exif:
return exif.tobytes()
exif = img.getexif()
if exif:
return exif.tobytes()
return None


Expand Down
1 change: 0 additions & 1 deletion pillow_heif/options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Options to change pillow_heif's runtime behavior."""


DECODE_THREADS = 4
"""Maximum number of threads to use for decoding images(when it is possible)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ python_requires = >=3.8
zip_safe = False
packages = find:
install_requires =
pillow>=9.1.1
pillow>=9.2.0

[options.extras_require]
docs =
Expand Down

0 comments on commit ff4da71

Please sign in to comment.