Skip to content

removing None's when it shouldn't be allowed - #1862

Merged
cmdupuis3 merged 5 commits into
mainfrom
dylannelson/none-reductions
Oct 30, 2026
Merged

cmdupuis3 merged 5 commits into
mainfrom
dylannelson/none-reductions

Conversation

@dylannelson

@dylannelson dylannelson commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Closes #1593

Overview

Removes several mentioned and other found instances of "None" being allowed as inputs when they shouldn't be, often resulting in errors that have not been accounted for.
Some we need to keep, as None is a valid input in some cases, like when plotting:

xlabel: str | None = "Longitude",
ylabel: str | None = "Latitude",

Optional[X] has also been removed in a few instances, as it is effectively the same as X | None and causes the same problems. Some were left untoutched as they have valid usage as they currently are (ie projection: Optional[ccrs.Projection] = None). it looks like these were intended to be removed in #1418 but some may have been missed.

Expected Usage

N/A

PR Checklist

General

  • An issue is created and linked
  • Added appropriate labels (if your uxarray repo permissions allow it)
  • Filled out Overview and Expected Usage (if applicable) sections

Testing & Benchmarking

  • [N/A] There is adequate test coverage of changes from this PR (add new tests if needed)
  • [N/A] If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

Documentation and Examples

  • [N/A] Docstrings updated with any function changes, and included in all new functions
  • [N/A] User (public) functions added to docs/api.rst; internal (private) function names start with an underscore (_)
  • [N/A] If touched any notebook files, cleared the output of all cells before committing
  • [N/A] If added new notebook files, put into appropriate directories and referenced in appropriate files

AI Disclosure

AI Usage:
Claude Code

  • I have tested and take responsibility for all AI-generated content in my PR.

@cmdupuis3 cmdupuis3 assigned cmdupuis3 and unassigned cmdupuis3 Oct 29, 2026
@cmdupuis3
cmdupuis3 self-requested a review October 30, 2026 14:13
@dylannelson
dylannelson marked this pull request as ready for review October 30, 2026 14:26

@Sevans711 Sevans711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked by-eye: all removed None hints seem correct to remove. Also did a variety of spot-checks for docstrings for any lingering messages in these cases about None being a possible input type, but didn't find any incorrect docstrings.

Also checked by-eye: all 76 remaining None hints (from searching the codebase for | None) and 5 remaining Optional hints (from searching the codebase for Optional[) look correct to keep.

Even though there isn't any CI test which tests for correctness of these changes (see also #1763), it isn't too risky to merge, because it only touches type hints.

Sidenote: this supersedes #1612, which should probably be closed with clarifying comment, after this merges.

Happy to approve this one as-is!

@cmdupuis3
cmdupuis3 merged commit d0b8e6e into main Oct 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type hints allows None for too many parameters

3 participants