Skip to content

Commit

Permalink
Merge branch 'master' into fix-608-decryption-fails-when-no-ID-in-tra…
Browse files Browse the repository at this point in the history
…iler
  • Loading branch information
MartinThoma authored Apr 9, 2022
2 parents b9497d9 + b76ffcd commit e34f5e7
Show file tree
Hide file tree
Showing 78 changed files with 2,246 additions and 281 deletions.
23 changes: 23 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[run]
source = PyPDF2
branch = True

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
@overload

# Don't complain about missing debug-only code:
def __repr__
def __str__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
51 changes: 51 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Unit Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install requirements (python 3)
if: matrix.python-version != '2.7'
run: |
pip install -r requirements/ci.txt
- name: Install requirements (python 2)
if: matrix.python-version == '2.7'
run: |
pip install pillow pytest pytest-cov
- name: Install module
run: |
pip install .
- name: Test with flake8
run: |
flake8 . --ignore E,F,I,SIM,C,PT,N,ASS,A,P,R,W
if: matrix.python-version != '2.7'

- name: Test with pytest
run: |
pytest Tests/tests.py Tests --cov --cov-report term-missing -vv
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,19 @@
.tox
build
.idea/*
.coverage
*.egg-info/
dist/*

# Editors / IDEs
.vscode/

# Docs
docs/_build/

# Files generated by some of the scripts
dont_commit_merged.pdf
dont_commit_writer.pdf
PyPDF2-output.pdf
Image9.png
PyPDF2_pdfLocation.txt
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# pre-commit run --all-files
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-ast
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-added-large-files
args: ['--maxkb=1000']
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ["--ignore", "E,W,F"]
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.942
# hooks:
# - id: mypy
# - repo: https://github.com/psf/black
# rev: 22.3.0
# hooks:
# - id: black
# - repo: https://github.com/asottile/pyupgrade
# rev: v2.31.1
# hooks:
# - id: pyupgrade
# args: [--py36-plus]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.1.0]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.15
22 changes: 10 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
language: python
python: "2.7"
sudo: false

env:
- TOX_ENV=py27
- TOX_ENV=py33
- TOX_ENV=py34
- TOX_ENV=py35
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "pypy"
- "pypy3"

install:
- pip install tox --use-mirrors
- pip install tox-travis

script:
- tox -e $TOX_ENV
- tox

matrix:
# Python 3.5 not yet available on travis, watch this to see when it is.
fast_finish: true
allow_failures:
- env: TOX_ENV=py35
84 changes: 68 additions & 16 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,57 @@
Version 1.26.0, 2016-05-18
Version 1.27.0, 2022-04-07
--------------------------

Features:

- Add alpha channel support for png files in Script (#614)

Bug fixes (BUG):

- Fix formatWarning for filename without slash (#612)
- Add whitespace between words for extractText() (#569, #334)
- "invalid escape sequence" SyntaxError (#522)
- Avoid error when printing warning in pythonw (#486)
- Stream operations can be List or Dict (#665)

Documentation (DOC):

- Added Scripts/pdf-image-extractor.py
- Documentation improvements (#550, #538, #324, #426, #394)

Tests and Test setup (TST):

- Add Github Action which automatically run unit tests via pytest and
static code analysis with Flake8 (#660)
- Add several unit tests (#661, #663)
- Add .coveragerc to create coverage reports

Developer Experience Improvements (DEV):

- Pre commit: Developers can now `pre-commit install` to avoid tiny issues
like trailing whitespaces

Miscallenious:

- Add the LICENSE file to the distributed packages (#288)
- Use setuptools instead of distutils (#599)
- Improvements for the PyPI page (#644)
- Python 3 changes (#504, #366)

You can see the full changelog at: https://github.com/py-pdf/PyPDF2/compare/1.26.0...1.27.0

Patch release 1.27.1, 2022-04-08

- Fixed project links on PyPI page after migration from mstamy2
to MartinThoma to the py-pdf organization on GitHub
- Documentation is now at https://pypdf2.readthedocs.io/en/latest/

Patch release 1.27.2, 2022-04-09

- Add Scripts (including `pdfcat`), Resources, Tests, and Sample_Code back to
PyPDF2. It was removed by accident in 1.27.0, but might get removed with 2.0.0
See https://github.com/py-pdf/PyPDF2/discussions/718 for discussion

Version 1.26.0, 2016-05-18
--------------------------

- NOTE: Active maintenance on PyPDF2 is resuming after a hiatus
Expand Down Expand Up @@ -168,7 +221,7 @@ Version 1.23, 2014-08-11
- Annotations (links, comment windows, etc.) are now preserved when
pages are merged together

- Used the Destination class in addLink() and addBookmark() so that
- Used the Destination class in addLink() and addBookmark() so that
the page fit option could be properly customized


Expand All @@ -188,7 +241,7 @@ Version 1.22, 2014-05-29
- Fixed bug where an exception was thrown upon reading a NULL string
(by speedplane)

- Allow string literals (non-unicode strings in Python 2) to be passed
- Allow string literals (non-unicode strings in Python 2) to be passed
to PdfFileReader

- Allow ConvertFunctionsToVirtualList to be indexed with slices and
Expand All @@ -199,7 +252,7 @@ Version 1.22, 2014-05-29

- General code clean-up and improvements (with Steve Witham and Henry Keiter)

- Fixed bug that caused crash when comments are present at end of
- Fixed bug that caused crash when comments are present at end of
dictionary


Expand Down Expand Up @@ -318,7 +371,7 @@ OTHER:
UPCOMING:
- More bugfixes (We have received many problematic PDFs via email, we
will work with them)

- Documentation - It's time for PyPDF2 to get its own documentation
since it has grown much since the original pyPdf

Expand All @@ -328,11 +381,11 @@ UPCOMING:
Version 1.18, 2013-08-19
------------------------

- Fixed a bug where older verions of objects were incorrectly added to the
- Fixed a bug where older verions of objects were incorrectly added to the
cache, resulting in outdated or missing pages, images, and other objects
(from speedplane)

- Fixed a bug in parsing the xref table where new xref values were
- Fixed a bug in parsing the xref table where new xref values were
overwritten; also cleaned up code (from speedplane)

- New method mergeRotatedAroundPointPage which merges a page while rotating
Expand All @@ -355,8 +408,8 @@ Other Changes:
Version 1.17, 2013-07-25
------------------------

- Removed one (from pdf.py) of the two Destination classes. Both
classes had the same name, but were slightly different in content,
- Removed one (from pdf.py) of the two Destination classes. Both
classes had the same name, but were slightly different in content,
causing some errors. (from Janne Vanhala)

- Corrected and Expanded README file to demonstrate PdfFileMerger
Expand All @@ -373,9 +426,9 @@ Versions -1.16, -2013-06-30
- Note: This ChangeLog has not been kept up-to-date for a while.
Hopefully we can keep better track of it from now on. Some of the
changes listed here come from previous versions 1.14 and 1.15; they
were only vaguely defined. With the new _version.py file we should
were only vaguely defined. With the new _version.py file we should
have more structured and better documented versioning from now on.

- Defined PyPDF2.__version__

- Fixed encrypt() method (from Martijn The)
Expand All @@ -388,14 +441,14 @@ Versions -1.16, -2013-06-30

- Fixed an bug caused by DecimalError Exception (from Adam Morris)

- Many other bug fixes and features by:
- Many other bug fixes and features by:

jeansch
Anton Vlasenko
Joseph Walton
Jan Oliver Oelerich
Fabian Henze
And any others I missed.
And any others I missed.
Thanks for contributing!


Expand Down Expand Up @@ -535,7 +588,7 @@ Version 1.6, 2006-06-06
stream filters more easily, including compressed streams.

- Add a graphics state push/pop around page merges. Improves quality of
page merges when one page's content stream leaves the graphics
page merges when one page's content stream leaves the graphics
in an abnormal state.

- Add PageObject.compressContentStreams function, which filters all content
Expand Down Expand Up @@ -628,4 +681,3 @@ Version 1.0, 2006-01-17

- Does not support some PDF 1.5 features, such as object streams,
cross-reference streams.

3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
include CHANGELOG
include LICENSE
include Scripts/pdfcat
recursive-include Resources *
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
maint:
pre-commit autoupdate
pip-compile -U requirements/ci.in
pip-compile -U requirements/dev.in
pip-compile -U requirements/docs.in

upload:
make clean
python setup.py sdist bdist_wheel && twine upload -s dist/*

clean:
python setup.py clean --all
pyclean .
rm -rf Tests/__pycache__ PyPDF2/__pycache__ Image9.png htmlcov docs/_build dist dont_commit_merged.pdf dont_commit_writer.pdf PyPDF2.egg-info PyPDF2_pdfLocation.txt

test:
pytest Tests/tests.py Tests --cov --cov-report term-missing -vv --cov-report html
4 changes: 2 additions & 2 deletions PDF_Samples/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ we won't add PDFs without expressed permission.
(This folder is available through GitHub only)


Feel free to add any type of PDF file or sample code,
Feel free to add any type of PDF file or sample code,
either by

1) sending it via email to [email protected]
2) including it in a pull request on GitHub
2) including it in a pull request on GitHub
2 changes: 1 addition & 1 deletion PyPDF2/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.26.0'
__version__ = '1.27.2'
Loading

0 comments on commit e34f5e7

Please sign in to comment.