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.2.tar.gz (62.5 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.2-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: paperless_export-0.0.2.tar.gz
  • Upload date:
  • Size: 62.5 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.2.tar.gz
Algorithm Hash digest
SHA256 5722d3884e290b3a03285e5d2e2fd614a43c3aa2ba03c1af55d1d6b5f051d43a
MD5 13486937bde11c4ff15cec50a82cbb85
BLAKE2b-256 50e3535ea7687ff6df374fab3eb661ecbba4ff3c19dbb99e5d587280c162656f

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperless_export-0.0.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for paperless_export-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fb31fb713c84e8fd20d55ad9c2f59a6f1c7d515c314894f1f0c587818a1d22ad
MD5 37ddbbe894de612d237368b6c3b423b5
BLAKE2b-256 637a3548ac2735752a1597da2b4c5032dfe6fd2774e6ff675da20c18936964f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperless_export-0.0.2-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