Skip to content

Commit 139ee83

Browse files
authored
fix: restore Python 3.9 support (#305)
* fix: restore Python 3.9 support * fix `TypeError: zip() takes no keyword arguments`
1 parent 38263d8 commit 139ee83

File tree

10 files changed

+17
-14
lines changed

10 files changed

+17
-14
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ jobs:
5656
- emoji: 🪟
5757
runs-on: [windows-latest]
5858
python:
59+
- name: CPython 3.9
60+
runs-on: "3.9"
5961
- name: CPython 3.10
6062
runs-on: "3.10"
6163
- name: CPython 3.11

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ See Git checking messages for full history.
44

55
## 10.0.0 (2024-xx-xx)
66
- removed support for Python 3.8
7-
- removed support for Python 3.9
87
- added support for Python 3.14
98
- :heart: contributors: @
109

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ with mss() as sct:
1515

1616
An ultra-fast cross-platform multiple screenshots module in pure python using ctypes.
1717

18-
- **Python 3.10+**, PEP8 compliant, no dependency, thread-safe;
18+
- **Python 3.9+**, PEP8 compliant, no dependency, thread-safe;
1919
- very basic, it will grab one screenshot by monitor or a screenshot of all monitors and save it to a PNG file;
2020
- but you can use PIL and benefit from all its formats (or add yours directly);
2121
- integrate well with Numpy and OpenCV;

docs/source/examples/pil_pixels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
img = Image.new("RGB", sct_img.size)
1717

1818
# Best solution: create a list(tuple(R, G, B), ...) for putdata()
19-
pixels = zip(sct_img.raw[2::4], sct_img.raw[1::4], sct_img.raw[::4], strict=False)
19+
pixels = zip(sct_img.raw[2::4], sct_img.raw[1::4], sct_img.raw[::4])
2020
img.putdata(list(pixels))
2121

2222
# But you can set individual pixels too (slower)

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Welcome to Python MSS's documentation!
1212
1313
An ultra fast cross-platform multiple screenshots module in pure python using ctypes.
1414

15-
- **Python 3.10+**, :pep:`8` compliant, no dependency, thread-safe;
15+
- **Python 3.9+**, :pep:`8` compliant, no dependency, thread-safe;
1616
- very basic, it will grab one screenshot by monitor or a screenshot of all monitors and save it to a PNG file;
1717
- but you can use PIL and benefit from all its formats (or add yours directly);
1818
- integrate well with Numpy and OpenCV;

docs/source/support.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Support
55
Feel free to try MSS on a system we had not tested, and let us know by creating an `issue <https://github.com/BoboTiG/python-mss/issues>`_.
66

77
- OS: GNU/Linux, macOS and Windows
8-
- Python: 3.10 and newer
8+
- Python: 3.9 and newer
99

1010

1111
Future
@@ -35,4 +35,3 @@ Abandoned
3535
- Python 3.6 (2022-10-27)
3636
- Python 3.7 (2023-04-09)
3737
- Python 3.8 (2024-09-01)
38-
- Python 3.9 (2024-09-01)

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "mss"
77
description = "An ultra fast cross-platform multiple screenshots module in pure python using ctypes."
88
readme = "README.md"
9-
requires-python = ">= 3.10"
9+
requires-python = ">= 3.9"
1010
authors = [
1111
{ name = "Mickaël Schoentgen", email="[email protected]" },
1212
]
@@ -31,6 +31,7 @@ classifiers = [
3131
"Programming Language :: Python",
3232
"Programming Language :: Python :: 3",
3333
"Programming Language :: Python :: 3 :: Only",
34+
"Programming Language :: Python :: 3.9",
3435
"Programming Language :: Python :: 3.10",
3536
"Programming Language :: Python :: 3.11",
3637
"Programming Language :: Python :: 3.12",
@@ -149,7 +150,7 @@ exclude = [
149150
]
150151
line-length = 120
151152
indent-width = 4
152-
target-version = "py310"
153+
target-version = "py39"
153154

154155
[tool.ruff.lint]
155156
extend-select = ["ALL"]

src/mss/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ def __init__(
3939
/,
4040
*,
4141
compression_level: int = 6,
42-
display: bytes | str | None = None, # noqa:ARG002 Linux only
43-
max_displays: int = 32, # noqa:ARG002 Mac only
4442
with_cursor: bool = False,
43+
# Linux only
44+
display: bytes | str | None = None, # noqa: ARG002
45+
# Mac only
46+
max_displays: int = 32, # noqa: ARG002
4547
) -> None:
4648
self.cls_image: type[ScreenShot] = ScreenShot
4749
self.compression_level = compression_level

src/mss/screenshot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def left(self) -> int:
8080
def pixels(self) -> Pixels:
8181
""":return list: RGB tuples."""
8282
if not self.__pixels:
83-
rgb_tuples: Iterator[Pixel] = zip(self.raw[2::4], self.raw[1::4], self.raw[::4], strict=False)
84-
self.__pixels = list(zip(*[iter(rgb_tuples)] * self.width, strict=False))
83+
rgb_tuples: Iterator[Pixel] = zip(self.raw[2::4], self.raw[1::4], self.raw[::4])
84+
self.__pixels = list(zip(*[iter(rgb_tuples)] * self.width))
8585

8686
return self.__pixels
8787

src/tests/test_implementation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def main(*args: str, ret: int = 0) -> None:
116116
assert os.path.isfile("monitor-1.png")
117117
os.remove("monitor-1.png")
118118

119-
for opts in zip(["-m 1", "--monitor=1"], ["-q", "--quiet"], strict=False):
119+
for opts in zip(["-m 1", "--monitor=1"], ["-q", "--quiet"]):
120120
main(*opts)
121121
captured = capsys.readouterr()
122122
assert not captured.out
@@ -128,7 +128,7 @@ def main(*args: str, ret: int = 0) -> None:
128128
main(opt, fmt)
129129
captured = capsys.readouterr()
130130
with mss.mss(display=os.getenv("DISPLAY")) as sct:
131-
for mon, (monitor, line) in enumerate(zip(sct.monitors[1:], captured.out.splitlines(), strict=False), 1):
131+
for mon, (monitor, line) in enumerate(zip(sct.monitors[1:], captured.out.splitlines()), 1):
132132
filename = fmt.format(mon=mon, **monitor)
133133
assert line.endswith(filename)
134134
assert os.path.isfile(filename)

0 commit comments

Comments
 (0)