1
0
Fork 0

Merging upstream version 0.5.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-08 07:42:18 +01:00
parent c8532840ce
commit 6fdc00b917
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
6 changed files with 83 additions and 8 deletions

View file

@ -5,7 +5,7 @@ on:
- master
tags:
- "*"
jobs:
doconfly:
name: doconfly job

View file

@ -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

View file

@ -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 pages 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
-------------

View file

@ -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

View file

@ -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.

View file

@ -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/*']