| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Major changes: - Convert BoundCommandFunc and UnboundCommandFunc TypeAliases in types.py to Protocol classes for stricter type checking - Added `_NamedCallable` Protocol class in annotated.py for stricter type checking of function references - Used `getattr` and/or `cast()` to help resolve some type errors in cmd2.py Minor changes: - Added type ignore for `ty:unresolved-attribute` to a number of places we were already ignoring `attr-defined` for mypy (problem of different name for same type of check)
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1737 +/- ##
==========================================
- Coverage 99.66% 99.64% -0.02%
==========================================
Files 23 23
Lines 5937 5960 +23
==========================================
+ Hits 5917 5939 +22
- Misses 20 21 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Sorry, something went wrong.
Changes include: 1. Removed _NamedCallable: Deleted the redundant protocol class definition of _NamedCallable from cmd2/annotated.py. 2. Imported type protocols: Imported BoundCommandFunc and UnboundCommandFunc from cmd2/types.py, and TypeAlias from typing. 3. Defined unified _CommandFunc alias: Formed a private, unified type alias _CommandFunc = BoundCommandFunc | UnboundCommandFunc[CmdOrSetT, [argparse.Namespace]]. 4. Updated function signatures: Replaced all annotations that previously used _NamedCallable in cmd2/annotated.py with _CommandFunc.
|
@KelvinChung2000 Could you please review the changes in annotated.py? There this is mostly replacing every Callable[..., Any] type hint with a type alias: _CommandFunc: TypeAlias = BoundCommandFunc | UnboundCommandFunc[CmdOrSetT, Any] so it is more in line with type hints elsewhere in the codebase. @kmvanbrunt Could you please review changes outside of annotated.py? For this there are two main changes:
|
Sorry, something went wrong.
…ommandFunc Protocol classes Also: - Switched some types in cmd2.py from `Callable[..., Any]` to `BoundCommandFunc` - Removed a number of `cast` calls in cmd2.py which were no longer needed
…unc and UnboundCommand func Also: - Restored the simple attribute definition for `__name__` attribute in BoundCommandFunc and UnboundCommandFund
…ntation Deleted _CommandFunc from annotated.py and replaced with BoundCommandFunc from types.py
…ction to make some types less restrictive
It turns out that ty is better at some things and mypy is better at others when it comes to type checking. So ty is at least not yet a purely superior replacement for mypy.
Most modern agent harness CLIs like codex, agy, opencode, hemes, pi, oh-my-pi, and tau all read AGENTS.md by default. It has emerged as the single file used by most agentic AI tools. Leaving GEMINI.md in place for now since Gemini CLI doesn't read AGENTS.md by default.
|
@KelvinChung2000 @kmvanbrunt Ok, I think this is ready for another review. I ended up adding mypy back to our type checking in addition to ty because each of them are stricter about checking some things than the other. |
Sorry, something went wrong.
Also: - Reword a couple TypeError messages which read awkwardly
| Back | FazBrowse Home | New Git URL |
Add mypy back in addition to ty for type checking.
Also fixes ty unresolved-attribute warnings and stop globally ignoring them within ty.toml.
Major changes:
Minor changes: