Skip to content

Conversation

@Erotemic
Copy link
Owner

@Erotemic Erotemic commented Jan 8, 2026

Motivation

  • Improve static typing coverage across core utility modules to enable stricter mypy checking.
  • Make public and internal APIs explicitly typed while preserving existing runtime behavior.
  • Reduce reliance on untyped or loosely-typed signatures to surface clearer contracts for callers and maintainers.

Description

  • Annotated OrderedSet with generics (TypeVar), precise container types, overloads for __getitem__, and targeted cast usage to satisfy Sequence/MutableSet expectations.
  • Added explicit parameter and return type annotations to CLI helpers argval and argflag using Union/Optional types.
  • Typed color/highlight utilities in util_colors.py by annotating highlight_code, _pygments_highlight, _rich_highlight, and color_text and adding Any for flexible kwargs.
  • Tightened typing for the NoParam sentinel and schedule_deprecation in util_const.py and util_deprecate.py by adding return/type annotations, cast usage, and handling packaging.version.Version correctly.

Testing

  • Ran mypy ubelt/orderedset.py ubelt/util_arg.py ubelt/util_colors.py ubelt/util_const.py ubelt/util_deprecate.py and observed Success: no issues found.
  • Ran the full test suite with python run_tests.py and observed 580 passed, 28 skipped.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants