Skip to content

Conversation

stefanv
Copy link
Contributor

@stefanv stefanv commented Dec 18, 2024

This is a proof-of-concept PR to address #29334

@dstansby
Copy link
Member

This looks good to me at a glance - is there still interest in merging this? It's currently marked as draft.

@stefanv stefanv marked this pull request as ready for review April 30, 2025 23:12
@stefanv
Copy link
Contributor Author

stefanv commented Apr 30, 2025

I'd still like to see this, or something like it, merged!

@stefanv stefanv force-pushed the add_subplots-axes3d branch from 3b60169 to 81f6ba3 Compare May 1, 2025 16:50
@@ -25,6 +25,9 @@ from matplotlib.lines import Line2D
from matplotlib.patches import Rectangle, Patch
from matplotlib.text import Text
from matplotlib.transforms import Affine2D, Bbox, BboxBase, Transform
if TYPE_CHECKING:
Copy link
Member

Choose a reason for hiding this comment

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

Actually, this guard is not needed in .pyi files, because they are only used for tyoechecking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, removed

@dstansby dstansby requested a review from timhoffm May 2, 2025 18:01
@timhoffm timhoffm merged commit abda9dd into matplotlib:main May 2, 2025
40 checks passed
@stefanv
Copy link
Contributor Author

stefanv commented May 2, 2025

Thank you!

@galah92
Copy link

galah92 commented Jun 14, 2025

Is there a timeline for this to be available in an official release?

GameRoMan added a commit to GameRoMan/matplotlib that referenced this pull request Jul 13, 2025
@ksunden ksunden mentioned this pull request Aug 7, 2025
5 tasks
ksunden pushed a commit to ksunden/matplotlib that referenced this pull request Aug 21, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants