kindle-pdf-capture 1.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. kindle_pdf_capture-1.4.2/.github/ISSUE_TEMPLATE/bug_report.yml +58 -0
  2. kindle_pdf_capture-1.4.2/.github/ISSUE_TEMPLATE/feature_request.yml +29 -0
  3. kindle_pdf_capture-1.4.2/.github/PULL_REQUEST_TEMPLATE.md +14 -0
  4. kindle_pdf_capture-1.4.2/.github/dependabot.yml +13 -0
  5. kindle_pdf_capture-1.4.2/.github/workflows/ci.yml +132 -0
  6. kindle_pdf_capture-1.4.2/.github/workflows/release.yml +168 -0
  7. kindle_pdf_capture-1.4.2/.gitignore +78 -0
  8. kindle_pdf_capture-1.4.2/.python-version +1 -0
  9. kindle_pdf_capture-1.4.2/CHANGELOG.md +351 -0
  10. kindle_pdf_capture-1.4.2/CONTRIBUTING.ja.md +51 -0
  11. kindle_pdf_capture-1.4.2/CONTRIBUTING.md +52 -0
  12. kindle_pdf_capture-1.4.2/LICENSE +21 -0
  13. kindle_pdf_capture-1.4.2/PKG-INFO +114 -0
  14. kindle_pdf_capture-1.4.2/README.md +55 -0
  15. kindle_pdf_capture-1.4.2/SECURITY.md +11 -0
  16. kindle_pdf_capture-1.4.2/docs/en/architecture.md +72 -0
  17. kindle_pdf_capture-1.4.2/docs/en/installation.md +62 -0
  18. kindle_pdf_capture-1.4.2/docs/en/legal.md +34 -0
  19. kindle_pdf_capture-1.4.2/docs/en/permissions.md +38 -0
  20. kindle_pdf_capture-1.4.2/docs/en/troubleshooting.md +76 -0
  21. kindle_pdf_capture-1.4.2/docs/en/usage.md +95 -0
  22. kindle_pdf_capture-1.4.2/docs/ja/architecture.md +66 -0
  23. kindle_pdf_capture-1.4.2/docs/ja/installation.md +62 -0
  24. kindle_pdf_capture-1.4.2/docs/ja/legal.md +28 -0
  25. kindle_pdf_capture-1.4.2/docs/ja/permissions.md +49 -0
  26. kindle_pdf_capture-1.4.2/docs/ja/troubleshooting.md +78 -0
  27. kindle_pdf_capture-1.4.2/docs/ja/usage.md +86 -0
  28. kindle_pdf_capture-1.4.2/pyproject.toml +81 -0
  29. kindle_pdf_capture-1.4.2/scripts/verify_release_artifacts.py +211 -0
  30. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/__init__.py +10 -0
  31. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/cropper.py +435 -0
  32. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/main.py +670 -0
  33. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/normalize.py +113 -0
  34. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/ocr.py +145 -0
  35. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/orchestrator.py +228 -0
  36. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/page_turner.py +161 -0
  37. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/pdf_builder.py +88 -0
  38. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/region_selector.py +614 -0
  39. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/render_wait.py +148 -0
  40. kindle_pdf_capture-1.4.2/src/kindle_pdf_capture/window_capture.py +373 -0
  41. kindle_pdf_capture-1.4.2/tests/__init__.py +0 -0
  42. kindle_pdf_capture-1.4.2/tests/conftest.py +18 -0
  43. kindle_pdf_capture-1.4.2/tests/test_cli.py +1409 -0
  44. kindle_pdf_capture-1.4.2/tests/test_cropper.py +692 -0
  45. kindle_pdf_capture-1.4.2/tests/test_normalize.py +176 -0
  46. kindle_pdf_capture-1.4.2/tests/test_ocr.py +233 -0
  47. kindle_pdf_capture-1.4.2/tests/test_orchestrator.py +359 -0
  48. kindle_pdf_capture-1.4.2/tests/test_page_turner.py +194 -0
  49. kindle_pdf_capture-1.4.2/tests/test_pdf_builder.py +190 -0
  50. kindle_pdf_capture-1.4.2/tests/test_project_metadata.py +36 -0
  51. kindle_pdf_capture-1.4.2/tests/test_region_selector.py +432 -0
  52. kindle_pdf_capture-1.4.2/tests/test_render_wait.py +247 -0
  53. kindle_pdf_capture-1.4.2/tests/test_version.py +50 -0
  54. kindle_pdf_capture-1.4.2/tests/test_window_capture.py +350 -0
  55. kindle_pdf_capture-1.4.2/uv.lock +1430 -0
@@ -0,0 +1,58 @@
1
+ name: Bug Report
2
+ description: Report a bug or unexpected behavior
3
+ labels: ["bug"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thank you for reporting a bug. Please fill in as much detail as possible.
9
+ バグ報告ありがとうございます。できるだけ詳細をご記入ください。
10
+
11
+ - type: input
12
+ id: macos_version
13
+ attributes:
14
+ label: macOS version / macOS バージョン
15
+ placeholder: "e.g. macOS 14.4"
16
+ validations:
17
+ required: true
18
+
19
+ - type: input
20
+ id: python_version
21
+ attributes:
22
+ label: Python version / Python バージョン
23
+ placeholder: "e.g. 3.11.9"
24
+ validations:
25
+ required: true
26
+
27
+ - type: input
28
+ id: package_version
29
+ attributes:
30
+ label: kindle-pdf-capture version
31
+ placeholder: "e.g. 0.1.0"
32
+ validations:
33
+ required: true
34
+
35
+ - type: textarea
36
+ id: description
37
+ attributes:
38
+ label: Description / 説明
39
+ description: What happened? What did you expect to happen? / 何が起きましたか?どうなることを期待していましたか?
40
+ validations:
41
+ required: true
42
+
43
+ - type: textarea
44
+ id: steps
45
+ attributes:
46
+ label: Steps to reproduce / 再現手順
47
+ placeholder: |
48
+ 1. Run `kpc --out ...`
49
+ 2. ...
50
+ validations:
51
+ required: true
52
+
53
+ - type: textarea
54
+ id: logs
55
+ attributes:
56
+ label: Error output / エラー出力
57
+ description: Paste the full error output here. Use `--debug` for more detail.
58
+ render: shell
@@ -0,0 +1,29 @@
1
+ name: Feature Request
2
+ description: Suggest a new feature or improvement
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for suggesting an improvement!
9
+ 改善提案ありがとうございます!
10
+
11
+ - type: textarea
12
+ id: problem
13
+ attributes:
14
+ label: Problem / 課題
15
+ description: What problem does this feature solve? / この機能はどんな問題を解決しますか?
16
+ validations:
17
+ required: true
18
+
19
+ - type: textarea
20
+ id: solution
21
+ attributes:
22
+ label: Proposed solution / 提案する解決策
23
+ validations:
24
+ required: true
25
+
26
+ - type: textarea
27
+ id: alternatives
28
+ attributes:
29
+ label: Alternatives considered / 検討した代替案
@@ -0,0 +1,14 @@
1
+ ## Summary / 概要
2
+
3
+ - EN:
4
+ - JA:
5
+
6
+ ## Changes / 変更点
7
+
8
+ -
9
+
10
+ ## Test Plan / テスト計画
11
+
12
+ - [ ]
13
+
14
+ ## Notes / 補足
@@ -0,0 +1,13 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ open-pull-requests-limit: 5
8
+
9
+ - package-ecosystem: github-actions
10
+ directory: /
11
+ schedule:
12
+ interval: weekly
13
+ open-pull-requests-limit: 5
@@ -0,0 +1,132 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ lint-and-test:
15
+ name: Lint & Test (Python ${{ matrix.python-version }})
16
+ runs-on: macos-latest
17
+ strategy:
18
+ matrix:
19
+ python-version: ["3.11", "3.12"]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v7
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v9.0.0
26
+ with:
27
+ version: "0.11.32"
28
+ # Sets UV_PYTHON, which outranks .python-version. Without it every
29
+ # matrix leg silently falls back to the 3.11 pinned in that file.
30
+ python-version: ${{ matrix.python-version }}
31
+ enable-cache: true
32
+ prune-cache: true
33
+ cache-dependency-glob: "uv.lock"
34
+
35
+ - name: Set up Python ${{ matrix.python-version }}
36
+ run: uv python install
37
+
38
+ - name: Sync dev dependencies
39
+ run: uv sync --locked --extra dev
40
+
41
+ # The job name is not evidence. Fail loudly if the interpreter that was
42
+ # actually resolved is not the one this leg claims to cover.
43
+ - name: Verify Python matrix version
44
+ env:
45
+ EXPECTED_PYTHON: ${{ matrix.python-version }}
46
+ run: |
47
+ uv run --locked python - <<'PY'
48
+ import os
49
+ import sys
50
+
51
+ actual = f"{sys.version_info.major}.{sys.version_info.minor}"
52
+ expected = os.environ["EXPECTED_PYTHON"]
53
+
54
+ if actual != expected:
55
+ raise SystemExit(f"expected Python {expected}, got {actual}")
56
+
57
+ print(f"Python matrix verified: {actual}")
58
+ PY
59
+
60
+ - name: Ruff lint
61
+ run: uv run --locked ruff check .
62
+
63
+ - name: Ruff format check
64
+ run: uv run --locked ruff format --check .
65
+
66
+ - name: Run tests with coverage
67
+ run: uv run --locked pytest --cov=kindle_pdf_capture --cov-report=term-missing
68
+
69
+ package-smoke:
70
+ name: Package smoke
71
+ runs-on: macos-latest
72
+
73
+ steps:
74
+ - uses: actions/checkout@v7
75
+
76
+ - name: Install uv
77
+ uses: astral-sh/setup-uv@v9.0.0
78
+ with:
79
+ version: "0.11.32"
80
+ python-version: "3.12"
81
+ enable-cache: true
82
+ prune-cache: true
83
+ cache-dependency-glob: "uv.lock"
84
+
85
+ - name: Set up Python 3.12
86
+ run: uv python install
87
+
88
+ - name: Sync dev dependencies
89
+ run: uv sync --locked --extra dev
90
+
91
+ - name: Build wheel and sdist
92
+ run: uv build
93
+
94
+ - name: Verify distribution metadata
95
+ run: uv run --locked python scripts/verify_release_artifacts.py dist
96
+
97
+ # Installs the wheel outside the project environment, so a package that
98
+ # only imports because the source tree happens to be on sys.path fails here.
99
+ - name: Install the wheel into a clean environment
100
+ run: |
101
+ uv venv .release-smoke --python 3.12
102
+ uv pip install --python .release-smoke/bin/python dist/*.whl
103
+
104
+ - name: Check the installed package reports its own version
105
+ run: |
106
+ .release-smoke/bin/python - <<'PY'
107
+ from importlib.metadata import version
108
+
109
+ import kindle_pdf_capture
110
+
111
+ expected = version("kindle-pdf-capture")
112
+ assert kindle_pdf_capture.__version__ == expected, (
113
+ f"runtime version {kindle_pdf_capture.__version__} != metadata {expected}"
114
+ )
115
+ print(expected)
116
+ PY
117
+
118
+ - name: Check the console script runs
119
+ run: .release-smoke/bin/kpc --help
120
+
121
+ # PyPI serves the sdist too, so it has to be able to produce the wheel.
122
+ - name: Rebuild the wheel from the sdist
123
+ run: |
124
+ mkdir -p dist-from-sdist
125
+ uv build dist/*.tar.gz --wheel --out-dir dist-from-sdist
126
+ uv run --locked python scripts/verify_release_artifacts.py dist-from-sdist --wheel-only
127
+
128
+ - name: Install the sdist-built wheel into a clean environment
129
+ run: |
130
+ uv venv .sdist-smoke --python 3.12
131
+ uv pip install --python .sdist-smoke/bin/python dist-from-sdist/*.whl
132
+ .sdist-smoke/bin/kpc --help
@@ -0,0 +1,168 @@
1
+ # Publishes to PyPI through Trusted Publishing (OIDC). No API token is stored.
2
+ #
3
+ # The PyPI publisher is registered against this file's name, the `pypi`
4
+ # environment and this repository, so renaming any of the three breaks
5
+ # publishing until the publisher is re-registered.
6
+ #
7
+ # A tag push is the only trigger: there is deliberately no workflow_dispatch and
8
+ # no branch trigger, so publishing cannot be started by hand or by a fork.
9
+ name: Publish release
10
+
11
+ on:
12
+ push:
13
+ tags:
14
+ - "v*"
15
+
16
+ # Nothing is granted by default; each job opts in to the minimum it needs.
17
+ permissions: {}
18
+
19
+ concurrency:
20
+ group: publish-${{ github.ref }}
21
+ cancel-in-progress: false
22
+
23
+ jobs:
24
+ build:
25
+ name: Build and verify
26
+ runs-on: macos-latest
27
+ permissions:
28
+ contents: read
29
+
30
+ steps:
31
+ # Full history: the ancestry check below needs real commits, not a shallow clone.
32
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
33
+ with:
34
+ fetch-depth: 0
35
+
36
+ # A tag can be pushed to any commit, including one that was never
37
+ # reviewed or merged. Matching the version string alone does not prove
38
+ # the code being published is the code on main.
39
+ - name: Verify the release commit is on main
40
+ run: |
41
+ git fetch --no-tags origin main
42
+
43
+ if ! git merge-base --is-ancestor "$GITHUB_SHA" "refs/remotes/origin/main"; then
44
+ echo "::error::Release tag target $GITHUB_SHA is not contained in origin/main"
45
+ exit 1
46
+ fi
47
+
48
+ echo "Release tag target is contained in origin/main"
49
+
50
+ - name: Install uv
51
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
52
+ with:
53
+ version: "0.11.32"
54
+ python-version: "3.12"
55
+ enable-cache: true
56
+ prune-cache: true
57
+ cache-dependency-glob: "uv.lock"
58
+
59
+ - name: Set up Python 3.12
60
+ run: uv python install
61
+
62
+ - name: Sync dev dependencies
63
+ run: uv sync --locked --extra dev
64
+
65
+ # Runs before anything is built: a tag that disagrees with the project
66
+ # version must never reach the publish job.
67
+ - name: Verify the tag matches the project version
68
+ env:
69
+ TAG_NAME: ${{ github.ref_name }}
70
+ run: |
71
+ uv run --locked python - <<'PY'
72
+ import os
73
+ import sys
74
+ import tomllib
75
+ from pathlib import Path
76
+
77
+ tag = os.environ["TAG_NAME"]
78
+ version = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
79
+ expected = f"v{version}"
80
+
81
+ if tag != expected:
82
+ sys.exit(f"tag {tag!r} does not match pyproject version {version!r} (expected {expected!r})")
83
+
84
+ print(f"{tag} matches pyproject version {version}")
85
+ PY
86
+
87
+ - name: Ruff lint
88
+ run: uv run --locked ruff check .
89
+
90
+ - name: Ruff format check
91
+ run: uv run --locked ruff format --check .
92
+
93
+ - name: Run tests with coverage
94
+ run: uv run --locked pytest --cov=kindle_pdf_capture --cov-report=term-missing
95
+
96
+ - name: Build wheel and sdist
97
+ run: uv build
98
+
99
+ - name: Verify distribution metadata
100
+ run: uv run --locked python scripts/verify_release_artifacts.py dist
101
+
102
+ - name: Install the wheel into a clean environment
103
+ run: |
104
+ uv venv .release-smoke --python 3.12
105
+ uv pip install --python .release-smoke/bin/python dist/*.whl
106
+
107
+ - name: Check the installed package reports its own version
108
+ run: |
109
+ .release-smoke/bin/python - <<'PY'
110
+ from importlib.metadata import version
111
+
112
+ import kindle_pdf_capture
113
+
114
+ expected = version("kindle-pdf-capture")
115
+ assert kindle_pdf_capture.__version__ == expected, (
116
+ f"runtime version {kindle_pdf_capture.__version__} != metadata {expected}"
117
+ )
118
+ print(expected)
119
+ PY
120
+
121
+ - name: Check the console script runs
122
+ run: .release-smoke/bin/kpc --help
123
+
124
+ - name: Rebuild the wheel from the sdist
125
+ run: |
126
+ mkdir -p dist-from-sdist
127
+ uv build dist/*.tar.gz --wheel --out-dir dist-from-sdist
128
+ uv run --locked python scripts/verify_release_artifacts.py dist-from-sdist --wheel-only
129
+
130
+ - name: Install the sdist-built wheel into a clean environment
131
+ run: |
132
+ uv venv .sdist-smoke --python 3.12
133
+ uv pip install --python .sdist-smoke/bin/python dist-from-sdist/*.whl
134
+ .sdist-smoke/bin/kpc --help
135
+
136
+ # Only the artifacts verified above are handed to the publish job.
137
+ - name: Upload distributions
138
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
139
+ with:
140
+ name: python-dist
141
+ path: dist/*
142
+ if-no-files-found: error
143
+
144
+ publish:
145
+ name: Publish to PyPI
146
+ needs: build
147
+ runs-on: ubuntu-latest
148
+ environment: pypi
149
+ permissions:
150
+ contents: read
151
+ id-token: write
152
+
153
+ steps:
154
+ # Defaults to this workflow run, so nothing from another run can be pulled in.
155
+ - name: Download distributions
156
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
157
+ with:
158
+ name: python-dist
159
+ path: dist
160
+
161
+ # No python-version: this job runs no project command, only uv publish.
162
+ - name: Install uv
163
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
164
+ with:
165
+ version: "0.11.32"
166
+
167
+ - name: Publish to PyPI
168
+ run: uv publish --trusted-publishing always dist/*
@@ -0,0 +1,78 @@
1
+ # --- local-only agent/context files (never commit) ---
2
+ CLAUDE.md
3
+ .claude/
4
+ .codex/
5
+ AGENTS.md
6
+ .cursor/
7
+ .aider*
8
+ .github/copilot-instructions.md
9
+
10
+ # --- python ---
11
+ __pycache__/
12
+ *.py[cod]
13
+ *$py.class
14
+ *.so
15
+ .Python
16
+ build/
17
+ dist/
18
+ dist-from-sdist/
19
+ wheels/
20
+ *.egg-info/
21
+ *.egg
22
+ pip-wheel-metadata/
23
+ share/python-wheels/
24
+ MANIFEST
25
+
26
+ # --- virtual envs ---
27
+ .venv/
28
+ # per-version envs used to reproduce the CI matrix locally; `.venv/` does not
29
+ # match them, and hatchling then tries to pull one into the sdist and fails
30
+ .venv-*/
31
+ venv/
32
+ ENV/
33
+ env/
34
+ # throwaway envs the packaging smoke checks install into; an sdist build fails
35
+ # outright if a virtualenv is left sitting in the project root
36
+ .release-smoke/
37
+ .sdist-smoke/
38
+
39
+ # --- uv ---
40
+ # uv.lock IS committed; ignore cache only
41
+ .uv-cache/
42
+
43
+ # --- test/coverage ---
44
+ .pytest_cache/
45
+ .coverage
46
+ .coverage.*
47
+ coverage.xml
48
+ htmlcov/
49
+ .tox/
50
+ .nox/
51
+ .hypothesis/
52
+
53
+ # --- lint/format ---
54
+ .ruff_cache/
55
+ .mypy_cache/
56
+ .pytype/
57
+ .pyre/
58
+
59
+ # --- editors ---
60
+ .idea/
61
+ .vscode/
62
+ *.swp
63
+ *.swo
64
+ *~
65
+
66
+ # --- macOS ---
67
+ .DS_Store
68
+ .AppleDouble
69
+ .LSOverride
70
+
71
+ # --- project output (captures/PDFs are user data, not source) ---
72
+ output/
73
+ *.pdf
74
+ !docs/**/*.pdf
75
+
76
+ # --- logs ---
77
+ *.log
78
+ logs/
@@ -0,0 +1 @@
1
+ 3.11