NVIDIA-NeMo / NVIDIA-NeMo/Anonymizer

chore: resolve ty type checker diagnostics (41 errors)

Open
#53 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
122
Forks
17
Avg merge
4d 2h
Merged PRs (30d)
11

Description

Summary

After adding ty (v0.0.23) as a type checker, the codebase has 41 diagnostics that need to be resolved before typecheck can become a blocking CI check and pre-commit hook.

Currently, typecheck is advisory (non-blocking) in both the Makefile (- prefix) and pre-commit (|| true).

Diagnostic categories

Source code (~14 errors)
  • custom_columns.py (7 errors) -- Passing list[dict] from .as_dict() calls where list[EntitySchema] is expected. Pydantic accepts dicts at runtime, but ty's static analysis doesn't know that. Fix: pass model instances directly, or add # ty: ignore comments.
  • postprocess.py (5 errors) -- dict.get() overload resolution failures on dicts with inferred narrow key types after isinstance guards.
Test code (~20+ errors)
  • Tests passing raw dicts where Pydantic model instances are expected (same pattern as source)
  • AnonymizerConfig(detect={...}) -- passing dict instead of Detect model
  • test_debug_logging.py -- tmp_path fixture typed as TempPathFactory instead of Path
  • tempfile.mktemp deprecation warning
Excluded (already handled)
  • tools/ is excluded via [tool.ty.src] exclude = ["tools/"] since those scripts use PEP 723 inline deps not in the venv.

Definition of done

  • All 41 diagnostics resolved (fix or suppress with targeted # ty: ignore[rule-name])
  • Remove || true from typecheck pre-commit hook
  • Remove - prefix from Makefile typecheck target
  • Typecheck CI job made blocking (remove continue-on-error if set)

References

  • PR #51 introduced ty and the advisory typecheck infrastructure

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the advisory ty typecheck and group the 41 diagnostics across custom_columns.py, postprocess.py, the test files, Makefile, pre-commit hook, and CI configuration. Resolve or narrowly suppress each reported diagnostic, then make the checks blocking by removing the advisory wrappers and verify that typecheck passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, ci-cd, testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.