microsoft / pyright

Static Type Checker for Python
Other
13.12k stars 1.4k forks source link

Document different types of 'compiler' flags and ensure merging of flags is consistent #8704

Closed rchiodo closed 1 month ago

rchiodo commented 1 month ago

This is the first stage in enforcing that a pyrightconfig.json is the one source of truth.

I updated the configuration docs a bit (although I don't think my update is entirely necessary) to mention the fact that a pyrightconfig.json trumps settings.

I then reworked the logic in the config setup to make sure that:

There was some circular problems where the initialize from json was always assuming the command line had already set things but then went and applied new settings from the command line. Hopefully this is more linear. Config always first. Command line always after.

github-actions[bot] commented 1 month ago

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

rchiodo commented 1 month ago

Oh I also tested this with Pylance. Having a pyrightconfig.json behaves as you'd expect. It trumps everything in the settings.json.

Next steps after this:

github-actions[bot] commented 1 month ago

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

github-actions[bot] commented 1 month ago

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

rchiodo commented 1 month ago

I presume that you've done some basic manual tests with the CLI? We don't have much test coverage for CLI options, so please do a few basic smoke tests before committing.

I only did a couple, but I'll make sure to do some more. I was assuming the existing config tests were testing it a bunch, well because they didn't work on my first implementation :).

github-actions[bot] commented 1 month ago

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅