Type annotation add_subplot for projection="3d"#29341
Merged
timhoffm merged 5 commits intomatplotlib:mainfrom May 2, 2025
Merged
Type annotation add_subplot for projection="3d"#29341timhoffm merged 5 commits intomatplotlib:mainfrom
timhoffm merged 5 commits intomatplotlib:mainfrom
Conversation
Member
|
This looks good to me at a glance - is there still interest in merging this? It's currently marked as draft. |
Contributor
Author
|
I'd still like to see this, or something like it, merged! |
timhoffm
approved these changes
May 1, 2025
QuLogic
reviewed
May 1, 2025
d623524 to
3b60169
Compare
3b60169 to
81f6ba3
Compare
timhoffm
reviewed
May 1, 2025
lib/matplotlib/figure.pyi
Outdated
| from matplotlib.patches import Rectangle, Patch | ||
| from matplotlib.text import Text | ||
| from matplotlib.transforms import Affine2D, Bbox, BboxBase, Transform | ||
| if TYPE_CHECKING: |
Member
There was a problem hiding this comment.
Actually, this guard is not needed in .pyi files, because they are only used for tyoechecking.
dstansby
approved these changes
May 2, 2025
timhoffm
approved these changes
May 2, 2025
Contributor
Author
|
Thank you! |
|
Is there a timeline for this to be available in an official release? |
13 tasks
btjanaka
added a commit
to icaros-usc/pyribs
that referenced
this pull request
Aug 22, 2025
…606) ## Description <!-- Provide a brief description of the PR's purpose here. --> Proof of concept for adding type annotations to pyribs. For type checking, I am currently using [ty](https://docs.astral.sh/ty/) -- it lines up well with Ruff in terms of being really fast. However, ty is not quite production ready, so support for it in pre-commit and other tools is not quite ready yet (e.g., ALE: dense-analysis/ale#4971). However, I found it mostly sufficient for my purposes. In the future, the goal will be to add type annotations everywhere else in pyribs. This regex is helpful for catching docstrings that have old types: ``` grep -r "^ *[a-z_]* (.*):" ribs ``` ## TODO <!-- Notable points that this PR has either accomplished or will accomplish. --> - [x] Add ty to dev deps - [x] Add ty to pre-commit -- see astral-sh/ty#269 - [x] Skip ty in pre-commit CI - [x] Add ty instructions to docs - [x] Add type annotations in ribs.visualize - [x] Matplotlib imports in ribs.visualize had to be made more specific; see notes on submodules here: astral-sh/ty#445 - [x] `plt.axes(projection="3d")` isn't typed for the correct `Axes3D` object, so I had to add some ignores; see matplotlib/matplotlib#29341 - [x] Add py.typed and include it in MANIFEST.in ## Status - [x] I have read the guidelines in [CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md) - [x] I have linted and formatted my code with `ruff` - [x] I have tested my code by running `pytest` - [x] I have added a description of my change to the changelog in `HISTORY.md` - [x] This PR is ready to go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a proof-of-concept PR to address #29334