diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-10-15 13:55:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-10-15 13:55:53 +0000 |
commit | dd8977db7e960a4f7887c1240df04fdbe69642cc (patch) | |
tree | 123593737fc2984fcc7ba49a3d7c312b3fa060c8 | |
parent | Releasing debian version 0.3.0-1. (diff) | |
download | pydyf-dd8977db7e960a4f7887c1240df04fdbe69642cc.tar.xz pydyf-dd8977db7e960a4f7887c1240df04fdbe69642cc.zip |
Merging upstream version 0.5.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r-- | .github/workflows/doconfly.yml | 2 | ||||
-rw-r--r-- | .github/workflows/tests.yml | 5 | ||||
-rw-r--r-- | docs/changelog.rst | 61 | ||||
-rw-r--r-- | docs/contribute.rst | 10 | ||||
-rwxr-xr-x | pydyf/__init__.py | 8 | ||||
-rw-r--r-- | pyproject.toml | 5 |
6 files changed, 83 insertions, 8 deletions
diff --git a/.github/workflows/doconfly.yml b/.github/workflows/doconfly.yml index cf2c1ca..a720a66 100644 --- a/.github/workflows/doconfly.yml +++ b/.github/workflows/doconfly.yml @@ -5,7 +5,7 @@ on: - master tags: - "*" - + jobs: doconfly: name: doconfly job diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b69256e..d2057b0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,6 @@ jobs: name: ${{ matrix.os }} - ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.8'] @@ -33,3 +32,7 @@ jobs: run: python -m pip install .[test] - name: Launch tests run: python -m pytest + - name: Check coding style + run: python -m flake8 + - name: Check imports order + run: python -m isort . --check --diff diff --git a/docs/changelog.rst b/docs/changelog.rst index 76f5813..3eb90e6 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,67 @@ Changelog ========= +Version 0.5.0 +------------- + +Released on 2022-10-11. + +New features: + +* Add the PDF.page_references property +* Revert the PDF.pages['Kids'] behavior to be retro-compatible with version 0.3.0 + +Backers and sponsors: + +* Grip Angebotssoftware +* Manuel Barkhau +* Crisp BV +* SimonSoft +* Menutech +* Spacinov +* KontextWork +* René Fritz +* NCC Group +* Kobalt +* Tom Pohl +* John R Ellis +* Moritz Mahringer +* Yanal-Yvez Fargialla +* Gábor +* Piotr Horzycki +* Andrew Ittner + + +Version 0.4.0 +------------- + +Released on 2022-10-11. + +New features: + +* Allow nth page’s reference to be retrieved using PDF.pages['Kids'][n] + +Backers and sponsors: + +* Grip Angebotssoftware +* Manuel Barkhau +* Crisp BV +* SimonSoft +* Menutech +* Spacinov +* KontextWork +* René Fritz +* NCC Group +* Kobalt +* Tom Pohl +* John R Ellis +* Moritz Mahringer +* Yanal-Yvez Fargialla +* Gábor +* Piotr Horzycki +* Andrew Ittner + + Version 0.3.0 ------------- diff --git a/docs/contribute.rst b/docs/contribute.rst index adf9024..f94a3d6 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -46,12 +46,20 @@ the pytest_ library. Launching tests require to have Ghostscript_ installed and available in ``PATH``. -You can launch tests (with code coverage and lint) using the following command:: +You can launch tests using the following command:: venv/bin/pytest +WeasyPrint also uses isort_ to check imports and flake8_ to check the coding +style:: + + venv/bin/python -m isort . --check --diff + venv/bin/python -m flake8 + .. _pytest: https://docs.pytest.org/ .. _Ghostscript: https://www.ghostscript.com/ +.. _isort: https://pycqa.github.io/isort/ +.. _flake8: https://flake8.pycqa.org/ Documentation diff --git a/pydyf/__init__.py b/pydyf/__init__.py index fac9ecc..85811f4 100755 --- a/pydyf/__init__.py +++ b/pydyf/__init__.py @@ -8,7 +8,7 @@ import zlib from codecs import BOM_UTF16_BE from hashlib import md5 -VERSION = __version__ = '0.3.0' +VERSION = __version__ = '0.5.0' def _to_bytes(item): @@ -482,6 +482,12 @@ class PDF: object_.number = len(self.objects) self.objects.append(object_) + @property + def page_references(self): + return tuple( + f'{object_number} 0 R'.encode('ascii') + for object_number in self.pages['Kids'][::3]) + def write_line(self, content, output): """Write line to output. diff --git a/pyproject.toml b/pyproject.toml index a89cea0..a3dbea1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,14 +38,11 @@ Donation = 'https://opencollective.com/courtbouillon' [project.optional-dependencies] doc = ['sphinx', 'sphinx_rtd_theme'] -test = ['pytest', 'pytest-xdist', 'pytest-flake8', 'pytest-isort', 'pytest-cov', 'coverage[toml]', 'pillow'] +test = ['pytest', 'isort', 'flake8', 'pillow'] [tool.flit.sdist] exclude = ['.*'] -[tool.pytest.ini_options] -addopts = '--isort --flake8 --numprocesses=auto' - [tool.coverage.run] branch = true include = ['tests/*', 'pydyf/*'] |