Skip to content

Commit 4824493

Browse files
authored
Merge pull request #50 from kcroker/maintenance
Maintenance
2 parents 93f377b + 368d3af commit 4824493

17 files changed

Lines changed: 177 additions & 257 deletions

.github/workflows/docs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-24.04
11+
12+
steps:
13+
- uses: actions/checkout@v6
14+
with:
15+
# This actions is ridiculously bad at fetching tags
16+
# See https://github.com/actions/checkout/issues/2309
17+
fetch-depth: 0
18+
fetch-tags: true
19+
20+
- name: Install prerequisites on Ubuntu
21+
run: |
22+
sudo apt update
23+
sudo apt install --yes libdjvulibre21 libdjvulibre-dev
24+
25+
- uses: astral-sh/setup-uv@v7
26+
- name: Install dependencies
27+
run: uv sync
28+
29+
- name: Build docs
30+
run: |
31+
make build-docs
32+
mkdir .github/wiki
33+
cp docs/Home.md docs/dpsprep.1.md .github/wiki
34+
35+
- name: Upload to wiki
36+
uses: spenserblack/actions-wiki@v0.3.0

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313

1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v6
16+
with:
17+
submodules: true
1618

1719
- name: Install prerequisites on Ubuntu
1820
if: matrix.os == 'ubuntu-24.04'
@@ -22,7 +24,7 @@ jobs:
2224
2325
- name: Install prerequisites on macOS
2426
if: matrix.os == 'macos-14'
25-
run: brew install djvulibre libtiff
27+
run: brew install djvulibre
2628

2729
# - name: Install prerequisites on Windows
2830
# if: matrix.os == 'windows-2022'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.pytest_cache
22
.ruff_cache
3-
.tests
3+
docs/dpsprep.1
4+
docs/dpsprep.1.md

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "ruff-config"]
2+
path = ruff-config
3+
url = git@github.com:v--/ruff-config.git

CHANGELOG.md

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,164 @@
1-
## v2.5.4 (2026-04-24)
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Unreleased
9+
10+
* Maintenance
11+
12+
## 2.5.4 - 2026-04-24
213

314
* Run `uv` security audit and update some dependencies
415

5-
## v2.5.3 (2026-03-25)
16+
## 2.5.3 - 2026-03-25
617

718
* Fix broken workflow without text layer translation
819
* Shorter names for temporary directories
920
* Code maintenance
1021

11-
## v2.5.2 (2026-03-25)
22+
## 2.5.2 - 2026-03-25
1223

1324
* Relax dependency versions
1425

15-
## v2.5.1 (2026-03-14)
26+
## 2.5.1 - 2026-03-14
1627

1728
* Allow manually configuring PDF page resolution (DPI)
1829

19-
## v2.5.0 (2026-03-13)
30+
## 2.5.0 - 2026-03-13
2031

2132
* Account for DjVu file resolution
2233
* Simplify image diffing and regenerate better-quality fixtures
2334

24-
## v2.4.2 (2026-02-24)
35+
## 2.4.2 - 2026-02-24
2536

2637
* Fix issue where only the main process has its logger configured
2738

28-
## v2.4.1 (2026-02-24)
39+
## 2.4.1 - 2026-02-24
2940

3041
* Fix compatibility issues with the new OCRmyPDF API
3142
* Remove support for Python 3.10
3243

33-
## v2.4.0 (2026-02-24)
44+
## 2.4.0 - 2026-02-24
3445

3546
* Migrate to `uv` from `pyenv` + `poetry`
3647
* Update dependencies
3748

38-
## v2.3.1 (2025-10-28)
49+
## 2.3.1 - 2025-10-28
3950

4051
* Fix mixed-up email format
4152

42-
## v2.3.0 (2025-10-28)
53+
## 2.3.0 - 2025-10-28
4354

4455
* Remove support for Python 3.9
4556
* Migrate to standardized `pyproject.toml`
4657
* Update dependencies
4758

48-
## v2.2.15 (2025-07-02)
59+
## 2.2.15 - 2025-07-02
4960

5061
* Add support for installation via `pipx`
5162

52-
## v2.2.14 (2025-05-27)
63+
## 2.2.14 - 2025-05-27
5364

5465
* Improve installation notes
5566
* Bump djvulibre-python version
5667

57-
## v2.2.13 (2025-02-12)
68+
## 2.2.13 - 2025-02-12
5869

5970
* Fail-safe quality settings for non-JPEG images
6071

61-
## v2.2.12 (2025-01-27)
72+
## 2.2.12 - 2025-01-27
6273

6374
* Update pytest_image_diff and fix newly broken tests
6475

65-
## v2.2.11 (2025-01-26)
76+
## 2.2.11 - 2025-01-26
6677

6778
* Update dependencies
6879

69-
## v2.2.10 (2024-10-25)
80+
## 2.2.10 - 2024-10-25
7081

7182
* Improve interface with OCRmyPDF
7283
* Fix CI build
7384

74-
## v2.2.9 (2024-10-25)
85+
## 2.2.9 - 2024-10-25
7586

7687
* Improve type hints
7788
* Update dependencies
7889

79-
## v2.2.8 (2024-10-18)
90+
## 2.2.8 - 2024-10-18
8091

8192
* Support single characters in the text layer
8293

83-
## v2.2.7 (2024-08-27)
94+
## 2.2.7 - 2024-08-27
8495

8596
* Improve tab and newline handling
8697

87-
## v2.2.6 (2024-08-05)
98+
## 2.2.6 - 2024-08-05
8899

89100
* Fix accidental whitespace removal from text blocks
90101

91-
## v2.2.5 (2024-07-20)
102+
## 2.2.5 - 2024-07-20
92103

93104
* Re-add ability to force the image mode (RGB/Grayscale/Monochrome)
94105

95-
## v2.2.4 (2024-02-24)
106+
## 2.2.4 - 2024-02-24
96107

97108
* Update dependencies
98109

99-
## v2.2.3 (2023-12-09)
110+
## 2.2.3 - 2023-12-09
100111

101112
* Fix CI build
102113
* Ignore invalid UTF-8 sequences
103114
* Ignore unrecognized page titles in the outline (#23)
104115

105-
## v2.2.2 (2023-10-29)
116+
## 2.2.2 - 2023-10-29
106117

107118
* Update dependencies
108119

109-
## v2.2.1 (2023-11-06)
120+
## 2.2.1 - 2023-11-06
110121

111122
* Handle invalid PDF pages
112123
* Fix exception in text layer processing (#20)
113124

114-
## v2.2.0 (2023-10-28)
125+
## 2.2.0 - 2023-10-28
115126

116127
* Add options for disabling the text layer and for directly running OCR
117128

118-
## v2.1.5 (2023-10-27)
129+
## 2.1.5 - 2023-10-27
119130

120131
* Fix inverted colors in images (#16)
121132

122-
## v2.1.4 (2023-10-06)
133+
## 2.1.4 - 2023-10-06
123134

124135
* Fix typo in logging code
125136

126-
## v2.1.3 (2023-10-06)
137+
## 2.1.3 - 2023-10-06
127138

128139
* Improve logging
129140

130-
## v2.1.2 (2023-10-02)
141+
## 2.1.2 - 2023-10-02
131142

132143
* Accidental version bump
133144

134-
## v2.1.1 (2023-10-02)
145+
## 2.1.1 - 2023-10-02
135146

136147
* Remove debug code
137148

138-
## v2.1.0 (2023-10-02)
149+
## 2.1.0 - 2023-10-02
139150

140151
* Add support for OCRmyPDF
141152

142-
## v2.0.2 (2023-08-03)
153+
## 2.0.2 - 2023-08-03
143154

144155
* Update some other dependencies
145156
* Replace `python-djvulibre` with `djvulibre-python`
146157

147-
## v2.0.1 (2023-06-22)
158+
## 2.0.1 - 2023-06-22
148159

149160
* Minor improvements in packaging
150161

151-
## v2.0.0 (2023-05-04)
162+
## 2.0.0 - 2023-05-04
152163

153164
* Fully rewrite

Makefile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
.PHONY: lint test
1+
SOURCE := $(wildcard dpsprep/*.py)
2+
3+
.PHONY: lint test build-docs
24

35
lint:
46
uv run ruff check
@@ -7,5 +9,20 @@ lint:
79
test:
810
uv run pytest
911

10-
dpsprep.1: dpsprep.1.ronn
11-
ronn --roff dpsprep.1.ronn
12+
docs:
13+
mkdir docs
14+
15+
docs/dpsprep.1: $(SOURCE) pyproject.toml docs/examples.man | docs
16+
uv run click-man dpsprep \
17+
--target docs \
18+
--man-version $(shell git describe --tags) \
19+
--man-date $(shell git log --max-count 1 --format=%as)
20+
21+
cat docs/examples.man >> docs/dpsprep.1
22+
23+
# Render the man page as text and indent the entire file so that it is a valid markdown code block
24+
docs/dpsprep.1.md: docs/dpsprep.1
25+
echo -n ' ' > docs/dpsprep.1.md
26+
MANWIDTH=100 man docs/dpsprep.1 | sed --null-data 's/\n/\n /g' | head --lines=-1 >> docs/dpsprep.1.md
27+
28+
build-docs: docs/dpsprep.1.md

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
[![Tests](https://github.com/kcroker/dpsprep/actions/workflows/test.yml/badge.svg)](https://github.com/kcroker/dpsprep/actions/workflows/test.yml) [![AUR Package](https://img.shields.io/aur/version/dpsprep)](https://aur.archlinux.org/packages/dpsprep)
44

5-
This tool, initially made specifically for use with Sony's Digital Paper System (DPS), is now a general-purpose DjVu to PDF converter with a focus on small output size and the ability to preserve document outlines (e.g. TOC) and text layers (e.g. OCR).
5+
Convert DjVu files to PDF.
6+
7+
The name comes from Sony's Digital Paper System (DPS), for which the tool was initially developed - see [below](#kevins-notes-regarding-the-first-version).
68

79
## Usage
810

@@ -18,7 +20,7 @@ You can also skip translating the text layer (it is sometimes not translated wel
1820

1921
dpsprep --ocr '{"language": ["rus", "eng"]}' input.djvu
2022

21-
Consult the man file ([online](./dpsprep.1.ronn)) for details; there are a lot of options to consider.
23+
Consult the man file ([online](https://github.com/kcroker/dpsprep/wiki/dpsprep.1)) for details; there are a lot of options.
2224

2325
See the next section for different ways to run the program.
2426

@@ -80,7 +82,7 @@ If you want `dpsprep` to be able to use `ocrmypdf` from `pipx`'s isolated enviro
8082
> If you are packaging this for some other package manager, consider using PEP-517 tools as shown in [this PKGBUILD file](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=dpsprep).
8183
8284
> [!NOTE]
83-
> Previous versions of the tool itself used to depend on third-party binaries, but this is no longer the case. The test fixtures are checked in, however regenerating them (see [`./fixtures/Makefile`](./fixtures/Makefile)) requires `pdflatex` (texlive, among others), `gs` (Ghostscript), `oxipng` (oxipng), `pdftotext` (Poppler), `djvudigital` (GSDjVU) and `djvused` (DjVuLibre). Similarly, the man file is checked in, but building it from markdown depends on `ronn`.
85+
> Previous versions of the tool itself used to depend on third-party binaries, but this is no longer the case. The test fixtures are checked in, however regenerating them (see [`./fixtures/Makefile`](./fixtures/Makefile)) requires `pdflatex` (texlive, among others), `gs` (Ghostscript), `oxipng` (oxipng), `pdftotext` (Poppler), `djvudigital` (GSDjVU) and `djvused` (DjVuLibre).
8486
8587
## Details
8688

docs/Home.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The only document on this wiki is the [man page](./dpsprep.1).
2+
3+
See the README in the [repository](https://github.com/kcroker/dpsprep) for installation instructions and technical notes.

docs/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# dpsprep docs
2+
3+
The usage documentation amounts to a simple man page, which is built dynamically and hosted at [the wiki](https://github.com/kcroker/dpsprep/wiki).
4+
5+
See the README in the [project root](https://github.com/kcroker/dpsprep) for installation instructions and technical notes.

docs/examples.man

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.SH EXAMPLES
2+
.P
3+
Produce "file.pdf" in the current directory:
4+
.IP
5+
dpsprep /wherever/file.djvu
6+
.P
7+
Produce "output.pdf" with reduced image quality and aggressive PDF image optimizations:
8+
.IP
9+
dpsprep --quality=30 -O3 input.djvu output.pdf
10+
.P
11+
Produce an output file using a large pool of workers:
12+
.IP
13+
dpsprep --pool=16 input.djvu
14+
.P
15+
Force bitonal images:
16+
.IP
17+
dpsprep --mode bitonal input.djvu
18+
.P
19+
Produce an output file by disregarding the text layer and running OCRmyPDF instead:
20+
.IP
21+
dpsprep --ocr '{"language": ["rus", "eng"]}' input.djvu
22+
.P
23+
Simply disregard the text layer without OCR:
24+
.IP
25+
dpsprep --no-text input.djvu

0 commit comments

Comments
 (0)