Skip to content

Commit

Permalink
DEP: Drop Python 3.6 support (#2369)
Browse files Browse the repository at this point in the history
This does not mean that pypdf doesn't run with Python 3.6 anymore.
It means that we don't run CI with Python 3.6 and don't give any
guarantees.

See #2005
  • Loading branch information
MartinThoma authored Dec 28, 2023
1 parent 3d44536 commit 195d82e
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 77 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/github-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
use-crypto-lib: ["cryptography"]
include:
- python-version: "3.6"
- python-version: "3.7"
use-crypto-lib: "pycryptodome"
- python-version: "3.7"
use-crypto-lib: "none"
Expand All @@ -81,7 +81,7 @@ jobs:
key: cache-downloaded-files
- name: Setup Python
uses: actions/setup-python@v5
if: matrix.python-version == '3.6' || matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10'
if: matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10'
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -100,7 +100,7 @@ jobs:
- name: Install requirements (Python 3)
run: |
pip install -r requirements/ci.txt
if: matrix.python-version == '3.6' || matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10'
if: matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10'
- name: Install requirements (Python 3.11+)
run: |
pip install -r requirements/ci-3.11.txt
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pre-commit run --all-files
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.1.0
hooks:
- id: check-ast
- id: check-byte-order-marker
Expand All @@ -18,34 +18,34 @@ repos:
- id: check-added-large-files
args: ['--maxkb=1000']
- repo: https://github.com/psf/black
rev: 23.10.1
rev: 23.3.0
hooks:
- id: black
args: [--target-version, py36]
args: [--target-version, py37]
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.14.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.1.0]
exclude: "docs/user/robustness.md"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.9
hooks:
- id: ruff
args: ['--fix']
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.3.2
hooks:
- id: pyupgrade
args: [--py36-plus]
args: [--py37-plus]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 5.0.4
hooks:
- id: flake8
args: ["--ignore", "E,W,F"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.6.1'
rev: 'v1.4.0'
hooks:
- id: mypy
additional_dependencies: [types-Pillow==10.0.0.2]
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ persistent=yes

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.6
py-version=3.7

# Discover python modules and packages in the file system subtree.
recursive=no
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
maint:
pyenv local 3.6.15
pyenv local 3.7.15
pre-commit autoupdate
pip-compile -U requirements/ci.in
pyenv local 3.7.15
pip-compile -U requirements/dev.in
pyenv local 3.7.9
pip-compile -U requirements/docs.in

release:
Expand Down
3 changes: 1 addition & 2 deletions docs/dev/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ so that you can install the different Python versions:

```
pyenv install pypy3.8-7.3.7
pyenv install 3.6.15
pyenv install 3.7.12
pyenv install 3.7.15
pyenv install 3.8.12
pyenv install 3.9.10
pyenv install 3.10.2
Expand Down
4 changes: 2 additions & 2 deletions docs/user/encryption-decryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ with different key length. `pypdf` supports all of them until `PDF-2.0`, which
is the latest PDF standard.

`pypdf` use an extra dependency to do encryption or decryption for `AES` algorithms.
We recommend [`pyca/cryptography`](https://cryptography.io/en/latest/). For Python 3.6
users, you can use [`pycryptodome`](https://pypi.org/project/pycryptodome/) as a fallback.
We recommend [`pyca/cryptography`](https://cryptography.io/en/latest/). Alternatively,
you can use [`pycryptodome`](https://pypi.org/project/pycryptodome/).

> Please see the note in the [installation guide](installation.md)
> for installing the extra dependencies if interacting with PDFs that use AES.
Expand Down
3 changes: 2 additions & 1 deletion docs/user/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ There are several ways to install pypdf. The most common option is to use pip.

## pip

pypdf requires Python 3.6+ to run.
pypdf requires Python 3.7+ to run.

Typically Python comes with `pip`, a package installer. Using it you can
install pypdf:
Expand Down Expand Up @@ -52,6 +52,7 @@ pip install pypdf[image]

| Python | 3.11 | 3.10 | 3.9 | 3.8 | 3.7 | 3.6 | 2.7 |
| ---------------------- | ---- | ---- | --- | --- | --- | --- | --- |
| pypdf>=4.0 | YES | YES | YES | YES | YES | | |
| pypdf>=3.0 | YES | YES | YES | YES | YES | YES | |
| PyPDF2>=2.0 | YES | YES | YES | YES | YES | YES | |
| PyPDF2 1.20.0 - 1.28.4 | | YES | YES | YES | YES | YES | YES |
Expand Down
2 changes: 1 addition & 1 deletion pypdf/_xobj_image_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
else:
# PEP 586 introduced typing.Literal with Python 3.8
# For older Python versions, the backport typing_extensions is necessary:
from typing_extensions import Literal # type: ignore[assignment]
from typing_extensions import Literal

if sys.version_info[:2] >= (3, 10):
from typing import TypeAlias
Expand Down
2 changes: 1 addition & 1 deletion pypdf/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Python 3.8+: https://peps.python.org/pep-0586
from typing import Literal
else:
from typing_extensions import Literal # type: ignore[assignment]
from typing_extensions import Literal

if sys.version_info[:2] >= (3, 10):
# Python 3.10+: https://www.python.org/dev/peps/pep-0484/
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down
64 changes: 30 additions & 34 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
#
# This file is autogenerated by pip-compile with python 3.6
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile requirements/ci.in
#
attrs==20.3.0
# via
# flake8-bugbear
# flake8-implicit-str-concat
# pytest
coverage[toml]==6.2
attrs==23.1.0
# via flake8-bugbear
coverage[toml]==7.2.7
# via
# -r requirements/ci.in
# pytest-cov
execnet==1.9.0
exceptiongroup==1.2.0
# via pytest
execnet==2.0.2
# via pytest-xdist
flake8==5.0.4
# via
# -r requirements/ci.in
# flake8-bugbear
# flake8-print
flake8-bugbear==22.9.23
flake8-bugbear==23.3.12
# via -r requirements/ci.in
flake8-implicit-str-concat==0.2.0
flake8-implicit-str-concat==0.4.0
# via -r requirements/ci.in
flake8-print==4.0.1
flake8-print==5.0.0
# via -r requirements/ci.in
fpdf2==2.4.1
# via -r requirements/ci.in
importlib-metadata==4.2.0
# via
# attrs
# flake8
# pluggy
# pytest
iniconfig==1.1.1
# typeguard
iniconfig==2.0.0
# via pytest
mccabe==0.7.0
# via flake8
more-itertools==8.14.0
more-itertools==9.1.0
# via flake8-implicit-str-concat
mypy==0.971
mypy==1.4.1
# via -r requirements/ci.in
mypy-extensions==1.0.0
# via mypy
packaging==21.3
packaging==23.2
# via pytest
pillow==8.4.0
pillow==9.5.0
# via
# -r requirements/ci.in
# fpdf2
pluggy==1.0.0
# via pytest
py==1.11.0
pluggy==1.2.0
# via pytest
py-cpuinfo==9.0.0
# via pytest-benchmark
Expand All @@ -63,46 +62,43 @@ pycryptodome==3.19.0
# via -r requirements/ci.in
pyflakes==2.5.0
# via flake8
pyparsing==3.1.1
# via packaging
pytest==7.0.1
pytest==7.4.3
# via
# -r requirements/ci.in
# pytest-benchmark
# pytest-cov
# pytest-socket
# pytest-timeout
# pytest-xdist
pytest-benchmark==3.4.1
pytest-benchmark==4.0.0
# via -r requirements/ci.in
pytest-cov==4.0.0
pytest-cov==4.1.0
# via -r requirements/ci.in
pytest-socket==0.4.1
pytest-socket==0.6.0
# via -r requirements/ci.in
pytest-timeout==2.1.0
pytest-timeout==2.2.0
# via -r requirements/ci.in
pytest-xdist==3.0.2
pytest-xdist==3.5.0
# via -r requirements/ci.in
pyyaml==6.0.1
# via -r requirements/ci.in
six==1.16.0
# via flake8-print
tomli==1.2.3
tomli==2.0.1
# via
# coverage
# mypy
# pytest
typed-ast==1.5.5
# via mypy
typeguard==2.13.3
typeguard==4.1.2
# via -r requirements/ci.in
types-dataclasses==0.6.6
# via -r requirements/ci.in
types-pillow==10.0.0.3
types-pillow==10.1.0.2
# via -r requirements/ci.in
typing-extensions==4.1.1
typing-extensions==4.7.1
# via
# importlib-metadata
# mypy
zipp==3.6.0
# typeguard
zipp==3.15.0
# via importlib-metadata
16 changes: 8 additions & 8 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ black==23.3.0
# via -r requirements/dev.in
build==1.0.3
# via pip-tools
certifi==2023.7.22
certifi==2023.11.17
# via requests
cfgv==3.3.1
# via pre-commit
charset-normalizer==3.3.1
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# black
# pip-tools
coverage[toml]==7.2.7
# via pytest-cov
distlib==0.3.7
distlib==0.3.8
# via virtualenv
docutils==0.20.1
# via flit
exceptiongroup==1.1.3
exceptiongroup==1.2.0
# via pytest
filelock==3.12.2
# via virtualenv
Expand All @@ -34,7 +34,7 @@ flit-core==3.9.0
# via flit
identify==2.5.24
# via pre-commit
idna==3.4
idna==3.6
# via requests
importlib-metadata==6.7.0
# via
Expand All @@ -60,7 +60,7 @@ pillow==9.5.0
# via -r requirements/dev.in
pip-tools==6.14.0
# via -r requirements/dev.in
platformdirs==3.11.0
platformdirs==4.0.0
# via
# black
# virtualenv
Expand Down Expand Up @@ -98,9 +98,9 @@ typing-extensions==4.7.1
# platformdirs
urllib3==2.0.7
# via requests
virtualenv==20.24.6
virtualenv==20.25.0
# via pre-commit
wheel==0.41.2
wheel==0.42.0
# via
# -r requirements/dev.in
# pip-tools
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx
sphinx_rtd_theme
sphinx_rtd_theme<2.0.0
myst_parser==0.16.1
attrs # required for myst, but not automatically installed by myst
Loading

0 comments on commit 195d82e

Please sign in to comment.