Use ruff for Python code quality (redux)
Detailed Description
A less ambitious version of !2461 (closed). Just gets ruff set up as part of the pre-commit checks. Selects only the minimal set of rules from .flake8, and ignores most unused-import violations. Some dedicated person is free to expand this in future.
The current flake8 CI job doesn't actually fail when violations are found, it just puts them in the code quality report, which people are free to ignore. The pre-commit checks will at least fail when violations are found. If run locally, ruff will fix the violations it can do so safely, which makes it easier for developers to address violations rather than by hand.
(Also, restricts the SAST checks in lint.yml to only run for merge requests, which is the only place you can see the SAST reports anyway.)
API Changes
Please tick one of the following options:
- 
These changes do not modify the API. 
- 
These changes do modify the API, and are backwards compatible. 
- 
These changes do modify the API, and are backwards incompatible. 
For examples of changes that do not modify the API and/or are considered backwards (in)compatible, please see the contributing guide.
Justification for Backwards Incompatible Changes
n/a
Review Status
n/a