Skip to content

Commit 1f28448

Browse files
andersonhcLucas-C
andauthored
Support Python 3.13 (#1291)
* Support Python 3.13 * remove numpy from test/requirements.txt --------- Co-authored-by: Lucas Cimon <925560+Lucas-C@users.noreply.github.com>
1 parent 9f2ccce commit 1f28448

9 files changed

+18
-12
lines changed

.github/workflows/continuous-integration-workflow.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
test:
1313
strategy:
1414
matrix:
15-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
15+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1616
platform: [ubuntu-latest, windows-latest]
1717
runs-on: ${{ matrix.platform }}
1818
steps:
@@ -34,21 +34,21 @@ jobs:
3434
python -m pip install --upgrade pip setuptools wheel
3535
pip install --upgrade . -r test/requirements.txt -r docs/requirements.txt -r contributors/requirements.txt
3636
- name: Statically checking code 🔎
37-
if: matrix.python-version == '3.12' && matrix.platform == 'ubuntu-latest'
37+
if: matrix.python-version == '3.13' && matrix.platform == 'ubuntu-latest'
3838
run: |
3939
pip install --upgrade . -r test/linters-requirements.txt
4040
black --check .
4141
pylint fpdf test tutorial/tuto*.py
4242
bandit -c .banditrc.yml -r contributors/ fpdf/ tutorial/
4343
semgrep scan --config auto --error --strict --exclude-rule=python.lang.security.insecure-hash-function.insecure-hash-function fpdf
4444
- name: Scan current project
45-
if: matrix.python-version == '3.12' && matrix.platform == 'ubuntu-latest'
45+
if: matrix.python-version == '3.13' && matrix.platform == 'ubuntu-latest'
4646
uses: anchore/scan-action@v3
4747
with:
4848
path: "."
4949
fail-build: true
5050
- name: Checking all PDF samples ☑
51-
if: matrix.python-version == '3.12' && matrix.platform == 'ubuntu-latest'
51+
if: matrix.python-version == '3.13' && matrix.platform == 'ubuntu-latest'
5252
run: |
5353
# Using qpdf
5454
find . -name '*.pdf' | xargs -n 1 sh -c 'qpdf --check --password=fpdf2 $0 || exit 255'
@@ -64,7 +64,7 @@ jobs:
6464
- name: Running tests ☑
6565
env:
6666
CHECK_EXEC_TIME: ${{ matrix.python-version == '3.9' && 'test-enabled' || '' }}
67-
CHECK_RSS_MEMORY: ${{ matrix.python-version == '3.12' && 'test-enabled' || '' }}
67+
CHECK_RSS_MEMORY: ${{ matrix.python-version == '3.13' && 'test-enabled' || '' }}
6868
run: |
6969
# Ensuring there is no `generate=True` left remaining in calls to assert_pdf_equal:
7070
grep -IRF generate=True test/ && exit 1
@@ -79,12 +79,12 @@ jobs:
7979
# Targetting only a subset of tests because: A) it's faster and B) some tests are dependant on a specific version of fonttools or Pillow
8080
pytest -vv test/barcodes test/drawing test/errors test/image/test_load_image.py test/metadata test/shapes test/signing test/text_region test/utils
8181
- name: Uploading coverage report to codecov.io ☑
82-
if: matrix.python-version == '3.12' && matrix.platform == 'ubuntu-latest'
82+
if: matrix.python-version == '3.13' && matrix.platform == 'ubuntu-latest'
8383
run: bash <(curl -s https://codecov.io/bash)
8484
- name: Generating HTML documentation 🏗️
8585
# As build_contributors_html_page.py can hang due to GitHub rate-limiting,
8686
# we only execute this on master for now. And it should always be executed for one Python version only.
87-
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.12' && matrix.platform == 'ubuntu-latest'
87+
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.13' && matrix.platform == 'ubuntu-latest'
8888
env:
8989
# Needed by contributors/build_contributors_html_page.py:
9090
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -101,7 +101,7 @@ jobs:
101101
- name: Deploy documentation 🚀
102102
# GitHub Pages deployment should not be done for all Python versions,
103103
# otherwise commits will conflict on the gh-pages branch:
104-
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.12' && matrix.platform == 'ubuntu-latest'
104+
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.13' && matrix.platform == 'ubuntu-latest'
105105
uses: peaceiris/actions-gh-pages@v3
106106
with:
107107
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -118,10 +118,10 @@ jobs:
118118
steps:
119119
- name: Checkout 🛎️
120120
uses: actions/checkout@v3
121-
- name: Set up Python 3.12 🔧
121+
- name: Set up Python 3.13 🔧
122122
uses: actions/setup-python@v4
123123
with:
124-
python-version: '3.12'
124+
python-version: '3.13'
125125
- name: Building distributions for Pypi 🏗️
126126
id: build
127127
run: |

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default',
2121
* new optional parameter `border` for table cells: users can define specific borders (left, right, top, bottom) for individual cells - [issue #1192](https://github.com/py-pdf/fpdf2/issues/1192)
2222
* [`FPDF.write_html()`](https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.write_html): now parses `<title>` tags to set the [document title](https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.set_title). By default, it is added as PDF metadata, but not rendered in the document body. However, this can be enabled by passing `render_title_tag=True` to `FPDF.write_html()`.
2323
* support for LZWDecode compression [issue #1271](https://github.com/py-pdf/fpdf2/issues/1271)
24+
* Python 3.13 is now officially supported
2425
* support for [page labels](https://py-pdf.github.io/fpdf2/PageLabels.html) and created a [reference table of contents](https://py-pdf.github.io/fpdf2/DocumentOutlineAndTableOfContents.html) implementation
2526
* documentation on how to: [render spreadsheets as PDF tables](https://py-pdf.github.io/fpdf2/RenderingSpreadsheetsAsPDFTables.html)
2627
### Fixed

fpdf/drawing.py

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import copy, decimal, math, re
1010
from collections import OrderedDict
11+
12+
# disable import error temporarily until pylint fixed colections.abc issue with python 3.13
13+
# https://github.com/pylint-dev/pylint/issues/10112
14+
# pylint: disable=import-error
1115
from collections.abc import Sequence
1216
from contextlib import contextmanager
1317
from typing import Optional, NamedTuple, Union

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers =
2121
Programming Language :: Python :: 3.10
2222
Programming Language :: Python :: 3.11
2323
Programming Language :: Python :: 3.12
24+
Programming Language :: Python :: 3.13
2425
Operating System :: OS Independent
2526
Topic :: Printing
2627
Topic :: Software Development :: Libraries :: Python Modules

test/embed_file_all_optionals.pdf

-106 Bytes
Binary file not shown.

test/embed_file_self.pdf

-191 Bytes
Binary file not shown.

test/file_attachment_annotation.pdf

-191 Bytes
Binary file not shown.

test/requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
camelot-py
33
endesive
44
ghostscript # required by camelot-py[base]: https://github.com/camelot-dev/camelot/blob/master/setup.py#L27
5-
numpy<2 # required by opencv-python, required for now to avoid an ImportError: numpy.core.multiarray failed to import, followed by an AttributeError: _ARRAY_API not found when importing cv2
65
opencv-python # required by camelot-py[base]: https://github.com/camelot-dev/camelot/blob/master/setup.py#L27
76
pytest
87
pytest-cov

tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88

99
[tox]
10-
envlist = py38, py39, py310, py311, py312
10+
envlist = py38, py39, py310, py311, py312, py313
1111

1212
[gh-actions]
1313
python =
@@ -16,6 +16,7 @@ python =
1616
3.10: py310
1717
3.11: py311
1818
3.12: py312
19+
3.13: py313
1920

2021
[testenv]
2122
deps = -rtest/requirements.txt

0 commit comments

Comments
 (0)