Skip to main content

Scheduled wrapper around Paperless-ngx's document_exporter plus a _Steuer/YYYY tax-view post-processor.

Project description

paperless-export

A thin scheduled wrapper around Paperless-ngx's built-in document_exporter, plus the one thing it doesn't do: a materialized _Steuer/YYYY/ tax view built from your Steuer-YYYY tags.

Paperless's exporter already produces the full no-lock-in export — every document laid out by your storage-path template, originals and PDF/A archive versions, and a complete manifest.json (tags, correspondents, types, custom fields). This tool deliberately does not rebuild any of that. It:

  1. runs document_exporter <target> --use-filename-format --compare-checksums --delete (each flag toggleable), surfacing failures honestly and falling back to a flat export with a clear warning when a path exceeds the OS limit,
  2. reads manifest.json and builds _Steuer/<YYYY>/ — one symlink (or copy) per document tagged Steuer-YYYY — plus a greppable _Steuer/INDEX.csv,
  3. optionally embeds tags/correspondent/type into the exported PDFs' XMP (--embed-tags, needs the [pdf] extra).
export/
  Bescheid/Finanzamt/2024-05-01 Steuerbescheid.pdf   # ← document_exporter
  manifest.json                                       # ← document_exporter
  _Steuer/
    2024/2024-05-01 Steuerbescheid.pdf → ../../Bescheid/Finanzamt/…
    INDEX.csv                                         # year,title,correspondent,created,original_path

Install

pipx install paperless-export          # + 'paperless-export[pdf]' for --embed-tags
# or
brew install fileworks/tap/paperless-export

(Not yet published — first release pending; until then: uv run paperless-export from a checkout.)

Usage

# the nightly job (run from the directory containing your compose file):
paperless-export run --export-dir /volume1/paperless/export

# rebuild only the tax view from an existing export:
paperless-export tax-view --export-dir /volume1/paperless/export

# FAT/exFAT or cloud targets that don't preserve symlinks:
paperless-export run --export-dir ./export --copy

Notes:

  • --exporter-target (default ../export) is the path as the exporter process sees it inside the container; --export-dir is the same directory on this host. With the standard compose setup they're the same bind mount.
  • PAPERLESS_URL + PAPERLESS_TOKEN (env or flags) enable a preflight check so a bad token fails fast with a clear message — they're optional because the exporter itself runs inside the container and needs no API access.
  • --embed-tags rewrites the exported PDFs, which changes their checksums, so those files are re-exported on the next --compare-checksums run. The manifest already preserves all metadata — only embed if you want tags inside the files.

Behavior guarantees

  • Read-only against Paperless — writes only into the export directory.
  • Idempotent — the _Steuer/ view is rebuilt from scratch each run; safe nightly.
  • Verifiable — after a run, _Steuer/2025/ contains exactly the documents tagged Steuer-2025; INDEX.csv matches a manifest query.
  • Honest failures — a non-zero document_exporter exit surfaces its stderr and exit code; symlink-unsupported filesystems auto-switch to copies with a notice.

Exit codes

Code Meaning
0 success
2 bad configuration / authentication failure
3 Paperless (or Docker) not reachable
4 export dir missing / manifest unreadable
n document_exporter failed with exit code n

Scheduling on a Synology (DSM Task Scheduler)

cd /volume1/docker/paperless && \
/usr/local/bin/paperless-export run --export-dir /volume1/paperless/export

Nightly, after the Paperless backup window; the export target should live on a share covered by your backup chain.

Development

uv sync --all-extras --dev
uv run ruff check . && uv run ruff format --check .   # lint
uv run mypy                                           # strict types
uv run pytest                                         # tests
uv build

Conventional Commits drive releases (python-semantic-release): merge to main → version bump + changelog + GitHub Release + PyPI publish (OIDC) + Homebrew formula bump.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paperless_export-0.0.3.tar.gz (63.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paperless_export-0.0.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file paperless_export-0.0.3.tar.gz.

File metadata

  • Download URL: paperless_export-0.0.3.tar.gz
  • Upload date:
  • Size: 63.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for paperless_export-0.0.3.tar.gz
Algorithm Hash digest
SHA256 6c81906d908ec2cbb248c4a0ce2795f9a64bcce8733b6231ab802106079523f9
MD5 e9e4b648b7f772f573f58aab833968e6
BLAKE2b-256 ca7d963c511f39e05696584f1dc540e56aa1977b2e449bf2c973cfc48590eed7

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperless_export-0.0.3.tar.gz:

Publisher: release.yml on fileworks/paperless-export

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paperless_export-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for paperless_export-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 52e807a9d4257386e56b62f3c8c7817cd09a7a8ff768d9d65680026ece5853a7
MD5 658d40610347044657d5ed42bb4eabdb
BLAKE2b-256 0b75a4661285bf8423c195cdffc34a88279bca1ef5645f0f01ebe799580c39d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperless_export-0.0.3-py3-none-any.whl:

Publisher: release.yml on fileworks/paperless-export

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page