Skip to content

refactor[cartesian]: more type hints#2088

Merged
romanc merged 6 commits into
GridTools:mainfrom
romanc:romanc/oir-stree-unrelated
Jun 23, 2025
Merged

refactor[cartesian]: more type hints#2088
romanc merged 6 commits into
GridTools:mainfrom
romanc:romanc/oir-stree-unrelated

Conversation

@romanc
Copy link
Copy Markdown
Contributor

@romanc romanc commented Jun 20, 2025

Description

In the latest gt4py/dace bridge refactor (on the cartesian side)1, we slipped in a bunch of type enhancements. This PR pull out what is independent of the bridge refactor. In particular this PR brings

  • generically typed base registry -> typed frontend and backend registries
  • typed BackendCodegen constructors
  • new-style type hints in touched files

Requirements

  • All fixes and/or new features come with corresponding tests.
    Covered by existing tests.
  • Important design decisions have been documented in the appropriate ADR inside the docs/development/ADRs/ folder.
    N/A

Footnotes

  1. see https://github.com/GridTools/gt4py/pull/2067 if you are interested

@romanc romanc force-pushed the romanc/oir-stree-unrelated branch from 7f9a1d3 to 7d90804 Compare June 20, 2025 12:57
Now that we know (in type land) that we either return a backend class or
raise, we don't need all these checks for None anymore.
Copy link
Copy Markdown
Contributor

@egparedes egparedes left a comment

Choose a reason for hiding this comment

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

LGTM. Just a suggestion to use type directly instead of typing alias Type which should not be needed anymore.

Comment thread src/gt4py/cartesian/backend/base.py Outdated
Comment thread src/gt4py/cartesian/backend/dace_backend.py Outdated
Use `tuple` as drop-in replacement for `typing.Tuple`. Use new-style
type hints in all touched files (also the "new" ones added after I
realized that we don't need to check anymore whether backend_cls is
None.
@romanc
Copy link
Copy Markdown
Contributor Author

romanc commented Jun 22, 2025

cscs-ci run

@romanc romanc merged commit 795977b into GridTools:main Jun 23, 2025
31 checks passed
@romanc romanc deleted the romanc/oir-stree-unrelated branch June 23, 2025 06:08
stubbiali pushed a commit to stubbiali/gt4py that referenced this pull request Aug 19, 2025
## Description

In the latest gt4py/dace bridge refactor (on the cartesian side)[^1], we
slipped in a bunch of type enhancements. This PR pull out what is
independent of the bridge refactor. In particular this PR brings

- generically typed base registry
- typed frontend and backend registries
- typed `BackendCodegen` constructors
- new-style type hints in touched files

## Requirements

- [x] All fixes and/or new features come with corresponding tests.
  Covered by existing tests.
- [ ] Important design decisions have been documented in the appropriate
ADR inside the [docs/development/ADRs/](docs/development/ADRs/README.md)
folder.
  N/A

[^1]: see GridTools#2067 if you are interested
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.

2 participants