v0.3.0 - Quality & Formats Release
Technical Review — PyIngestKit V0.3.0 Quality Gate & Documentation Stabilization
Overview
This technical review documents the corrections made to PyIngestKit V0.3.0 to restore 100% functionality across all quality gates (make quality, make security, make test, make build, make verify, make release-check) and CLI documentation.
Identified Issues & Resolutions
1. Security Gate Fix — Elimination of assert in Production Code (Bandit B101)
- Root Cause:
bandit -q -r src/pyingestkit examples/plugin_package/srcreported two low-severity/high-confidence security issues (B101:assert_used) insrc/pyingestkit/contracts/dataset.pyat lines 457 and 493:In Python,minimum = contract.min_length assert minimum is not None
assertstatements can be omitted at bytecode compilation when optimized (python -O), causing critical runtime contract validations to be silently bypassed. - Fix Applied: Replaced assertions with explicit
Nonechecks:minimum = contract.min_length if minimum is None: return True
maximum = contract.max_length if maximum is None: return True
- Outcome:
banditscan now reports 0 issues across 5,705 lines of scanned code.
2. Quality Gate Fix — Code Formatting & Mypy Type Narrowing
A. Code Formatting (ruff format)
- Root Cause:
ruff format --checkreported 5 unformatted files across the repository:examples/plugin_package/tests/test_quality_format_jobs.pysrc/pyingestkit/contracts/dataset.pysrc/pyingestkit/runtime/runner.pytests/integration/test_quality_reports_runtime.pytests/unit/contracts/test_dataset_contract_v2.py
- Fix Applied: Executed
ruff formatacrosssrc,tests, andexamples/plugin_package. All 168 source files are now compliant.
B. Mypy Strict Type Checking (mypy src/pyingestkit)
- Root Cause: Mypy reported an argument type error in
src/pyingestkit/contracts/dataset.py:305:Mypy could not narrow the type of the attributesrc/pyingestkit/contracts/dataset.py:305: error: Argument 1 to "_type_label" of "DatasetContract" has incompatible type "type[Any] | tuple[type[Any], ...] | None"; expected "type[Any] | tuple[type[Any], ...]"contract.expected_typewhen evaluated inside theif not type_matches:condition. - Fix Applied: Bound
contract.expected_typeto a local variableexpectedand performed an explicitif expected is not None:guard before calling_type_label(expected):type_matches = True expected = contract.expected_type if expected is not None: type_matches = isinstance(value, expected) if not type_matches: if not collector.add( ValidationIssue( "field.type", ( f"Field {contract.name!r} has type {type(value).__name__}; " f"expected {self._type_label(expected)}" ), ValidationSeverity.ERROR, field=contract.name, row_index=row_index, value_preview=_safe_preview(contract.name, value), constraint="expected_type", ) ): return
- Outcome:
mypy src/pyingestkitpasses with 0 errors across 91 source files.
3. Documentation & CLI Configuration Fix — README.md
- Root Cause: Running the CLI quality demo jobs as documented in
README.mdfailed with:The documentation in lines 132–134 erroneously specifiedError: Invalid value for '--config' / '-c': File 'examples/plugin_package/demo-excel.yml' does not exist.demo-excel.yml,demo-ndjson.yml, anddemo-parquet.ymlinstead of the actual config filedemo-quality.yml. - Fix Applied: Corrected
README.mdlines 132–134:pyingest run demo.excel_quality --config examples/plugin_package/demo-quality.yml pyingest run demo.ndjson_quality --config examples/plugin_package/demo-quality.yml pyingest run demo.parquet_quality --config examples/plugin_package/demo-quality.yml
- Outcome: All CLI commands in
README.mdexecute successfully out-of-the-box.
Verification Matrix
| Target Gate | Tool / Command | Status | Details |
|---|---|---|---|
| Functional Unit & Integration Tests | make test |
PASS | 152 passed in 1.70s |
| Lint & Formatting Check | ruff check && ruff format --check |
PASS | 168 files compliant |
| Static Type Analysis | mypy src/pyingestkit |
PASS | 91 files checked, 0 errors |
| Security Static Analysis | bandit -q -r src ... |
PASS | 0 issues detected |
| Vulnerability Audit | pip-audit |
PASS | 0 vulnerabilities found |
| Package Build | make build |
PASS | SDist & Wheel generated |
| Full Source Gate | make verify |
PASS | End-to-end clean run |
| Release Wheel Smoke Test | make release-check |
PASS | Fresh virtualenv run over all 6 reference jobs |
Summary of Reference Jobs Status
All six reference slices are 100% operational:
demo.local_file: Ingests local files into immutable RAW storage.demo.http_csv: HTTP source -> Retry policy -> RAW provenance -> CSV parser -> Dataset validation.demo.http_json: HTTP source -> Retry policy -> RAW provenance -> JSON parser -> Dataset validation.demo.ndjson_quality: NDJSON parser -> Dataset -> Contract V2 -> Profile -> Quality reports.demo.excel_quality: OpenPyXL parser -> Dataset -> Contract V2 -> Profile -> Quality reports.demo.parquet_quality: PyArrow parser -> Dataset -> Contract V2 -> Profile -> Quality reports.