Skip to content

Improve types in assignment_collection - #275

Merged
inducer merged 9 commits into
inducer:mainfrom
alexfikl:type-sac
Apr 9, 2026
Merged

inducer merged 9 commits into
inducer:mainfrom
alexfikl:type-sac

Conversation

@alexfikl

@alexfikl alexfikl commented Apr 9, 2026 •

Copy link
Copy Markdown
Collaborator

This essentially adds types to SymbolicAssignmentCollection and fixes some things around it as well.

It also adds some basic types to sumpy.cse, mainly to functions that are called from the outside. Not very sure about these, since I don't understand the algorithms / data structures used in there, but pyright seems to not complain too much..

Copilot AI left a comment

Copy link
Copy Markdown

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 focuses on tightening type annotations around SymbolicAssignmentCollection and exposing more explicit types in sumpy.cse, along with a few small type-related touchups across the codebase and an updated basedpyright baseline.

Changes:

  • Add/adjust type annotations for SymbolicAssignmentCollection and related helper classes.
  • Add type annotations to sumpy.cse public functions and internal helpers.
  • Update a few signatures/overrides in supporting modules and refresh the basedpyright baseline.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sumpy/version.py Fix _parse_version to use its version parameter.
sumpy/tools.py Type-annotate OrderedSet and add override usage.
sumpy/cse.py Add type annotations and refactor imports/types around CSE.
sumpy/codegen.py Widen assignment expression type from sym.Expr to sym.Basic.
sumpy/assignment_collection.py Add types/docs to SymbolicAssignmentCollection and its symbol generator.
sumpy/array_context.py Add type annotations for make_loopy_program and pytest factory overrides.
.basedpyright/baseline.json Update baseline to reflect new typing work.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sumpy/cse.py Outdated
Comment thread sumpy/cse.py Outdated
Comment thread sumpy/assignment_collection.py Outdated
Comment thread sumpy/tools.py
@alexfikl

alexfikl commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator Author

@inducer The remaining pyright failures here seem to be because inducer/pytools#350 is not released yet. Would you prefer I update the baseline without that or wait for a release?

@inducer

inducer commented Apr 9, 2026

Copy link
Copy Markdown
Owner

https://github.com/inducer/pytools/releases/tag/v2026.1

@inducer
inducer force-pushed the type-sac branch 2 times, most recently from 62e39c9 to 99c620f Compare April 9, 2026 16:09
@inducer
inducer merged commit 69eacc9 into inducer:main Apr 9, 2026
9 checks passed
@alexfikl
alexfikl deleted the type-sac branch April 9, 2026 18:56
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.

3 participants