summaryrefslogtreecommitdiff
path: root/run_mypy.py
AgeCommit message (Collapse)Author
2025-10-29coredata: finish typing annotationsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-29environment: move tool detection functions to a new modulePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-29cmdline: fix typing issuesPaolo Bonzini
Command line handling had almost complete annotations, but some were missing (especially argparse related types) or wrong (the native and cross files passed to the CmdLineFileParser). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-29Add snippets.symbol_visibility_header() methodXavier Claessens
Defining public API in a cross platform library is painful, especially on Windows. Since every library have to define pretty much the same macros, better do it in Meson.
2025-10-24modules/codegen: Add wrapper for lex/flex/reflexDylan Baker
This module is a bit of a dumping ground for code generators, particularly ones that are important and non-trivial to wrap, either due to multiple implementations, major command line changes, or complex outputs (such as those that may output a directory structure). The initially provided method is for lex. It provides a simple wrapper that handles win_flex, reflex, flex, and generic lex.
2025-10-20interpreter/dependencyfallbacks: use DependencyObjectKWsDylan Baker
This allows for a lot of type safety to be introduced, and almost all casting to be removed.
2025-10-04utils: merge per-platform utils into `platform.py`Dylan Baker
This allows us to simplify running mypy, as we can just mypy the entire utils module regardless of the platform we're using. As an added bonus, this means we open one less module.
2025-09-26modules/dlang: Fix typing issuesDylan Baker
The majority of this is just adding annotations to convince mypy that everything is okay. There is one place where there is a real change, which is validating that the keyword arguments (which are unbound) are of a valid type to be encoded as JSON.
2025-05-29mesonbuild/ast: make mypy safeVolker Weißmann
2025-05-29rewriter.py: make type safeVolker Weißmann
2025-04-18Make run_mypy.py work in mypy_primerhauntsaninja
See also https://github.com/hauntsaninja/mypy_primer/pull/77
2025-04-02modules/cmake: Make fully type safeDylan Baker
Mostly this was just adding a few asserts for options, and one bug fix from the option refactor
2025-03-01environment: make fully type safeDylan Baker
This as much as anything is to stop lying to envconfig about the potential types it will be given.
2025-02-05options: split UserIntegerOption and UserUmaskOptionDylan Baker
They are very similar, but they are not exactly the same. By splitting them we can get full type safety, and run mypy over the options.py file!
2024-09-06run_mypy: register utils/vsenv.py, as it is type-safeEli Schwartz
2024-09-06machinefile: Make fully typesafeDylan Baker
With the use of `typing_extensions.TypeAlias` we can get recursive types, which solves most of the issues we had with this file.
2024-07-16unittests: Add type annotations to the helpers moduleDylan Baker
2024-04-09modules: rename qt.py -> _qt.pyDylan Baker
Since it's an implementation detail, and shouldn't be exposed. This also helps give better error messages when a user writes `import('qt')`, since otherwise you get an error about `qt doesn't have an initialize method`, and now you get `qt module doesn't exist`.
2024-04-08meson format commandCharles Brunet
2024-02-12cuda module: fully type annotateEli Schwartz
Special notes: - _nvcc_arch_flags is always called with exact arguments, no need for default values - min_driver_version has its args annotation loosened because it has to fit the constraints of the module interface?
2024-01-08ast/introspection: make mypy cleanDylan Baker
2024-01-08ast: mark visitor and preprocessor as mypy safeDylan Baker
They already are warning free
2024-01-08ast/printer: fix mypy issuesDylan Baker
Other than one case that I think cannot be actually hit (or it would fail).
2023-12-11backends: correct nonebackend return annotation and check in run_mypyEli Schwartz
The only backend that can return values in generate() is ninja, so this was useless cruft.
2023-11-26run_mypy: avoid type-checking tools against every possible python versionEli Schwartz
2023-10-09Add simd.py to run_mypy.pyTristan Partin
2023-08-18run_mypy: add option to run once for each supported version of pythonEli Schwartz
This allows verifying that meson is type-safe under older versions of Python, which it currently is. Different versions of Python sometimes have different supported types for an API. Verify this in CI. (We flush output to ensure CI prints lines in the right order.)
2023-07-25mypy: add templates to checked modulesDylan Baker
2023-06-25fully type mconf.pyEli Schwartz
2023-06-25fully type mdist.pyEli Schwartz
2023-06-07cargo: Add a builder module to the cargo packageDylan Baker
This is a helper, currently only used by cargo. It could be moved later if there are other users.
2023-03-02run_mypy: accept the path to an alternative mypy executableEli Schwartz
mypy might be installed with a different python than the one run_mypy.py is using.
2023-03-02Revert "target python 3.10 as the mypy language version"Eli Schwartz
This reverts commit 0b7d935a846b8f2aa33b4e0d19fd7b4423d35df4. The issue is fixed in mypy 1.0.0 now.
2023-03-02run_mypy: passthrough unknown options to mypy itselfEli Schwartz
Useful for running as a thin wrapper in other contexts that expect the ability to run mypy itself with arbitrary arguments.
2023-01-16properly type utils/core.py and add it to mypyEli Schwartz
EnvironmentVariables was always broken, it used MutableMapping because everyone <3 abstract interfaces, especially when they are broken and don't actually do what you want. This needs a dict interface, exposing `.copy()`. We either use a dict or os._Environ, and the latter also supports that. Also fix a broken import, and the fallout from forgetting to update the signature of self.envvars in commit b926374205bd761085031755c87152d08bc10e9d.
2023-01-10modules: fully type the Qt* modulesDylan Baker
The base module is fully typed, but the numbered version are not, though it's pretty trivial to do so.
2023-01-10modules: add type annotations to the `__init__` moduleDylan Baker
2022-11-06target python 3.10 as the mypy language versionEli Schwartz
mypy has a bug when running on/for 3.11 which results in incorrect analysis of the codebase, specifically due to enum.Enum's self.name See: https://github.com/python/typeshed/issues/7564 https://github.com/python/mypy/issues/12483
2022-10-24run_mypy: add extra logging and permit specifying files to checkEli Schwartz
If those files are not yet known to be typed, skip them. This makes it possible to trivially check a shortlist of files that were just changed and see if they regress our mypy coverage. Ideal for use in a git pre-commit hook.
2022-09-28Move classes used by scripts to their own moduleXavier Claessens
Those classes are used by wrapper scripts and we should not have to import the rest of mesonlib, build.py, and all their dependencies for that. This renames mesonlib/ directory to utils/ and add a mesonlib.py module that imports everything from utils/ to not have to change `import mesonlib` everywhere. It allows to import utils.core without importing the rest of mesonlib.
2022-08-18run_mypy: Add modules/pkgconfig to the list of checked modulesDylan Baker
2022-08-17interpreter: move handling of module stability to interpreterDylan Baker
Thanks to `ModuleInfo`, all modules are just named `foo.py` instead of `unstable_foo.py`, which simplifies the import method a bit. This also allows for accurate FeatureNew/FeatureDeprecated use, as we know when the module was added and if/when it was stabilized.
2022-07-17modules/wayland: Add full type checkingDylan Baker
2022-05-23modules/icestorm: use type checkingDylan Baker
2022-05-23modules: add typing to the modtest moduleDylan Baker
2022-03-01use a more sane check instead of run_custom_lintEli Schwartz
Unfortunately, checking for strings without context is exceedingly prone to false positives, while missing anything that indirectly opens a file. Python 3.10 has a feature to warn about this though -- and it uses a runtime check which runs at the same time that the code fails to open files in the broken Windows locale. Set this up automatically when running the testsuite. Sadly, Python's builtin feature to change the warning level, e.g. by setting EncodingWarning to error at startup, is utterly broken if you want to limit it to only certain modules. This is tracked in order to be more efficiently ignored at https://bugs.python.org/issue34624 and https://github.com/python/cpython/pull/9358 It is also very trigger happy and passing stuff around via environment variable either messes with the testsuite, or with thirdparty programs which are implemented in python *such as lots of gnome*, or perhaps both. Instead, add runtime code to meson itself, to add a hidden "feature". In the application source code, running the 'warnings' module, you can actually get the expected behavior that $PYTHONWARNINGS doesn't have. So check for a magic testsuite variable every time meson starts up, and if it does, then go ahead and initialize a warnings filter that makes EncodingWarning fatal, but *only* when triggered via Meson and not arbitrary subprocess scripts.
2022-02-23run_mypy: add sourceset moduleDylan Baker
2022-01-18run_mypy: add gnome moduleDylan Baker
2022-01-10depfile: type annotateDylan Baker
2021-11-28Merge pull request #9623 from dcbaker/submit/keyval-typeingJussi Pakkanen
Add type annotations and typed_pos_args to the keyval module