Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove _SupportsGetMesh from docs #7812

Closed
wants to merge 1 commit into from

Conversation

radarhere
Copy link
Member

After #7786, the docs have started failing in main - https://github.com/python-pillow/Pillow/actions/runs/7951921486/job/21705919173#step:8:254

/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/PIL/ImageOps.py:docstring of PIL.ImageOps.deform:1: WARNING: py:class reference target not found: PIL.ImageOps._SupportsGetMesh

This fixes it by adding _SupportsGetMesh to the docs.

@hugovk
Copy link
Member

hugovk commented Feb 19, 2024

I don't think _SupportsGetMesh is something users need to know about, and we don't want them to use it.

Can we exclude it from the docs instead?

@radarhere
Copy link
Member Author

Well, I suppose the simplest way to remove it from the docs is to just stop using autofunction.

I've updated the commit.

@radarhere radarhere changed the title Added _SupportsGetMesh to docs Remove _SupportsGetMesh from docs Feb 19, 2024
@hugovk
Copy link
Member

hugovk commented Feb 19, 2024

To avoid duplication, does :exclude-members: (https://stackoverflow.com/a/45531084/724176) or :meta private: or another answer from there help?

@radarhere
Copy link
Member Author

How about this?

autodoc_type_aliases = {
    "_SupportsGetMesh": "object",
}

Changes _SupportsGetMesh to object in the docs - https://pillow--7812.org.readthedocs.build/en/7812/reference/ImageOps.html#PIL.ImageOps.deform

@hugovk
Copy link
Member

hugovk commented Feb 19, 2024

Thanks, that could work.

But now I think about it some more, I'm going to completely contradict what I said earlier :)

I don't think _SupportsGetMesh is something users need to know about, and we don't want them to use it.

If we're using _SupportsGetMesh as a type hint, this probably is something users might want to use, so should be accessible as a non-underscore thing?

@AlexWaygood: What do you think?

@radarhere
Copy link
Member Author

For Alex's reference, this is what we're talking about.

Pillow/src/PIL/ImageOps.py

Lines 414 to 424 in e1c5d57

class _SupportsGetMesh(Protocol):
def getmesh(
self, image: Image.Image
) -> list[
tuple[tuple[int, int, int, int], tuple[int, int, int, int, int, int, int, int]]
]: ...
def deform(
image: Image.Image,
deformer: _SupportsGetMesh,

@radarhere
Copy link
Member Author

If we're using _SupportsGetMesh as a type hint, this probably is something users might want to use, so should be accessible as a non-underscore thing?

This suggestion may not fly because _SupportsGetMesh is specific to ImageOps, but, throwing an idea out there - we could move it to _typing.py?

@radarhere
Copy link
Member Author

#7841 was merged instead.

@radarhere radarhere closed this Feb 29, 2024
@radarhere radarhere deleted the imageops branch February 29, 2024 11:52
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.

2 participants