ci(lint): type-check the ADF SDK and generated schema classes in lint jobs
Summary
Two CI lint jobs type-check code against packages that are not installed, so mypy (with ignore_missing_imports) sees that code as Any and real type errors pass. This PR closes both gaps.
python-lint/:metadata-ingestion:lint: the[dev]venv did not installazure-mgmt-datafactory, so the whole Azure Data Factory source and its unit tests were checked againstAny. 85 errors inadf_probe.pyandtests/unit/azure_data_factory/test_adf_source.pywere invisible. This adds theazure-data-factoryplugin to the plugin list inbase_dev_requirements, the same place every other type-checked plugin's SDK is installed.smoke-test-lint/:smoke-test:pythonLint: the task did not depend on:metadata-ingestion:codegen, sodatahub.metadata.schema_classesdid not exist in a fresh CI checkout and every generated aspect class wasAny. That hid an error insmoke-test/tests/e2e/knowledge/test_okf_reimport.py:127.pythonLintandpythonLintFixnow depend on codegen, likestackFreePytestalready does.
The errors themselves are fixed in #21880. This PR is stacked on #21880 so its CI stays green for review; once #21880 merges it retargets to master. On master alone, this change would turn both lint jobs red until #21880 lands.
Other plugins with the same gap
To find them, I ran mypy over metadata-ingestion with ignore_missing_imports = no in the [dev] venv and kept the imports that do not resolve. Then I installed each candidate's SDK and re-ran the normal lint to count the errors it uncovers on master:
| Plugin / SDK | Hidden errors today | Installed size | In this PR |
|---|---|---|---|
azure-data-factory (azure-mgmt-datafactory) | 85 | ~5 MB | yes |
debug-recording (vcrpy, pyzipper, responses) | 0 | <1 MB | yes (cheap) |
montecarlo (pycarlo) | 0 | ~15 MB | yes (cheap) |
db2 (ibm_db_sa) | 0 | ~120 MB (bundles the IBM CLI driver) | no |
onnx-embeddings (onnxruntime, tokenizers) | 0 | ~60 MB | no |
sso (playwright) | 0 | large (bundled driver) | no |
memray (debug requirement) | 0 | ~22 MB | no |
sqlmesh | n/a | n/a | no: listed in CIRCULAR_EXTRAS, cannot coexist in the lock |
debug-recording and montecarlo are clean today, but their sources import their SDKs in several places, so they are added to stop the next error from hiding. The heavy ones touch one import each and are left out.
Not fixable through extras (left as is): optional imports that no extra declares (pgvector, requests_kerberos, sqllineage, google.cloud.datacatalog_lineage, black), JPype's java.util in kafka_connect, and helper scripts or integration-test setup files (pyspark, pyflink, pydeequ, pydot).
CI time cost
python-lint: the extra packages add ~55 MB to a cold uv cache and well under 5 s to the install (oneuv pip installwith a warm cache finishes in under a second). mypy with no cache took 156ā165 s with the new SDKs and 156ā181 s without (two runs each), so the difference is within run-to-run noise. The uv cache key already hashessetup.py/uv.lock, so theci-cache-warmup.ymlentry picks the new packages up on the next push tomaster.smoke-test-lint: codegen now runs before lint. From a fresh worktree,./gradlew :metadata-ingestion:codegentook 18 s with the Gradle build cache and 36 s with--no-build-cache. That covers themxe-schemasbuild, a basemetadata-ingestionvenv and the codegen script. Expect roughly 30ā60 s more on a CI runner. The job already sets up Java and Gradle caching throughsetup-toolchain.
Failing before, passing after
All runs use the Gradle tasks CI runs, on this branch (with the [dev] venv rebuilt from scratch):
./gradlew :metadata-ingestion:lintwith this PR's dependencies:- with
master'sadf_probe.pyandtest_adf_source.py: fails, 85 errors (3 inadf_probe.py, 82 intest_adf_source.py) - with #21880's versions:
Success: no issues found in 3802 source files
- with
./gradlew :smoke-test:pythonLint(now runs codegen first):- with
master'stest_okf_reimport.py: fails,test_okf_reimport.py:127and:128,"DictWrapper" has no attribute "attribution" [attr-defined] - with #21880's version:
Success: no issues found in 373 source files - the same
masterfile with the generatedschema_classesremoved (what CI had before):Success, the gap this PR closes
- with
Checklist
- The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
- Links to related issues (if applicable): stacked on #21880
- Tests for the changes have been added/updated (if applicable): n/a, CI configuration
- Docs related to the changes have been added/updated (if applicable): n/a
- For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes: n/a
š¤ Opened with cclaude on behalf of @shirshanka