Skip to content

Commit 9092a14

Browse files
committed
Merge remote-tracking branch 'origin/main' into simplify
2 parents 5fd1e91 + fb35485 commit 9092a14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5514
-1958
lines changed

.flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ ignore = E203,E501,E741,W503,W604,N817,N814,VNE001,VNE002,VNE003,N802,SIM105,P10
55
exclude = build,sample-files,dist,.benchmarks,.git,.github,.mypy_cache,.pytest_cache,.tox
66
per-file-ignores =
77
tests/*: ASS001,PT011,B011,T001,T201
8-
make_changelog.py:T001,T201
8+
make_release.py:T001,T201

.github/ISSUE_TEMPLATE/bug-report.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Which environment were you using when you encountered the problem?
1717
$ python -m platform
1818
# TODO: Your output goes here
1919

20-
$ python -c "import pypdf;print(pypdf.__version__)"
20+
$ python -c "import pypdf;print(pypdf._debug_versions)"
2121
# TODO: Your output goes here
2222
```
2323

@@ -36,4 +36,6 @@ better. Let us know if we may add them to our tests!
3636

3737
This is the complete Traceback I see:
3838

39-
TODO
39+
```
40+
# TODO: Your Traceback goes here (if applicable)
41+
```

.github/ISSUE_TEMPLATE/feature-request.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ assignees: MartinThoma
99

1010
## Explanation
1111

12-
Explain briefly what you want to achive.
12+
Explain briefly what you want to achieve.
1313

1414
## Code Example
1515

.github/workflows/github-ci.yaml

+32-12
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,28 @@ on:
1414
paths-ignore:
1515
- '**/*.md'
1616
- '**/*.rst'
17+
workflow_dispatch:
1718

1819
jobs:
1920
tests:
2021
name: pytest on ${{ matrix.python-version }}
2122
runs-on: ubuntu-20.04
2223
strategy:
2324
matrix:
24-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
25-
use-cryptodome: [""]
25+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
26+
use-crypto-lib: ["pycryptodome"]
2627
include:
28+
- python-version: "3.9"
29+
use-crypto-lib: "cryptography"
2730
- python-version: "3.10"
28-
use-cryptodome: "false"
31+
use-crypto-lib: ""
2932
steps:
33+
- name: Update APT packages
34+
run:
35+
sudo apt-get update
36+
- name: Install APT dependencies
37+
run:
38+
sudo apt-get install ghostscript
3039
- name: Checkout Code
3140
uses: actions/checkout@v3
3241
with:
@@ -39,16 +48,17 @@ jobs:
3948
key: cache-downloaded-files
4049
- name: Setup Python
4150
uses: actions/setup-python@v4
42-
if: matrix.python-version != '3.11'
51+
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'
4352
with:
4453
python-version: ${{ matrix.python-version }}
4554
cache: 'pip'
4655
cache-dependency-path: '**/requirements/ci.txt'
47-
- name: Setup Python (3.11)
56+
- name: Setup Python (3.11+)
4857
uses: actions/setup-python@v4
49-
if: matrix.python-version == '3.11'
58+
if: matrix.python-version == '3.11' || matrix.python-version == '3.12'
5059
with:
5160
python-version: ${{ matrix.python-version }}
61+
allow-prereleases: true
5262
cache: 'pip'
5363
cache-dependency-path: '**/requirements/ci-3.11.txt'
5464
- name: Upgrade pip
@@ -57,18 +67,28 @@ jobs:
5767
- name: Install requirements (Python 3)
5868
run: |
5969
pip install -r requirements/ci.txt
60-
if: matrix.python-version != '3.11'
61-
- name: Install requirements (Python 3.11)
70+
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'
71+
- name: Install requirements (Python 3.11+)
6272
run: |
6373
pip install -r requirements/ci-3.11.txt
64-
if: matrix.python-version == '3.11'
65-
- name: Remove cryptodome
74+
if: matrix.python-version == '3.11' || matrix.python-version == '3.12'
75+
- name: Remove pycryptodome and cryptography
6676
run: |
67-
pip uninstall pycryptodome -y
68-
if: matrix.use-cryptodome == 'false'
77+
pip uninstall pycryptodome cryptography -y
78+
- name: Install cryptography
79+
run: |
80+
pip install cryptography
81+
if: matrix.use-crypto-lib == 'cryptography'
82+
- name: Install pycryptodome
83+
run: |
84+
pip install pycryptodome
85+
if: matrix.use-crypto-lib == 'pycryptodome'
6986
- name: Install pypdf
7087
run: |
7188
pip install .
89+
- name: Prepare
90+
run: |
91+
python -c "from tests import download_test_pdfs; download_test_pdfs()"
7292
- name: Test with pytest
7393
run: |
7494
python -m coverage run --parallel-mode -m pytest tests -vv

.github/workflows/release.yaml

+4-8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111

1212
jobs:
1313
build_and_publish:
14-
# this doesn't make sense if you don't have the PyPI secret
15-
if: github.repository == 'py-pdf/pypdf'
1614
name: Publish a new version of pypdf
1715
runs-on: ubuntu-latest
1816

@@ -48,15 +46,13 @@ jobs:
4846
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
4947
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
5048
echo "tag_body<<$EOF" >> "$GITHUB_ENV"
51-
git tag -l "${latest_tag}" --format='%(contents:body)' >> "$GITHUB_ENV"
49+
git --no-pager tag -l "${latest_tag}" --format='%(contents:body)' >> "$GITHUB_ENV"
5250
echo "$EOF" >> "$GITHUB_ENV"
5351
- name: Create GitHub Release 🚀
54-
uses: actions/create-release@v1
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
uses: softprops/action-gh-release@v1
5753
with:
58-
tag_name: ${{ github.ref }}
59-
release_name: Version ${{ env.latest_tag }}, ${{ env.date }}
54+
tag_name: ${{ env.latest_tag }}
55+
name: Version ${{ env.latest_tag }}, ${{ env.date }}
6056
draft: false
6157
prerelease: false
6258
body: ${{ env.tag_body }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ tests/pdf_cache/
4040
docs/meta/CHANGELOG.md
4141
docs/meta/CONTRIBUTORS.md
4242
extracted-images/
43+
44+
RELEASE_COMMIT_MSG.md
45+
RELEASE_TAG_MSG.md

.pre-commit-config.yaml

+11-4
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,30 @@ repos:
2727
- id: black
2828
args: [--target-version, py36]
2929
- repo: https://github.com/asottile/blacken-docs
30-
rev: 1.15.0
30+
rev: 1.16.0
3131
hooks:
3232
- id: blacken-docs
3333
additional_dependencies: [black==22.1.0]
3434
exclude: "docs/user/robustness.md"
3535
- repo: https://github.com/charliermarsh/ruff-pre-commit
36-
rev: 'v0.0.278'
36+
rev: v0.0.285
3737
hooks:
3838
- id: ruff
3939
args: ['--fix']
4040
- repo: https://github.com/asottile/pyupgrade
41-
rev: v3.9.0
41+
rev: v3.10.1
4242
hooks:
4343
- id: pyupgrade
4444
args: [--py36-plus]
4545
- repo: https://github.com/pycqa/flake8
46-
rev: 6.0.0
46+
rev: 6.1.0
4747
hooks:
4848
- id: flake8
4949
args: ["--ignore", "E,W,F"]
50+
51+
- repo: https://github.com/pre-commit/mirrors-mypy
52+
rev: 'v1.5.1'
53+
hooks:
54+
- id: mypy
55+
files: ^pypdf/.*
56+
args: [--ignore-missing-imports]

CHANGELOG.md

+137
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,142 @@
11
# CHANGELOG
22

3+
## Version 3.16.0, 2023-09-10
4+
5+
### Security (SEC)
6+
- Infinite recursion caused by IndirectObject clone (#2156)
7+
8+
### New Features (ENH)
9+
- Ease access to ViewerPreferences (#2144)
10+
11+
### Bug Fixes (BUG)
12+
- Catch the case where w[0] is an IndirectObject instead of an int (#2154)
13+
- Cope with indirect objects in filters and remove deprecated code (#2177)
14+
- Accept tabs in cmaps (#2174) / cope with extra space (#2151)
15+
- Merge pages without resources (#2150)
16+
- getcontents() shall return None if contents is NullObject (#2161)
17+
- Fix conversion from 1 to LA (#2175)
18+
19+
### Robustness (ROB)
20+
- Accept XYZ with no arguments (#2178)
21+
22+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.15.5...3.16.0)
23+
24+
## Version 3.15.5, 2023-09-03
25+
26+
### Bug Fixes (BUG)
27+
- Cope with missing /I in articles (#2134)
28+
- Fix image look-up table in EncodedStreamObject (#2128)
29+
- remove_images not operating in sub level forms (#2133)
30+
31+
### Robustness (ROB)
32+
- Cope with damaged PDF (#2129)
33+
34+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.15.4...3.15.5)
35+
36+
## Version 3.15.4, 2023-08-27
37+
38+
### Performance Improvements (PI)
39+
- Making pypdf as fast as pdfrw (#2086)
40+
41+
### Maintenance (MAINT)
42+
- Relax typing_extensions version (#2104)
43+
44+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.15.3...3.15.4)
45+
46+
## Version 3.15.3, 2023-08-26
47+
48+
### Bug Fixes (BUG)
49+
- Check version of crypt provider (#2115)
50+
- TypeError: can't concat str to bytes (#2114)
51+
- Require flit_core >= 3.9 (#2091)
52+
53+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.15.2...3.15.3)
54+
55+
## Version 3.15.2, 2023-08-20
56+
57+
### Security (SEC)
58+
- Avoid endless recursion of reading damaged PDF file (#2093)
59+
60+
### Performance Improvements (PI)
61+
- Re-use content stream (#2101)
62+
63+
### Maintenance (MAINT)
64+
- Make ParseError inherit from PyPdfError (#2097)
65+
66+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.15.1...3.15.2)
67+
68+
## Version 3.15.1, 2023-08-13
69+
70+
### Performance Improvements (PI)
71+
- optimize _decode_png_prediction (#2068)
72+
73+
### Bug Fixes (BUG)
74+
- Fix incorrect tm_matrix in call to visitor_text (#2060)
75+
- Writing German characters into form fields (#2047)
76+
- Prevent stall when accessing image in corrupted pdf (#2081)
77+
- append() fails when articles do not have /T (#2080)
78+
79+
### Robustness (ROB)
80+
- Cope with xref not followed by separator (#2083)
81+
82+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.15.0...3.15.1)
83+
84+
## Version 3.15.0, 2023-08-06
85+
86+
### New Features (ENH)
87+
- Add `level` parameter to compress_content_streams (#2044)
88+
- Process /uniHHHH for text_extract (#2043)
89+
90+
### Bug Fixes (BUG)
91+
- Fix AnnotationBuilder.link (#2066)
92+
- JPX image without ColorSpace (#2062)
93+
- Added check for field /Info when cloning reader document (#2055)
94+
- Fix indexed/CMYK images (#2039)
95+
96+
### Maintenance (MAINT)
97+
- Cryptography as primary dependency (#2053)
98+
99+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.14.0...3.15.0)
100+
101+
## Version 3.14.0, 2023-07-29
102+
103+
### New Features (ENH)
104+
- Accelerate image list keys generation (#2014)
105+
- Use `cryptography` for encryption/decryption as a fallback for PyCryptodome (#2000)
106+
- Extract LaTeX characters (#2016)
107+
- ASCIIHexDecode.decode now returns bytes instead of str (#1994)
108+
109+
### Bug Fixes (BUG)
110+
- Add RunLengthDecode filter (#2012)
111+
- Process /Separation ColorSpace (#2007)
112+
- Handle single element ColorSpace list (#2026)
113+
- Process lookup decoded as TextStringObjects (#2008)
114+
115+
### Robustness (ROB)
116+
- Cope with garbage collector during cloning (#1841)
117+
118+
### Maintenance (MAINT)
119+
- Cleanup of annotations (#1745)
120+
121+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.13.0...3.14.0)
122+
123+
## Version 3.13.0, 2023-07-23
124+
125+
### New Features (ENH)
126+
- Add is_open in outlines in PdfReader and PdfWriter (#1960)
127+
128+
### Bug Fixes (BUG)
129+
- Search /DA in hierarchy fields (#2002)
130+
- Cope with different ISO date length (#1999)
131+
- Decode Black only/CMYK deviceN images (#1984)
132+
- Process CMYK in deflate images (#1977)
133+
134+
### Developer Experience (DEV)
135+
- Add mypy to pre-commit (#2001)
136+
- Release automation (#1991, #1985)
137+
138+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.12.2...3.13.0)
139+
3140
## Version 3.12.2, 2023-07-16
4141

5142
### Bug Fixes (BUG)

CONTRIBUTING.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Please check the [documentation page dedicated to development](https://pypdf.readthedocs.io/en/stable/dev/intro.html).
2+
3+
## Creating issues / tickets
4+
5+
Please go here: https://github.com/py-pdf/pypdf/issues
6+
7+
Typically you should not send e-mails. E-mails might only reach one person and
8+
it could go into spam or that person might be busy. Please create issues on
9+
GitHub instead.
10+
11+
Please use the templates provided.
12+
13+
## Creating Pull Requests
14+
15+
We appreciate if people make PRs, but please be aware that pypdf is used by many
16+
people. That means:
17+
18+
* We rarely make breaking changes and have a [deprecation process](https://pypdf.readthedocs.io/en/latest/dev/deprecations.html)
19+
* New features, especially adding to the public interface, typically need to be
20+
discussed first.
21+
22+
Before you make bigger changes, rather open an issue to make the suggestion.
23+
Note which interface changes you want to make.

CONTRIBUTORS.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ history and [GitHubs 'Contributors' feature](https://github.com/py-pdf/pypdf/gra
1313

1414
* [abyesilyurt](https://github.com/abyesilyurt)
1515
* [ArkieCoder](https://github.com/ArkieCoder)
16+
* [Clauss, Christian](https://github.com/cclauss)
1617
* [DL6ER](https://github.com/DL6ER)
1718
* [ediamondscience](https://github.com/ediamondscience)
1819
* [Ermeson, Felipe](https://github.com/FelipeErmeson)
20+
* [Freitag, François](https://github.com/francoisfreitag)
1921
* [Górny, Michał](https://github.com/mgorny)
2022
* [Grillo, Miguel](https://github.com/Ineffable22)
23+
* [Gutteridge, David H.](https://github.com/dhgutteridge)
2124
* [Hale, Joseph](https://github.com/thehale)
2225
* [harshhes](https://github.com/harshhes)
2326
* [JianzhengLuo](https://github.com/JianzhengLuo)
@@ -43,6 +46,7 @@ history and [GitHubs 'Contributors' feature](https://github.com/py-pdf/pypdf/gra
4346
* [Rogmann, Sascha](https://github.com/srogmann)
4447
* [robbiebusinessacc](https://github.com/robbiebusinessacc)
4548
* [Roder, Thomas](https://github.com/MrTomRod)
49+
* [Röthenbacher, Thomas](https://github.com/troethe)
4650
* [sietzeberends](https://github.com/sietzeberends)
4751
* [Stüber, Timo](https://github.com/omit66)
4852
* [Thoma, Martin](https://github.com/MartinThoma): Maintainer of pypdf since April 2022. I hope to build a great community with many awesome contributors. [LinkedIn](https://www.linkedin.com/in/martin-thoma/) | [StackOverflow](https://stackoverflow.com/users/562769/martin-thoma) | [Blog](https://martin-thoma.com/)

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ maint:
77
pyenv local 3.7.9
88
pip-compile -U requirements/docs.in
99

10-
changelog:
11-
python make_changelog.py
10+
release:
11+
python make_release.py
12+
git commit -eF RELEASE_COMMIT_MSG.md
1213

1314
upload:
1415
make clean

0 commit comments

Comments
 (0)