fix(types): Better typing for .run#1037
Merged
henryiii merged 4 commits intowntrblm:mainfrom Jan 8, 2026
Merged
Conversation
henryiii
commented
Nov 17, 2025
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).