Skip to content

Commit 7c32237

Browse files
committed
Merge branch 'release/0.8.0'
2 parents 50d6e00 + 05a2970 commit 7c32237

29 files changed

+674
-236
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,11 @@ jobs:
5858
strategy:
5959
fail-fast: false
6060
matrix:
61-
# No pikepdf wheels for pypy3.8
62-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10']
61+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.9', 'pypy3.10']
6362

6463
steps:
6564
-
6665
uses: actions/checkout@v4
67-
-
68-
name: Start containers
69-
run: |
70-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml pull --quiet
71-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml up --detach
72-
echo "Wait for container to be started"
73-
sleep 5
74-
docker inspect gotenberg-client-test-server
7566
-
7667
name: Install poppler-utils
7768
run: |
@@ -83,34 +74,38 @@ jobs:
8374
with:
8475
python-version: ${{ matrix.python-version }}
8576
cache: 'pip'
77+
-
78+
name: Pull Docker images
79+
run: |
80+
docker compose --file tests/docker/docker-compose.ci-test-edge.yml pull --quiet
81+
docker compose --file tests/docker/docker-compose.ci-test.yml pull --quiet
8682
-
8783
name: Install Hatch
8884
run: |
8985
pip3 --quiet install --upgrade hatch uv
9086
hatch --version
9187
uv --version
9288
-
93-
name: Show environment
94-
run: |
95-
hatch test --show --python ${{ matrix.python-version }}
89+
name: Show environment
90+
run: |
91+
hatch test --show --python ${{ matrix.python-version }}
9692
-
9793
name: Run tests
9894
run: |
99-
hatch test --cover --python ${{ matrix.python-version }}
100-
ls -ahl .
95+
hatch test --cover --junitxml=junit.xml -o junit_family=legacy --python ${{ matrix.python-version }}
10196
-
10297
name: Upload coverage to Codecov
103-
if: matrix.python-version == '3.10'
104-
uses: codecov/codecov-action@v4
98+
if: matrix.python-version == '3.11'
99+
uses: codecov/codecov-action@v5
105100
with:
106-
# not required for public repos, but intermittently fails otherwise
107101
token: ${{ secrets.CODECOV_TOKEN }}
108102
-
109-
name: Stop containers
110-
if: always()
111-
run: |
112-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml logs
113-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml down
103+
name: Upload test results to Codecov
104+
if: ${{ !cancelled() }}
105+
uses: codecov/test-results-action@v1
106+
with:
107+
token: ${{ secrets.CODECOV_TOKEN }}
108+
flags: ${{ matrix.python-version }}
114109

115110
test-edge:
116111
name: Test Gotenberg :edge
@@ -119,17 +114,11 @@ jobs:
119114
contents: read
120115
needs:
121116
- lint
117+
env:
118+
GOTENBERG_CLIENT_EDGE_TEST: 1
122119
steps:
123120
-
124121
uses: actions/checkout@v4
125-
-
126-
name: Start containers
127-
run: |
128-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test-edge.yml pull --quiet
129-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test-edge.yml up --detach
130-
echo "Wait for container to be started"
131-
sleep 5
132-
docker inspect gotenberg-client-test-edge-server
133122
-
134123
name: Install poppler-utils
135124
run: |
@@ -154,13 +143,6 @@ jobs:
154143
name: Run tests
155144
run: |
156145
hatch test --cover --python 3.11
157-
ls -ahl .
158-
-
159-
name: Stop containers
160-
if: always()
161-
run: |
162-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test-edge.yml logs
163-
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test-edge.yml down
164146
165147
build:
166148
name: Build
@@ -297,4 +279,4 @@ jobs:
297279
path: dist
298280
-
299281
name: Publish build to PyPI
300-
uses: pypa/gh-action-pypi-publish@v1.10.2
282+
uses: pypa/gh-action-pypi-publish@v1.12.2

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
- id: detect-private-key
3131
# See https://github.com/prettier/prettier/issues/15742 for the fork reason
3232
- repo: https://github.com/rbubley/mirrors-prettier
33-
rev: "v3.3.3"
33+
rev: "v3.4.2"
3434
hooks:
3535
- id: prettier
3636
types_or:
@@ -45,13 +45,13 @@ repos:
4545
- id: codespell
4646
# Python hooks
4747
- repo: https://github.com/astral-sh/ruff-pre-commit
48-
rev: 'v0.6.9'
48+
rev: 'v0.8.2'
4949
hooks:
5050
# Run the linter.
5151
- id: ruff
5252
# Run the formatter.
5353
- id: ruff-format
5454
- repo: https://github.com/tox-dev/pyproject-fmt
55-
rev: "2.2.4"
55+
rev: "v2.5.0"
5656
hooks:
5757
- id: pyproject-fmt

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.8.0] - 2024-12-11
9+
10+
### Breaking Change
11+
12+
- Dropped support for Python 3.8 ([#43](https://github.com/stumpylog/gotenberg-client/pull/43))
13+
14+
### Added
15+
16+
- Official support and testing for Python 3.13 ([#25](https://github.com/stumpylog/gotenberg-client/pull/25))
17+
- Support for setting PDF metadata ([#42](https://github.com/stumpylog/gotenberg-client/pull/42))
18+
- Initial work by @spechtx in ([#40](https://github.com/stumpylog/gotenberg-client/pull/40))
19+
- Integrated Codecov test analytics ([#44](https://github.com/stumpylog/gotenberg-client/pull/44))
20+
21+
### Changed
22+
23+
- Use `pytest-docker` to manage Docker image services ([#36](https://github.com/stumpylog/gotenberg-client/pull/36))
24+
- Bump Bump pypa/gh-action-pypi-publish from 1.10.2 to 1.12.2 by @dependabot ([#41](https://github.com/stumpylog/gotenberg-client/pull/41))
25+
- Bump codecov/codecov-action from 4 to 5 by @dependabot ([#41](https://github.com/stumpylog/gotenberg-client/pull/41))
26+
827
## [0.7.0] - 2024-10-08
928

1029
### Fixed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,35 @@ with GotenbergClient("http://localhost:3000") as client:
102102
response.to_file(Path("my-world.pdf"))
103103
```
104104

105+
Adding metadata to a PDF:
106+
107+
This example shows how to add metadata to your generated PDF. All metadata fields are optional and include:
108+
109+
- Document info (title, author, subject, keywords)
110+
- Dates (creation, modification)
111+
- Technical details (pdf version, creator, producer)
112+
- PDF standards (trapped status, marked status)
113+
114+
```python
115+
from gotenberg_client import GotenbergClient
116+
from datetime import datetime
117+
118+
with GotenbergClient("http://localhost:3000") as client:
119+
with client.chromium.html_to_pdf() as route:
120+
response = (route
121+
.index("my-index.html")
122+
.metadata(
123+
title="My Document",
124+
author="John Doe",
125+
subject="Example PDF",
126+
keywords=["sample", "document", "test"],
127+
creation_date=datetime.now(),
128+
trapped="Unknown"
129+
)
130+
.run())
131+
response.to_file(Path("my-index.pdf"))
132+
```
133+
105134
To ensure the proper clean up of all used resources, both the client and the route(s) should be
106135
used as context manager. If for some reason you cannot, you should `.close` the client and any
107136
routes:

docs/roadmap.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
# Roadmap
22

3-
## Custom Response Class
4-
5-
Currently, the response returned is a basic httpx.Response. It could be useful to abstract this in some manner, especially for responses which return a zip file.
6-
7-
- Ability to iterate through the zip file contents in some way
8-
- Ability to write the response to some given output location?
9-
10-
## Missing Routes/Options
11-
12-
- Missing the configuration of the units of page size, currently it is always inches
3+
While I'm sure there's something out there, nothing is currently on the roadmap.

docs/routes.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,45 @@ These options are not yet implemented
9595
| `pdfa` | `.pdf_format()` | `PdfAFormat` | |
9696
| `pdfua` | <ul><li>`enable_universal_access()`<li>`disable_universal_access()`</li></ul> | N/A | |
9797

98-
#### Metadata
98+
#### PDF Metadata Support
9999

100100
[Gotenberg Documentation](https://gotenberg.dev/docs/routes#metadata-chromium)
101101

102-
These options are not yet implemented
102+
Add metadata to your PDFs:
103+
104+
```python
105+
from gotenberg_client import GotenbergClient
106+
from datetime import datetime
107+
108+
with GotenbergClient("http://localhost:3000") as client:
109+
with client.chromium.html_to_pdf() as route:
110+
response = (route
111+
.index("my-index.html")
112+
.metadata(
113+
title="My Document",
114+
author="John Doe",
115+
creation_date=datetime.now(),
116+
keywords=["sample", "document"],
117+
subject="Sample PDF Generation",
118+
trapped="Unknown"
119+
)
120+
.run())
121+
```
122+
123+
Supported metadata fields:
124+
125+
- `title`: Document title
126+
- `author`: Document author
127+
- `subject`: Document subject
128+
- `keywords`: List of keywords
129+
- `creator`: Creating application
130+
- `creation_date`: Creation datetime
131+
- `modification_date`: Last modification datetime
132+
- `producer`: PDF producer
133+
- `trapped`: Trapping status ('True', 'False', 'Unknown')
134+
- `copyright`: Copyright information
135+
- `marked`: PDF marked status
136+
- `pdf_version`: PDF version number
103137

104138
## LibreOffice
105139

pyproject.toml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license = "MPL-2.0"
1616
authors = [
1717
{ name = "Trenton H", email = "rda0128ou@mozmail.com" },
1818
]
19-
requires-python = ">=3.8"
19+
requires-python = ">=3.9"
2020
classifiers = [
2121
"Development Status :: 4 - Beta",
2222
"Environment :: Web Environment",
@@ -25,18 +25,17 @@ classifiers = [
2525
"Operating System :: OS Independent",
2626
"Programming Language :: Python",
2727
"Programming Language :: Python :: 3 :: Only",
28-
"Programming Language :: Python :: 3.8",
2928
"Programming Language :: Python :: 3.9",
3029
"Programming Language :: Python :: 3.10",
3130
"Programming Language :: Python :: 3.11",
3231
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: 3.13",
3333
"Programming Language :: Python :: Implementation :: CPython",
3434
"Programming Language :: Python :: Implementation :: PyPy",
3535
]
3636
dynamic = [ "version" ]
3737
dependencies = [
38-
"httpx[http2]~=0.24; python_version<'3.9'",
39-
"httpx[http2]~=0.27; python_version>='3.9'",
38+
"httpx[http2]~=0.28",
4039
"typing-extensions; python_version<'3.11'",
4140
]
4241

@@ -64,7 +63,7 @@ installer = "uv"
6463

6564
[tool.hatch.envs.hatch-static-analysis]
6665
# https://hatch.pypa.io/latest/config/internal/static-analysis/
67-
dependencies = [ "ruff ~= 0.6" ]
66+
dependencies = [ "ruff ~= 0.8" ]
6867
config-path = "none"
6968

7069
[tool.hatch.envs.hatch-test]
@@ -74,7 +73,6 @@ randomize = true
7473
dependencies = [
7574
"coverage-enable-subprocess == 1.0",
7675
"coverage[toml] ~= 7.6",
77-
"pytest < 8.0; python_version < '3.9'",
7876
"pytest ~= 8.3; python_version >= '3.9'",
7977
"pytest-mock ~= 3.14",
8078
"pytest-randomly ~= 3.15",
@@ -83,10 +81,10 @@ dependencies = [
8381
]
8482
extra-dependencies = [
8583
"pytest-sugar",
86-
"pytest-httpx == 0.30.0; python_version >= '3.9'",
87-
"pytest-httpx ~= 0.22; python_version < '3.9'",
84+
"pytest-httpx ~= 0.35",
8885
"pikepdf",
8986
"python-magic",
87+
"pytest-docker ~= 3.1",
9088
]
9189
extra-args = [ "--maxprocesses=8", "--pythonwarnings=all" ]
9290

@@ -109,19 +107,19 @@ cov-report = [
109107
]
110108

111109
[[tool.hatch.envs.hatch-test.matrix]]
112-
python = [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10" ]
110+
python = [ "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10" ]
113111

114112
#
115113
# Custom Environments
116114
#
117115
[tool.hatch.envs.typing]
118116
detached = true
119117
dependencies = [
120-
"mypy ~= 1.11",
118+
"mypy ~= 1.13",
121119
"httpx",
122120
"pytest",
123121
"pikepdf",
124-
"pytest-httpx == 0.30.0",
122+
"pytest-httpx ~= 0.35",
125123
]
126124

127125
[tool.hatch.envs.typing.scripts]
@@ -168,7 +166,7 @@ deploy = [
168166
#
169167

170168
[tool.ruff]
171-
target-version = "py38"
169+
target-version = "py39"
172170
line-length = 120
173171

174172
# https://docs.astral.sh/ruff/settings/
@@ -244,13 +242,17 @@ lint.ignore = [
244242
]
245243
# Tests can use magic values, assertions, and relative imports
246244
lint.per-file-ignores."tests/**/*" = [ "PLR2004", "S101", "TID252" ]
245+
lint.per-file-ignores."tests/utils.py" = [ "S603" ]
247246
# No relative imports
248247
lint.flake8-tidy-imports.ban-relative-imports = "all"
249248
# One import per line
250249
lint.isort.force-single-line = true
251250
# Recognize us please
252251
lint.isort.known-first-party = [ "gotenberg_client" ]
253252

253+
[tool.pyproject-fmt]
254+
max_supported_python = "3.13"
255+
254256
[tool.pytest.ini_options]
255257
minversion = "7.0"
256258
testpaths = [ "tests" ]

src/gotenberg_client/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: 2023-present Trenton H <rda0128ou@mozmail.com>
22
#
33
# SPDX-License-Identifier: MPL-2.0
4-
__version__ = "0.7.0"
4+
__version__ = "0.8.0"

0 commit comments

Comments
 (0)