statement-fetch 0.5.0__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 (31) hide show
  1. statement_fetch-0.5.0/.github/workflows/ci.yml +38 -0
  2. statement_fetch-0.5.0/.github/workflows/pypi.yml +33 -0
  3. statement_fetch-0.5.0/.github/workflows/release.yml +73 -0
  4. statement_fetch-0.5.0/.gitignore +6 -0
  5. statement_fetch-0.5.0/CHANGELOG.md +50 -0
  6. statement_fetch-0.5.0/CONTRIBUTING.md +18 -0
  7. statement_fetch-0.5.0/LICENSE +21 -0
  8. statement_fetch-0.5.0/Makefile +8 -0
  9. statement_fetch-0.5.0/PKG-INFO +95 -0
  10. statement_fetch-0.5.0/README.md +74 -0
  11. statement_fetch-0.5.0/SECURITY.md +3 -0
  12. statement_fetch-0.5.0/pyproject.toml +53 -0
  13. statement_fetch-0.5.0/src/statement_fetch/__init__.py +126 -0
  14. statement_fetch-0.5.0/src/statement_fetch/_contracts.py +532 -0
  15. statement_fetch-0.5.0/src/statement_fetch/_playwright.py +518 -0
  16. statement_fetch-0.5.0/src/statement_fetch/_registry.py +132 -0
  17. statement_fetch-0.5.0/src/statement_fetch/_runner.py +538 -0
  18. statement_fetch-0.5.0/src/statement_fetch/_staging.py +409 -0
  19. statement_fetch-0.5.0/src/statement_fetch/_validators.py +242 -0
  20. statement_fetch-0.5.0/src/statement_fetch/api.py +133 -0
  21. statement_fetch-0.5.0/src/statement_fetch/cli.py +686 -0
  22. statement_fetch-0.5.0/src/statement_fetch/demo.py +111 -0
  23. statement_fetch-0.5.0/src/statement_fetch/providers/__init__.py +1 -0
  24. statement_fetch-0.5.0/src/statement_fetch/providers/example_bank.py +152 -0
  25. statement_fetch-0.5.0/src/statement_fetch/py.typed +0 -0
  26. statement_fetch-0.5.0/src/statement_fetch/sinks/__init__.py +1 -0
  27. statement_fetch-0.5.0/src/statement_fetch/sinks/directory.py +260 -0
  28. statement_fetch-0.5.0/tests/test_async_core_and_example.py +909 -0
  29. statement_fetch-0.5.0/tests/test_demo_e2e_playwright.py +305 -0
  30. statement_fetch-0.5.0/tests/test_public_hygiene.py +134 -0
  31. statement_fetch-0.5.0/uv.lock +113 -0
@@ -0,0 +1,38 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ workflow_dispatch:
7
+ workflow_call:
8
+ permissions:
9
+ contents: read
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ timeout-minutes: 10
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.11", "3.12", "3.13"]
18
+ steps:
19
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
20
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990
21
+ with:
22
+ version: "0.11.16"
23
+ python-version: ${{ matrix.python-version }}
24
+ - run: make check
25
+ - name: Install Playwright Chromium for demo E2E
26
+ if: matrix.python-version == '3.13'
27
+ run: uv run --extra playwright playwright install --with-deps chromium
28
+ - name: Run demo E2E test
29
+ if: matrix.python-version == '3.13'
30
+ run: uv run --extra playwright --with pytest pytest -q tests/test_demo_e2e_playwright.py
31
+ - if: matrix.python-version == '3.13'
32
+ run: uv build
33
+ - if: matrix.python-version == '3.13'
34
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
35
+ with:
36
+ name: python-distributions
37
+ path: dist/*
38
+ if-no-files-found: error
@@ -0,0 +1,33 @@
1
+ name: PyPI
2
+ on:
3
+ push:
4
+ tags: ['v*.*.*']
5
+ workflow_dispatch: {}
6
+ permissions: {}
7
+ concurrency:
8
+ group: pypi-${{ github.ref }}
9
+ cancel-in-progress: false
10
+ jobs:
11
+ ci:
12
+ if: github.ref_type == 'tag' && (github.event_name == 'workflow_dispatch' || vars.PYPI_PUBLISH == 'true')
13
+ uses: ./.github/workflows/ci.yml
14
+ permissions:
15
+ contents: read
16
+ publish:
17
+ needs: ci
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 10
20
+ environment: pypi
21
+ permissions:
22
+ contents: read
23
+ id-token: write
24
+ steps:
25
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
26
+ with:
27
+ name: python-distributions
28
+ path: dist
29
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990
30
+ with:
31
+ version: "0.11.16"
32
+ - name: Upload validated distributions
33
+ run: uv publish --trusted-publishing always --check-url https://pypi.org/simple/
@@ -0,0 +1,73 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags: ['v*.*.*']
5
+ workflow_dispatch: {}
6
+
7
+ permissions: {}
8
+
9
+ concurrency:
10
+ group: release-${{ github.ref }}
11
+ cancel-in-progress: false
12
+
13
+ jobs:
14
+ released:
15
+ runs-on: ubuntu-latest
16
+ timeout-minutes: 5
17
+ permissions:
18
+ contents: read
19
+ outputs:
20
+ done: ${{ steps.check.outputs.done }}
21
+ steps:
22
+ - id: check
23
+ env:
24
+ GH_TOKEN: ${{ github.token }}
25
+ TAG: ${{ github.ref_name }}
26
+ run: |
27
+ done=false
28
+ if [ "$GITHUB_REF_TYPE" = tag ] && gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
29
+ done=true
30
+ echo "$TAG is already released: nothing to do"
31
+ fi
32
+ echo "done=$done" >> "$GITHUB_OUTPUT"
33
+
34
+ ci:
35
+ needs: released
36
+ if: needs.released.outputs.done != 'true'
37
+ uses: ./.github/workflows/ci.yml
38
+ permissions:
39
+ contents: read
40
+
41
+ github-release:
42
+ needs: ci
43
+ if: github.event_name == 'push' && github.ref_type == 'tag'
44
+ runs-on: ubuntu-latest
45
+ timeout-minutes: 10
46
+ permissions:
47
+ contents: write
48
+ steps:
49
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
50
+ with:
51
+ persist-credentials: false
52
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990
53
+ with:
54
+ version: "0.11.16"
55
+ - name: Build
56
+ run: |
57
+ version="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
58
+ [ "${GITHUB_REF_NAME#v}" = "$version" ] || { echo "tag $GITHUB_REF_NAME is not version $version" >&2; exit 1; }
59
+ uv build
60
+ - env:
61
+ GH_TOKEN: ${{ github.token }}
62
+ TAG: ${{ github.ref_name }}
63
+ run: |
64
+ python3 - "$TAG" > /tmp/release-notes.md <<'PYTHON'
65
+ import pathlib, re, sys
66
+ version = sys.argv[1].removeprefix("v")
67
+ text = pathlib.Path("CHANGELOG.md").read_text()
68
+ match = re.search(r"^## \[" + re.escape(version) + r"\] - \d{4}-\d{2}-\d{2}\n(.*?)(?=^## |^\[[0-9]|\Z)", text, re.M | re.S)
69
+ if match is None:
70
+ raise SystemExit("missing release changelog")
71
+ print(match.group(1).strip())
72
+ PYTHON
73
+ gh release create "$TAG" dist/* --repo "$GITHUB_REPOSITORY" --verify-tag --title "$TAG" --notes-file /tmp/release-notes.md
@@ -0,0 +1,6 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .pytest_cache/
4
+ dist/
5
+ build/
6
+ *.egg-info/
@@ -0,0 +1,50 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.5.0] - 2026-12-05
6
+
7
+ ### Added
8
+ - Automated PyPI Trusted Publishing workflow (`pypi.yml`) for release tags.
9
+
10
+ ### Upgrade
11
+ - Action required: none.
12
+ - Rollback: compatible with `v0.4.1`.
13
+
14
+ ## [0.4.1] - 2026-12-05
15
+
16
+ ### Changed
17
+ - Finalized `API_VERSION = 1` public plugin surface (`statement_fetch.providers` and `statement_fetch.sinks`): removed host entry-point plugin surface from v1 (keeping `Host`/`Page`/`PlaywrightHost` for library callers and fakes), aligned `statement_fetch.__all__ == {"api", *api.__all__}`, removed internal helpers from `api.py`, and removed `AccountsRequest.with_ownership` and `PlaywrightHost(use_patchright=...)`.
18
+ - Bound `allowed_hosts` directly onto `Page` in `Host.open()` and removed caller-supplied `allowed_hosts` from `Page.fetch_bytes()`.
19
+ - `DirectorySink.deliver()` now pre-validates and SHA-256-verifies all planned artifacts before publishing any file (all-or-nothing integrity), writes immutable receipts atomically, and fails on invalid manifest entries or colliding non-files.
20
+
21
+ ### Added
22
+ - Shared `ManifestArtifact` and `iter_verified_manifest_artifacts()` manifest verification helper in `statement_fetch.api` (rejects absolute paths and symlinks before `.resolve()`).
23
+ - Declarative `Click.force` and `Click.nth` download trigger options.
24
+ - Human-mode sink delivery summary and per-file error output for `statement-fetch fetch --upload`.
25
+ - Strict `parse_provider_options()` unified across CLI and library runners, plus `ProviderSpec` and `resolve_provider_target` validation.
26
+
27
+ ### Fixed
28
+ - All-invalid fetch runs now return `status="error"` (exit `1`) instead of `"partial"` (exit `4`) and do not invoke sinks.
29
+ - `Stage.reuse_existing()` checks symlinks before `.resolve()`, deduplicates repeated calls, and unlinks invalid prior files so `--skip-existing` can recover cleanly; `Stage.add()` preserves file extensions on `.part` temp paths.
30
+ - `PlaywrightHost.close()` cancels guard tasks and guarantees `sf-pw-dl-*` cleanup via `try/finally` even on cancellation/timeout; `NativePage.download()` sanitizes `suggested_filename`; non-CDP 307/308 redirects track method across hops.
31
+ - `allowed_document` rejects empty userinfo and malformed IPv6 URLs without raising; CLI reports saved auto `stage_dir` on Ctrl-C and rejects `--sink-dir`/`--sink-opt` without `--upload` or `--skip-existing` without `--output-dir`.
32
+
33
+ ### Upgrade
34
+ - Action required: none.
35
+ - Rollback: compatible with `v0.3.0`.
36
+
37
+ ## [0.3.0] - 2026-12-04
38
+
39
+ ### Added
40
+ - `ProviderSpec.to_dict()` for JSON-serializable capability discovery (also surfaced in `statement-fetch providers --json`).
41
+ - Bounded `validate_zip()` validator (entry count cap, uncompressed size cap, and path-traversal rejection) exported via `statement_fetch.api`.
42
+ - Opt-in allowed-host `page.fetch_bytes(..., same_origin_only=False)` (fail-closed against the host's `allowed_hosts`, `mode: 'cors'`, `redirect: 'error'`, streaming `max_bytes` cap).
43
+
44
+ ## [0.2.0] - 2026-12-04
45
+
46
+ ### Added
47
+ - Unified async `statement_fetch.api` (`API_VERSION = 1`) plugin contract for `Provider` and `Sink` entry points (`statement_fetch.providers`, `statement_fetch.sinks`).
48
+ - Default local Playwright/Chromium browser host with a per-run `0700` download directory and combined context-route + Chromium CDP `Fetch` top-level host and multi-hop redirect confinement.
49
+ - Bundled zero-dependency loopback demo portal (`python -m statement_fetch.demo`) and `example-bank` provider + `dir` sink for offline end-to-end testing.
50
+ - Isolated `0600` atomic staging (`manifest.json`) with single-pass SHA-256 verification and immutable per-run `dir` sink receipts (`manifest-<run_id>--<provider>.json`).
@@ -0,0 +1,18 @@
1
+ # Contributing
2
+
3
+ ## How changes land
4
+
5
+ This repository is published as a clean MIT export. Pull requests are welcome as proposals and references, but changes are reviewed and landed in the maintainer's source tree before being published on the next release tag.
6
+
7
+ ## Running tests locally
8
+
9
+ ```bash
10
+ make check
11
+ ```
12
+
13
+ To run the real headless Playwright end-to-end test against the bundled loopback demo portal:
14
+
15
+ ```bash
16
+ uv run --extra playwright playwright install --with-deps chromium
17
+ uv run --extra playwright --with pytest pytest -q tests/test_demo_e2e_playwright.py
18
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 benjamin-di
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ .PHONY: check
2
+
3
+ TEST_ARGS ?=
4
+
5
+ check:
6
+ uv run --with "pytest>=8,<10" pytest -q $(TEST_ARGS)
7
+ uv run --with "mypy>=1.14,<2" mypy --ignore-missing-imports src/statement_fetch
8
+ uv run --with "ruff>=0.9,<1" ruff check src tests
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.5
2
+ Name: statement-fetch
3
+ Version: 0.5.0
4
+ Summary: Zero-LLM-in-Bank async financial statement fetcher, validator, and pluggable sink runner.
5
+ Project-URL: Homepage, https://github.com/benjamin-di/statement-fetch-oss
6
+ Project-URL: Repository, https://github.com/benjamin-di/statement-fetch-oss
7
+ Author: benjamin-di
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.11
18
+ Provides-Extra: playwright
19
+ Requires-Dist: playwright<2,>=1.52; extra == 'playwright'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # statement-fetch
23
+
24
+ Zero-LLM-in-Bank async financial statement fetcher, structural validator, and pluggable sink runner.
25
+
26
+ ## Security Model ("Zero-LLM-in-Bank")
27
+
28
+ 1. **Human sign-in:** A real Chromium browser opens the institution's login URL. The human completes authentication and 2FA; no credentials or LLM tokens touch the bank session.
29
+ 2. **Host confinement:** Top-level navigations, HTTP 3xx redirects (single/multi-hop and POST), `target="_blank"` popups, and in-page `fetch_bytes()` calls are confined to the provider's declared `allowed_hosts` via Chromium CDP `Fetch.enable` and context routing.
30
+ 3. **Deterministic fetch & atomic staging:** After `is_logged_in()` succeeds, deterministic provider code downloads statements into a per-run `0o700` staging directory, validates every artifact using its declared validator (defaulting to non-empty; built-in validators cover PDF, CSV, JSON, and bounded ZIP), writes `0o600` artifacts with SHA-256 digests, and produces a portable `manifest.json`.
31
+ 4. **Guaranteed logoff & pluggable sinks:** `logoff()` and browser teardown run in `finally:` even on error or Ctrl-C. Sinks (`statement_fetch.sinks`) verify every manifest entry and SHA-256 before delivering.
32
+
33
+ ## Installation
34
+
35
+ Requires Python 3.11+:
36
+
37
+ ```bash
38
+ pip install "statement-fetch[playwright]"
39
+ playwright install chromium
40
+ ```
41
+
42
+ ## Quickstart (Demo Portal, From a Clone)
43
+
44
+ Install Chromium into the project environment:
45
+
46
+ ```bash
47
+ uv run --extra playwright playwright install chromium
48
+ ```
49
+
50
+ In one terminal, start the bundled zero-dependency loopback demo bank:
51
+
52
+ ```bash
53
+ uv run python -m statement_fetch.demo --port 8765
54
+ ```
55
+
56
+ In another terminal, fetch statements and export them to a local directory with an immutable receipt manifest:
57
+
58
+ ```bash
59
+ uv run --extra playwright statement-fetch fetch example-bank \
60
+ --opt base_url=http://127.0.0.1:8765 \
61
+ --upload --sink dir --sink-dir ./exported
62
+ ```
63
+
64
+ Verify a staged or exported manifest offline:
65
+
66
+ ```bash
67
+ uv run statement-fetch upload ./exported/manifest-*.json --local-only --json
68
+ ```
69
+
70
+ ## Plugin API (`API_VERSION = 1`)
71
+
72
+ Third-party providers and sinks import from `statement_fetch.api` (or top-level `statement_fetch`) and register via Python entry points:
73
+
74
+ ```toml
75
+ [project.entry-points."statement_fetch.providers"]
76
+ my-bank = "my_pkg.provider:MyBankProvider"
77
+
78
+ [project.entry-points."statement_fetch.sinks"]
79
+ my-sink = "my_pkg.sink:MySink"
80
+ ```
81
+
82
+ - Reference provider: `src/statement_fetch/providers/example_bank.py`
83
+ - Reference sink: `src/statement_fetch/sinks/directory.py`
84
+ - Versioning: the entry-point group names (`statement_fetch.providers`, `statement_fetch.sinks`) define the `API_VERSION = 1` compatibility boundary.
85
+
86
+ ## CLI Exit Codes & Manifest Schema
87
+
88
+ - **Exit codes:** `0` (`EXIT_OK`, ok/empty), `1` (`EXIT_ERROR`), `2` (`EXIT_USAGE`), `3` (`EXIT_LOGIN_TIMEOUT`), `4` (`EXIT_PARTIAL`), `130` (interrupted / Ctrl-C).
89
+ - **`manifest.json` (`schema_version = 1`):** `schema_version`, `api_version`, `tool_version`, `created_at`, `provider`, `period_start`, `period_end`, `artifacts[]` (`artifact_id`, `name`, `path` relative to manifest dir, `sha256`, `bytes`, `provider`, `kind`, `period`, `valid`, optional `currency`/`error`/`observed_start`/`observed_end`/`meta`), `skipped[]`, `errors[]`, `timings_s`.
90
+
91
+ ## Development Checks
92
+
93
+ ```bash
94
+ make check
95
+ ```
@@ -0,0 +1,74 @@
1
+ # statement-fetch
2
+
3
+ Zero-LLM-in-Bank async financial statement fetcher, structural validator, and pluggable sink runner.
4
+
5
+ ## Security Model ("Zero-LLM-in-Bank")
6
+
7
+ 1. **Human sign-in:** A real Chromium browser opens the institution's login URL. The human completes authentication and 2FA; no credentials or LLM tokens touch the bank session.
8
+ 2. **Host confinement:** Top-level navigations, HTTP 3xx redirects (single/multi-hop and POST), `target="_blank"` popups, and in-page `fetch_bytes()` calls are confined to the provider's declared `allowed_hosts` via Chromium CDP `Fetch.enable` and context routing.
9
+ 3. **Deterministic fetch & atomic staging:** After `is_logged_in()` succeeds, deterministic provider code downloads statements into a per-run `0o700` staging directory, validates every artifact using its declared validator (defaulting to non-empty; built-in validators cover PDF, CSV, JSON, and bounded ZIP), writes `0o600` artifacts with SHA-256 digests, and produces a portable `manifest.json`.
10
+ 4. **Guaranteed logoff & pluggable sinks:** `logoff()` and browser teardown run in `finally:` even on error or Ctrl-C. Sinks (`statement_fetch.sinks`) verify every manifest entry and SHA-256 before delivering.
11
+
12
+ ## Installation
13
+
14
+ Requires Python 3.11+:
15
+
16
+ ```bash
17
+ pip install "statement-fetch[playwright]"
18
+ playwright install chromium
19
+ ```
20
+
21
+ ## Quickstart (Demo Portal, From a Clone)
22
+
23
+ Install Chromium into the project environment:
24
+
25
+ ```bash
26
+ uv run --extra playwright playwright install chromium
27
+ ```
28
+
29
+ In one terminal, start the bundled zero-dependency loopback demo bank:
30
+
31
+ ```bash
32
+ uv run python -m statement_fetch.demo --port 8765
33
+ ```
34
+
35
+ In another terminal, fetch statements and export them to a local directory with an immutable receipt manifest:
36
+
37
+ ```bash
38
+ uv run --extra playwright statement-fetch fetch example-bank \
39
+ --opt base_url=http://127.0.0.1:8765 \
40
+ --upload --sink dir --sink-dir ./exported
41
+ ```
42
+
43
+ Verify a staged or exported manifest offline:
44
+
45
+ ```bash
46
+ uv run statement-fetch upload ./exported/manifest-*.json --local-only --json
47
+ ```
48
+
49
+ ## Plugin API (`API_VERSION = 1`)
50
+
51
+ Third-party providers and sinks import from `statement_fetch.api` (or top-level `statement_fetch`) and register via Python entry points:
52
+
53
+ ```toml
54
+ [project.entry-points."statement_fetch.providers"]
55
+ my-bank = "my_pkg.provider:MyBankProvider"
56
+
57
+ [project.entry-points."statement_fetch.sinks"]
58
+ my-sink = "my_pkg.sink:MySink"
59
+ ```
60
+
61
+ - Reference provider: `src/statement_fetch/providers/example_bank.py`
62
+ - Reference sink: `src/statement_fetch/sinks/directory.py`
63
+ - Versioning: the entry-point group names (`statement_fetch.providers`, `statement_fetch.sinks`) define the `API_VERSION = 1` compatibility boundary.
64
+
65
+ ## CLI Exit Codes & Manifest Schema
66
+
67
+ - **Exit codes:** `0` (`EXIT_OK`, ok/empty), `1` (`EXIT_ERROR`), `2` (`EXIT_USAGE`), `3` (`EXIT_LOGIN_TIMEOUT`), `4` (`EXIT_PARTIAL`), `130` (interrupted / Ctrl-C).
68
+ - **`manifest.json` (`schema_version = 1`):** `schema_version`, `api_version`, `tool_version`, `created_at`, `provider`, `period_start`, `period_end`, `artifacts[]` (`artifact_id`, `name`, `path` relative to manifest dir, `sha256`, `bytes`, `provider`, `kind`, `period`, `valid`, optional `currency`/`error`/`observed_start`/`observed_end`/`meta`), `skipped[]`, `errors[]`, `timings_s`.
69
+
70
+ ## Development Checks
71
+
72
+ ```bash
73
+ make check
74
+ ```
@@ -0,0 +1,3 @@
1
+ # Security Policy
2
+
3
+ Please report security vulnerabilities privately using GitHub's private vulnerability reporting on this repository rather than opening a public issue.
@@ -0,0 +1,53 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "statement-fetch"
7
+ version = "0.5.0"
8
+ description = "Zero-LLM-in-Bank async financial statement fetcher, validator, and pluggable sink runner."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ authors = [{ name = "benjamin-di" }]
12
+ requires-python = ">=3.11"
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ ]
22
+ dependencies = []
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/benjamin-di/statement-fetch-oss"
26
+ Repository = "https://github.com/benjamin-di/statement-fetch-oss"
27
+
28
+ [project.optional-dependencies]
29
+ playwright = [
30
+ "playwright>=1.52,<2",
31
+ ]
32
+
33
+ [project.scripts]
34
+ statement-fetch = "statement_fetch.cli:main"
35
+
36
+ [project.entry-points."statement_fetch.providers"]
37
+ example-bank = "statement_fetch.providers.example_bank:ExampleBankProvider"
38
+
39
+ [project.entry-points."statement_fetch.sinks"]
40
+ dir = "statement_fetch.sinks.directory:DirectorySink"
41
+
42
+ [tool.hatch.build.targets.wheel]
43
+ packages = ["src/statement_fetch"]
44
+
45
+ [tool.pytest.ini_options]
46
+ testpaths = ["tests"]
47
+
48
+ [tool.ruff]
49
+ target-version = "py311"
50
+
51
+ [tool.ruff.lint]
52
+ select = ["E", "F", "B"]
53
+ ignore = ["E501"]
@@ -0,0 +1,126 @@
1
+ """statement-fetch: Zero-LLM-in-Bank async statement fetcher, validator, and pluggable sink runner."""
2
+ from __future__ import annotations
3
+
4
+ from . import api
5
+ from .api import (
6
+ API_VERSION,
7
+ EXIT_ERROR,
8
+ EXIT_LOGIN_TIMEOUT,
9
+ EXIT_OK,
10
+ EXIT_PARTIAL,
11
+ EXIT_USAGE,
12
+ MANIFEST_SCHEMA_VERSION,
13
+ PROVIDER_ENTRY_POINT_GROUP,
14
+ SINK_ENTRY_POINT_GROUP,
15
+ AccountInfo,
16
+ AccountsProvider,
17
+ AccountsRequest,
18
+ Artifact,
19
+ ArtifactSpec,
20
+ Click,
21
+ DownloadMismatchError,
22
+ DownloadTimeoutError,
23
+ DownloadTrigger,
24
+ DuplicatePluginError,
25
+ Evaluate,
26
+ FetchRequest,
27
+ FetchResult,
28
+ FrameLocator,
29
+ Host,
30
+ Keyboard,
31
+ Locator,
32
+ LoginTimeoutError,
33
+ ManifestArtifact,
34
+ OptionSpec,
35
+ Page,
36
+ PlaywrightHost,
37
+ PluginRegistry,
38
+ Provider,
39
+ ProviderSpec,
40
+ Sink,
41
+ SinkResult,
42
+ Stage,
43
+ TargetResolvingProvider,
44
+ ValidationResult,
45
+ ValidatorFn,
46
+ WindowClosedError,
47
+ iter_verified_manifest_artifacts,
48
+ load_manifest,
49
+ open_private_exclusive,
50
+ parse_provider_options,
51
+ publish_exclusive_file,
52
+ resolve_date_range,
53
+ resolve_provider_target,
54
+ run_async_accounts,
55
+ run_async_fetch,
56
+ sanitize_filename,
57
+ sha256_file,
58
+ validate_csv,
59
+ validate_fetch_request,
60
+ validate_json,
61
+ validate_pdf,
62
+ validate_zip,
63
+ verify_manifest_artifacts,
64
+ )
65
+
66
+ __all__ = [
67
+ "API_VERSION",
68
+ "EXIT_ERROR",
69
+ "EXIT_LOGIN_TIMEOUT",
70
+ "EXIT_OK",
71
+ "EXIT_PARTIAL",
72
+ "EXIT_USAGE",
73
+ "MANIFEST_SCHEMA_VERSION",
74
+ "PROVIDER_ENTRY_POINT_GROUP",
75
+ "SINK_ENTRY_POINT_GROUP",
76
+ "AccountInfo",
77
+ "AccountsProvider",
78
+ "AccountsRequest",
79
+ "Artifact",
80
+ "ArtifactSpec",
81
+ "Click",
82
+ "DownloadMismatchError",
83
+ "DownloadTimeoutError",
84
+ "DownloadTrigger",
85
+ "DuplicatePluginError",
86
+ "Evaluate",
87
+ "FetchRequest",
88
+ "FetchResult",
89
+ "FrameLocator",
90
+ "Host",
91
+ "Keyboard",
92
+ "Locator",
93
+ "LoginTimeoutError",
94
+ "ManifestArtifact",
95
+ "OptionSpec",
96
+ "Page",
97
+ "PlaywrightHost",
98
+ "PluginRegistry",
99
+ "Provider",
100
+ "ProviderSpec",
101
+ "Sink",
102
+ "SinkResult",
103
+ "Stage",
104
+ "TargetResolvingProvider",
105
+ "ValidationResult",
106
+ "ValidatorFn",
107
+ "WindowClosedError",
108
+ "api",
109
+ "iter_verified_manifest_artifacts",
110
+ "load_manifest",
111
+ "open_private_exclusive",
112
+ "parse_provider_options",
113
+ "publish_exclusive_file",
114
+ "resolve_date_range",
115
+ "resolve_provider_target",
116
+ "run_async_accounts",
117
+ "run_async_fetch",
118
+ "sanitize_filename",
119
+ "sha256_file",
120
+ "validate_csv",
121
+ "validate_fetch_request",
122
+ "validate_json",
123
+ "validate_pdf",
124
+ "validate_zip",
125
+ "verify_manifest_artifacts",
126
+ ]