-
-
Notifications
You must be signed in to change notification settings - Fork 171
fix(types): Better typing for .run #1037
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
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 improves type safety by refining type annotations for the .run() method and related functions, eliminating several instances of Any types. The PR also modernizes the ruff linting configuration by enabling all checks and explicitly disabling unwanted ones.
Key changes:
- Added type overloads for
session.run()to provide more precise return types based on thesilentparameter - Changed ruff configuration from selective check enabling to enabling all checks with explicit ignores
- Renamed shadowing variables (e.g.,
exittomock_exit,localstomy_locals) to avoid conflicts with built-in names - Updated
type: ignorecomments fromarg-typetocall-overloadto reflect the new overload signatures
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| nox/sessions.py | Added typing overloads for run(), run_install(), and run_always() methods with more precise return types; added # noqa: BLE001 for broad exception catches |
| nox/virtualenv.py | Added explicit -> None return type annotations to __init__ methods; added # noqa: BLE001 for broad exception handling |
| nox/manifest.py | Renamed locals variable to my_locals to avoid shadowing the built-in |
| nox/logger.py | Added explicit -> None return type annotation to __init__ method |
| nox/_cli.py | Improved type annotations by replacing Any with Namespace for function parameters |
| tests/test_sessions.py | Updated type: ignore comments from arg-type to call-overload to match new overload signatures |
| tests/test_main.py | Renamed exit mock variables to mock_exit to avoid shadowing the built-in |
| pyproject.toml | Restructured ruff configuration to enable all checks with explicit ignores instead of selective enabling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3ab2c89 to
3804cd5
Compare
Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
db8c9db to
b54009f
Compare
I was working on improving the ruff coverage, and found I could get rid of some Any, including the ones on the
.runmethods. I didn't finish working on Any, but stopped after I had an improvement.This enables ALL ruff checks, and just disables the ones we don't want (a few have TODO's).