chore(build): fix all mypy errors in setup.py#17963
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits intoMay 19, 2026
Merged
Conversation
Codeowners resolved as |
BenchmarksBenchmark execution time: 2026-05-18 20:33:12 Comparing candidate commit 0182cf8 in PR branch Found 0 performance improvements and 5 performance regressions! Performance is the same for 592 metrics, 10 unstable metrics. scenario:iastaspects-lstrip_aspect
scenario:iastaspects-translate_aspect
scenario:iastaspectsospath-ospathbasename_aspect
scenario:span-start
scenario:telemetryaddmetric-1-count-metric-1-times
|
Enable check_untyped_defs for setup.py in mypy.ini to catch errors inside untyped function bodies (fixes Kowalski unused-ignore feedback). - expected_checksums: dict[str, str] -> dict[str, dict[str, str]] - tarfile.open: pass streaming mode as keyword arg (mode=r|gz) - source_files: list[Path] annotation, newest_source_time: float (x2) - Add missing type: ignore[attr-defined] on cmake.CMAKE_BIN_DIR in build_libdd_wrapper - built: set[str] annotation in _get_common_cmake_args - Fix ext.name -> ext in DebugMetadata.write_report (keys are str)
main now enables strict mode globally. Relax annotation-only checks in [mypy-setup] (same treatment as [mypy-conf] for docs) while keeping check_untyped_defs=true to preserve the error coverage from the prior commit. Also fix real errors now surfaced: - Remove unreachable else branch in retry decorator (all except types handled) - Import CythonExtension directly from Cython.Distutils.extension to avoid no_implicit_reexport attr-defined errors; drop now-unused import Cython.Distutils
e6b1683 to
fd1eb8f
Compare
Add return-type and parameter annotations to all setuptools command overrides (the public API that distutils/setuptools calls into): - PatchedDistribution.__init__(attrs) - ExtensionHashes.run() - CustomBuildRust.initialize_options(), run() - LibraryDownload.run() (classmethod) - LibraryDownloader.run() - CleanLibraries.remove_*() staticmethods, run() - CustomBuildExt.run(), build_extensions(), build_extension(ext) - CMakeExtension.__init__(...) — also corrects dependencies: list[Path] (was undocumented; build_extension_cmake uses .parent/.glob on them) Private helper methods remain unannotated; [mypy-setup] still relaxes disallow_untyped_defs/calls for those.
KowalskiThomas
approved these changes
May 19, 2026
vlad-scherbich
added a commit
that referenced
this pull request
May 20, 2026
## Description Fix a few lint errors in setup.py. Discovered when working on #17959. ## Changes - Add proper type annotations to LibraryDownload class attributes (name, version, url_root, available_releases, translate_suffix), resolving var-annotated and assignment errors in subclasses. - Suppress cmake.CMAKE_BIN_DIR attr-defined errors (runtime-only attribute not declared in the cmake package stubs). - Suppress method-assign errors for intentional debug-instrumentation monkey-patching of CustomBuildExt methods. - Wrap src.suffix in bool() to fix return type mismatch in CMakeExtension.get_sources. ## Testing * commit passed pre-commit hooks * CI Co-authored-by: vlad.scherbich <vlad.scherbich@datadoghq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix a few lint errors in setup.py. Discovered when working on #17959.
Changes
Testing