qa-core-recon 0.1.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.
- qa_core_recon-0.1.0/.github/workflows/ci.yml +33 -0
- qa_core_recon-0.1.0/.github/workflows/publish.yml +29 -0
- qa_core_recon-0.1.0/.gitignore +26 -0
- qa_core_recon-0.1.0/CHANGELOG.md +51 -0
- qa_core_recon-0.1.0/LICENSE +21 -0
- qa_core_recon-0.1.0/PKG-INFO +539 -0
- qa_core_recon-0.1.0/README.md +509 -0
- qa_core_recon-0.1.0/RELEASING.md +71 -0
- qa_core_recon-0.1.0/docs/release-acceptance.md +109 -0
- qa_core_recon-0.1.0/examples/demo/data/changed-rows/source.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/data/changed-rows/target.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/data/extra-rows/source.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/data/extra-rows/target.csv +204 -0
- qa_core_recon-0.1.0/examples/demo/data/match/source.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/data/match/target.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/data/missing-rows/source.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/data/missing-rows/target.csv +161 -0
- qa_core_recon-0.1.0/examples/demo/data/sum-mismatch/source.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/data/sum-mismatch/target.csv +201 -0
- qa_core_recon-0.1.0/examples/demo/expected/changed-rows/report.json +341 -0
- qa_core_recon-0.1.0/examples/demo/expected/changed-rows/report.md +111 -0
- qa_core_recon-0.1.0/examples/demo/expected/extra-rows/report.json +251 -0
- qa_core_recon-0.1.0/examples/demo/expected/extra-rows/report.md +97 -0
- qa_core_recon-0.1.0/examples/demo/expected/iceberg/report.json +222 -0
- qa_core_recon-0.1.0/examples/demo/expected/iceberg/report.md +91 -0
- qa_core_recon-0.1.0/examples/demo/expected/match/report.json +222 -0
- qa_core_recon-0.1.0/examples/demo/expected/match/report.md +91 -0
- qa_core_recon-0.1.0/examples/demo/expected/missing-rows/report.json +283 -0
- qa_core_recon-0.1.0/examples/demo/expected/missing-rows/report.md +113 -0
- qa_core_recon-0.1.0/examples/demo/expected/s3/report.json +222 -0
- qa_core_recon-0.1.0/examples/demo/expected/s3/report.md +91 -0
- qa_core_recon-0.1.0/examples/demo/expected/sum-mismatch/report.json +470 -0
- qa_core_recon-0.1.0/examples/demo/expected/sum-mismatch/report.md +135 -0
- qa_core_recon-0.1.0/examples/demo/generate.py +168 -0
- qa_core_recon-0.1.0/examples/demo/specs/changed-rows.yaml +28 -0
- qa_core_recon-0.1.0/examples/demo/specs/extra-rows.yaml +28 -0
- qa_core_recon-0.1.0/examples/demo/specs/iceberg.yaml +31 -0
- qa_core_recon-0.1.0/examples/demo/specs/match.yaml +28 -0
- qa_core_recon-0.1.0/examples/demo/specs/missing-rows.yaml +28 -0
- qa_core_recon-0.1.0/examples/demo/specs/s3.yaml +29 -0
- qa_core_recon-0.1.0/examples/demo/specs/sum-mismatch.yaml +28 -0
- qa_core_recon-0.1.0/pyproject.toml +61 -0
- qa_core_recon-0.1.0/scripts/check_distributions.py +91 -0
- qa_core_recon-0.1.0/src/qa_core_recon/__init__.py +3 -0
- qa_core_recon-0.1.0/src/qa_core_recon/__main__.py +6 -0
- qa_core_recon-0.1.0/src/qa_core_recon/alignment.py +494 -0
- qa_core_recon-0.1.0/src/qa_core_recon/checks.py +869 -0
- qa_core_recon-0.1.0/src/qa_core_recon/cli.py +318 -0
- qa_core_recon-0.1.0/src/qa_core_recon/compare.py +239 -0
- qa_core_recon-0.1.0/src/qa_core_recon/decimals.py +153 -0
- qa_core_recon-0.1.0/src/qa_core_recon/exit_codes.py +9 -0
- qa_core_recon-0.1.0/src/qa_core_recon/hashing.py +187 -0
- qa_core_recon-0.1.0/src/qa_core_recon/readers.py +643 -0
- qa_core_recon-0.1.0/src/qa_core_recon/refusals.py +28 -0
- qa_core_recon-0.1.0/src/qa_core_recon/report.py +594 -0
- qa_core_recon-0.1.0/src/qa_core_recon/spark.py +484 -0
- qa_core_recon-0.1.0/src/qa_core_recon/spec.py +668 -0
- qa_core_recon-0.1.0/src/qa_core_recon/templates/recon.yaml +43 -0
- qa_core_recon-0.1.0/tests/__init__.py +1 -0
- qa_core_recon-0.1.0/tests/conftest.py +79 -0
- qa_core_recon-0.1.0/tests/support.py +60 -0
- qa_core_recon-0.1.0/tests/test_cli.py +541 -0
- qa_core_recon-0.1.0/tests/test_codes.py +36 -0
- qa_core_recon-0.1.0/tests/test_compare.py +142 -0
- qa_core_recon-0.1.0/tests/test_decimals.py +133 -0
- qa_core_recon-0.1.0/tests/test_demo.py +300 -0
- qa_core_recon-0.1.0/tests/test_hashing.py +127 -0
- qa_core_recon-0.1.0/tests/test_iceberg.py +603 -0
- qa_core_recon-0.1.0/tests/test_key_diff.py +1682 -0
- qa_core_recon-0.1.0/tests/test_readers.py +462 -0
- qa_core_recon-0.1.0/tests/test_run.py +1047 -0
- qa_core_recon-0.1.0/tests/test_s3.py +1025 -0
- qa_core_recon-0.1.0/tests/test_session.py +340 -0
- qa_core_recon-0.1.0/tests/test_spec.py +670 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v5
|
|
16
|
+
- uses: actions/setup-java@v5
|
|
17
|
+
with:
|
|
18
|
+
distribution: temurin
|
|
19
|
+
java-version: "17"
|
|
20
|
+
- uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.11"
|
|
23
|
+
- uses: actions/cache@v5
|
|
24
|
+
with:
|
|
25
|
+
path: ~/.cache/qa-core-recon/ivy
|
|
26
|
+
key: ivy-iceberg-1.7.1-hadoop-aws-3.3.4-aws-sdk-1.12.262-${{ runner.os }}
|
|
27
|
+
- run: pip install -e ".[dev]"
|
|
28
|
+
- run: ruff check .
|
|
29
|
+
- run: ruff format --check .
|
|
30
|
+
- run: pytest -q
|
|
31
|
+
- run: python -m build
|
|
32
|
+
- run: twine check dist/*
|
|
33
|
+
- run: python scripts/check_distributions.py
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
# A published GitHub release, or a v* tag push. A pull request or a branch
|
|
4
|
+
# push does not publish.
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
push:
|
|
9
|
+
tags:
|
|
10
|
+
- "v*"
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
publish:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
environment: pypi
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v5
|
|
22
|
+
- uses: actions/setup-python@v6
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.11"
|
|
25
|
+
- run: python -m pip install build
|
|
26
|
+
- run: python -m build
|
|
27
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
28
|
+
with:
|
|
29
|
+
skip-existing: true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.venv/
|
|
9
|
+
venv/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
.coverage
|
|
13
|
+
htmlcov/
|
|
14
|
+
|
|
15
|
+
# Local data and outputs
|
|
16
|
+
/data/raw/
|
|
17
|
+
/out/
|
|
18
|
+
|
|
19
|
+
# Spark and Iceberg local artefacts
|
|
20
|
+
spark-warehouse/
|
|
21
|
+
metastore_db/
|
|
22
|
+
derby.log
|
|
23
|
+
|
|
24
|
+
# Demo output and the Iceberg warehouse the demo test builds
|
|
25
|
+
examples/demo/out/
|
|
26
|
+
examples/demo/data/iceberg/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
First release.
|
|
6
|
+
|
|
7
|
+
### Command Line
|
|
8
|
+
|
|
9
|
+
- `qa-core-recon --version` prints `qa-core-recon 0.1.0` and exits 0.
|
|
10
|
+
- `--help` on the program and on `init`, `validate`, and `run` prints the exit codes and exits 0. A missing command prints help to stderr and exits 2.
|
|
11
|
+
- `init` writes a commented spec template. It exits 2 when the file exists, the path is a directory, the parent is missing, or the write is denied. `--force` overwrites an existing file only.
|
|
12
|
+
- `validate` checks that a spec loads. `validate --check-data` opens CSV, Parquet, and Iceberg on local disk and on S3 and runs the data-level refusals. It does not compare the datasets.
|
|
13
|
+
- `run` compares the datasets and writes `report.json` and `report.md`. Exit 0 is a match. Exit 1 is a mismatch. Exit 2 is a refusal or a read error. A refusal still writes the report. A read error does not.
|
|
14
|
+
|
|
15
|
+
### Checks And Reports
|
|
16
|
+
|
|
17
|
+
- Checks, in order: row count, amount sum, null keys, duplicate keys, key diff, and changed columns. A mismatch does not skip later checks.
|
|
18
|
+
- Row counts and amount sums are reported for the whole side and for each `group_by` value.
|
|
19
|
+
- A `group_by` column that is a string on one side and a typed column on the other (a raw CSV against a typed Parquet or Iceberg table) is parsed into the typed side's type before grouping, so a CSV `2024-01-01` and a Parquet date are one group. A string that does not parse stays its own group.
|
|
20
|
+
- Amounts are exact decimals at the spec scale. A YAML float or integer tolerance is rejected. Null amounts are left out of a sum. A blank amount cell is empty or holds only spaces and tabs. A cell that is only a line break or a Unicode space is `inexact-amount`.
|
|
21
|
+
- An optional `cast` of `half-even` or `half-up` applies only to a Parquet or Iceberg float or double amount.
|
|
22
|
+
- Tolerance is a quoted decimal. It applies to each total and each group sum on its own. It does not apply to the row hash or the key diff.
|
|
23
|
+
- A sum that does not fit `decimal(38, scale)` is a read error. No report is written.
|
|
24
|
+
- Null keys are counted and are a mismatch. They are excluded from the key diff.
|
|
25
|
+
- Duplicate keys are a mismatch. The report gives the count and up to 20 example keys. The key diff still compares one row per distinct key: the row with the smallest row hash.
|
|
26
|
+
- The key diff lists missing, extra, and changed keys. Changed columns name which compared fields differ. Each example list is capped at 20. The count is the full number.
|
|
27
|
+
- `report.json` is canonical: sorted keys, indent 2, UTF-8, and one trailing newline.
|
|
28
|
+
- `report.md` uses Title Case headings. Dataset text in the markdown report is escaped. Neither report file has a timestamp.
|
|
29
|
+
|
|
30
|
+
### Readers
|
|
31
|
+
|
|
32
|
+
- CSV, Parquet, and Iceberg, on local disk and on `s3://` (read as `s3a://`).
|
|
33
|
+
- Iceberg uses a Hadoop catalog. `table` is `namespace.table`. Metadata table names and the changelog name are rejected. `snapshot_id` selects one snapshot.
|
|
34
|
+
- S3 credentials come from the AWS chain. The spec has no key or secret. The tool does not copy credentials into the Spark configuration.
|
|
35
|
+
- Paths are checked against the allowlist before a file is opened. The check uses the path text and does not resolve symlinks.
|
|
36
|
+
|
|
37
|
+
### Spec And Refusals
|
|
38
|
+
|
|
39
|
+
- Spec version 1. Formats are `csv`, `parquet`, and `iceberg`.
|
|
40
|
+
- Refusal codes are `missing-key`, `float-amount`, `inexact-amount`, `tolerance-without-reason`, `unmapped-column`, `path-not-allowed`, and `sample-only`.
|
|
41
|
+
- `sampled: true` is `sample-only` and does not start Spark.
|
|
42
|
+
|
|
43
|
+
### Demo
|
|
44
|
+
|
|
45
|
+
- `examples/demo` is a made-up payments dataset with a fixed seed. Specs cover match, missing rows, extra rows, changed rows, a sum mismatch, Iceberg, and S3 (moto). Expected reports are committed. Tests compare those bytes.
|
|
46
|
+
- The difference cases list `txn_id` values from the key diff. Lists longer than 20 show the first 20 and the full count.
|
|
47
|
+
|
|
48
|
+
### Release
|
|
49
|
+
|
|
50
|
+
- `docs/release-acceptance.md` records what 0.1.0 ships and what is deferred.
|
|
51
|
+
- `RELEASING.md` is the owner checklist for the PyPI Trusted Publisher and the `v0.1.0` tag. This repository does not publish from a pull request.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SprintSynergy
|
|
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.
|