Add your description here
Project description
Print Dog
Print Dog watches a download directory and automatically sends finished PDF files to your printer. It is built with cross-platform support in mind: macOS and Linux use CUPS (lp/lpr), while Windows can rely on either the default shell printer verb or SumatraPDF for robust silent printing.
Highlights
- Watches a folder for new PDFs and prints them as soon as the download completes (with stability checks for
.crdownload,.part, etc.). - Optional filename prefix allow-list (
--allow-prefix) to restrict which documents are printed. - Flexible printing backends: system default, custom command (
--print-command), or SumatraPDF auto-discovery (--use-sumatra). - Download handling controls (
--download-timeout,--stable-checks,--poll-interval) tuned for slow or unstable networks. - Dry-run mode for testing (
--dry-run). - Packaged as an installable CLI (
print-dog) with helper scripts for Windows and macOS.
Requirements
- Python 3.12 or newer.
watchdog(installed automatically via the package).- A configured system printer:
- macOS / Linux: CUPS (
lporlpr). - Windows: Either a default PDF handler that supports the
printverb or SumatraPDF (recommended for silent printing).
- macOS / Linux: CUPS (
Installation
Via pip
pip install print-dog
For local development:
pip install -e .
Via uv
uv pip install print-dog
# or for development
uv pip install -e .
uv respects the UV_PYTHON environment variable if you want to pin the interpreter (e.g. export UV_PYTHON=3.14).
Quick Start
print-dog /path/to/watch --log-level INFO
- The folder argument is optional and defaults to
~/Downloads. - Output is logged to stdout; use
--log-level DEBUGfor verbose diagnostics. - Without extra flags the system default printer is used.
Common Options
--printer NAME– target a specific printer queue (macOS/Linux).--print-command "command {file}"– run a custom command;{file}is replaced with the PDF path. Environment variables and~are expanded.--use-sumatra– on Windows, auto-detectSumatraPDF.exe(searches%LOCALAPPDATA%,%PROGRAMFILES%,SUMATRAPDF_PATH, and the PATH). Combine with:--sumatra-path PATHto point to a specific executable.--sumatra-args "-print-to \"Printer\" -silent"to override default flags.
--allow-prefix PREFIX– require filenames to start with one or more prefixes (repeatable).--dry-run– log matched PDFs without printing.--download-timeout,--stable-checks,--poll-interval– tune how long Print Dog waits for downloads to stabilise before printing.
Windows Printing Tips
-
To avoid per-user path issues, let Print Dog discover SumatraPDF:
print-dog "C:\Users\%USERNAME%\Downloads" --use-sumatra
-
Set
SUMATRAPDF_PATHif SumatraPDF is installed in a non-standard location, or pass--sumatra-pathon the command line. -
When relying on
--print-command, wrap paths with quotes and include{file}. Example:print-dog --print-command "\"%LOCALAPPDATA%\SumatraPDF\SumatraPDF.exe\" -print-to-default -silent {file}"
macOS / Linux Printing Tips
- By default, Print Dog shells out to
lp/lpr. Ensure CUPS is running and the desired printer is set as default (lpoptions -d <printer>). - Use
--printerto choose a specific printer without changing the system default. - All CLI arguments accept
~expansion;--print-command "echo {file}"is handy for smoke-testing on macOS.
Helper Scripts
Located in the scripts directory:
scripts/run-print-dog-py.bat– Windows bootstrap usingpy -3.14to manage Python and Print Dog.scripts/run-print-dog.bat– Windows bootstrap whenpythonon PATH already points at Python 3.14.scripts/run-print-dog-uv.bat– Windows bootstrap powered entirely byuv(installs/upgrades and runs the watcher in an isolated environment).scripts/run-print-dog-macos.sh– macOS helper using the system Python; overridePYTHON_BIN,WATCH_DIR, orPRINT_ARGSas needed.scripts/run-print-dog-uv-macos.sh– macOS helper backed byuvfor isolated installs.scripts/build-macos-executable.sh– Builds a standalone macOS binary using PyInstaller (viauv); output lands indist/.scripts/release.sh– Maintainer script that bumps the version, builds distributions, runstwine check, uploads to PyPI, and tags the release. Run from a clean git tree withTWINE_USERNAME=__token__andTWINE_PASSWORD=<pypi-token>.
All scripts are meant to be copied to target machines, edited to taste (e.g. printer names, prefixes), and launched via shortcut/Automator/Task Scheduler.
Testing
Install the development extras once:
pip install -e .[dev]
# or with uv
uv pip install -e .[dev]
Then run the suite:
python -m pytest
Alternatively, without installing extras permanently:
uv run --with pytest --with pytest-mock pytest
The tests cover CLI argument parsing, download stabilisation, Sumatra detection, print command construction, and handler behaviours.
Building & Releasing
Manual build:
python -m build # or: uv run --with build python -m build
python -m twine upload dist/*
Automated release:
./scripts/release.sh 0.1.x
The release script updates pyproject.toml, builds artefacts, checks them with twine, uploads to PyPI, creates a Git tag, and pushes. Ensure uv is installed and the working tree is clean before running.
Troubleshooting
- Access denied on Windows – increase
--download-timeout/--stable-checksso the watcher waits longer for the browser to close the file handle. - No printers detected – use
--print-commandor--use-sumatrawith explicit paths. - Need to observe without printing – run with
--dry-runto verify detection logic. - Want verbose insight – use
--log-level DEBUGto see every event processed by the watcher.
Happy printing!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file print_dog-0.1.6.tar.gz.
File metadata
- Download URL: print_dog-0.1.6.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0rc3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b59875ef9fcdf014592cfeba91ef15e5b950c7d281d024e0a8a2db9dc325fd2b
|
|
| MD5 |
d904956625c0507ce64a016e9fdf7f95
|
|
| BLAKE2b-256 |
f0a10977ab76f95ab98ffe4827a0af6d0a47d9a76002a3f0d90970c61f911afc
|
File details
Details for the file print_dog-0.1.6-py3-none-any.whl.
File metadata
- Download URL: print_dog-0.1.6-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0rc3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9eaa2e1c226c49fe0787254b743d988fc76a017a03ae2d9babdbbabf2ca51ad2
|
|
| MD5 |
df44481449e8991e8138f52e1cccc76a
|
|
| BLAKE2b-256 |
ec548bb11feec79f90f69dc0dd3d03ba6042826802ec46eba591858b6a860989
|