-
Notifications
You must be signed in to change notification settings - Fork 3
add UV, pre-commit, ruff, pyright #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the Python development environment by replacing the legacy tox/flake8 toolchain with UV, Ruff, and Pyright. The changes migrate from PowerShell scripts to batch scripts for Windows compatibility, introduce modern CI configuration with pre-commit hooks, and eliminate legacy virtual environment management in favor of UV's integrated dependency handling.
- Replaces tox/flake8 with UV package management and Ruff linting/formatting
- Migrates PowerShell scripts to batch scripts for improved Windows compatibility
- Modernizes CI workflows with latest GitHub Actions and streamlined tooling
Reviewed Changes
Copilot reviewed 31 out of 34 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
pyproject.toml | Comprehensive project configuration with UV, Ruff, and Pyright settings |
ensureuv.ps1 | Robust UV installation script with WinGet and official script fallback |
*.bat files | Batch script replacements for PowerShell scripts using UV commands |
.pre-commit-config.yml | Pre-commit hooks for automated linting, formatting, and type checking |
.github/workflows/testCode.yaml | Updated CI workflow using UV and batch scripts |
_validate/*.py | Type annotation updates and import refactoring for modern Python |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if "%1" NEQ "" set ruffFormatArgs=--diff > %1/lint-diff.diff | ||
call uv run --group lint --directory "%here%" ruff check --fix %ruffCheckArgs% | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% | ||
call uv run --group lint --directory "%here%" ruff format %ruffFormatArgs% | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 11 has incorrect syntax. The redirection operator >
should not be part of the variable assignment. It should be: if \"%1\" NEQ \"\" set ruffFormatArgs=--diff
and the redirection should be applied when the command is executed.
if "%1" NEQ "" set ruffFormatArgs=--diff > %1/lint-diff.diff | |
call uv run --group lint --directory "%here%" ruff check --fix %ruffCheckArgs% | |
if ERRORLEVEL 1 exit /b %ERRORLEVEL% | |
call uv run --group lint --directory "%here%" ruff format %ruffFormatArgs% | |
if ERRORLEVEL 1 exit /b %ERRORLEVEL% | |
if "%1" NEQ "" set ruffFormatArgs=--diff | |
call uv run --group lint --directory "%here%" ruff check --fix %ruffCheckArgs% | |
if ERRORLEVEL 1 exit /b %ERRORLEVEL% | |
if "%1" NEQ "" ( | |
call uv run --group lint --directory "%here%" ruff format %ruffFormatArgs% > %1/lint-diff.diff | |
) else ( | |
call uv run --group lint --directory "%here%" ruff format %ruffFormatArgs% | |
) |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is true, it needs to be fixed in NVDA too
@SaschaCowley - could you please review all meta dev env changes first (i.e. everything outside of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes outside of _test and _validate seem fine
Why have you replaced all the PowerShell scripts with batch scripts? |
To more closely match NVDA, so keeping our dev envs in sync is easier. |
Okay |
@SaschaCowley - okay this has been rebased, can you check the 3rd commit |
I've had to push 2 more commits because for some reason the folder being named |
This pull request introduces a major overhaul of the project's Python environment management, CI configuration, and developer tooling. The changes replace the legacy
tox
andflake8
setup with modern tools such asuv
,ruff
, andpyright
, streamline Windows batch/PowerShell scripts, and update CI workflows to use the latest GitHub Actions versions. The new configuration files (pyproject.toml
,.pre-commit-config.yml
,.python-version
) standardize dependencies and development practices, while redundant or outdated files are removed.Environment and Dependency Management:
pyproject.toml
to define dependencies, build system, linting, and testing tools, replacing legacy requirements and configuration files. Introduceduv
for dependency management and updated Python version requirements to 3.13..python-version
to specify the required Python interpreter for consistency across development environments.Continuous Integration and Pre-commit:
.pre-commit-config.yml
to configure automated linting, formatting, and type checking withruff
,pyright
, and other hooks. This replaces manual linting steps and integrates with pre-commit CI..github/workflows/testCode.yaml
to use the latest GitHub Actions versions, switch from PowerShell to batch scripts for test/lint/validation steps, and utilizeuv
for environment setup.Script Modernization:
*.ps1
) for linting, testing, and validation with batch scripts (*.bat
) that invoke Python tools viauv
, improving Windows compatibility and simplifying execution. [1] [2] [3] [4] [5] [6]ensureuv.ps1
script to ensure the correct version ofuv
is installed or updated, with user-friendly prompts for installation via WinGet or the official script.Cleanup and Removal:
tox.ini
, PowerShell scripts for old virtualenv management, and outdated lint/test scripts. [1] [2] [3] [4] [5] [6] [7]These changes modernize the project's development workflow, improve CI reliability, and ensure consistent environments for contributors.
References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]