Skip to content

Conversation

@mwcraig
Copy link
Member

@mwcraig mwcraig commented Jul 8, 2025

No description provided.

@mwcraig mwcraig requested review from Copilot and eteq July 8, 2025 00:25

This comment was marked as outdated.

that are not defined in the protocol.
"""
# Run in a temperature directory since we are saving an image
os.chdir(tmp_path)
Copy link
Member

Choose a reason for hiding this comment

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

This might leave the test suite in a "dirty state" for subsequent tests. You need a fixture to change back to test dir. Something similar to this:

https://github.com/spacetelescope/ci_watson/blob/d42148349bca06663a996eba0ec6c27ed2795d3f/ci_watson/plugin.py#L71-L79

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah; it turns out I can save the file to a temporary directory without needing to cd, so I changed the PR to do that.

Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

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

Thanks!

I have comment on get but not sure if I left them at the correct place. Hope it is not too confusing.

}

def get_stretch(self, image_label: str | None = None) -> BaseStretch:
def get_stretch(
Copy link
Member

Choose a reason for hiding this comment

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

Do get stuff really need **kwargs? I thought we want flexibility to set things but get should be straightforward? Am I missing something?

Same comment on all the other get methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wondered the same thing....definitely get_catalog_names and get_image_labels will get turned into properties without an arguments once this is merged.

self,
sky_or_pixel: str | None = None,
image_label: str | None = None,
**kwargs, # noqa: ARG002
Copy link
Member

Choose a reason for hiding this comment

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

That said, maybe we do want **kwargs here since viewer in Jdaviz has reference name as such, that might not apply to other backends.

@mwcraig mwcraig requested a review from Copilot July 8, 2025 04:09
Copy link
Contributor

Copilot AI left a comment

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 updates the ImageViewer API to allow arbitrary keyword arguments on all methods and adds a test to verify that change.

  • Extended every protocol method to accept **kwargs and updated implementations accordingly
  • Added test in api_test.py to ensure all methods accept extra kwargs

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/astro_image_display_api/interface_definition.py Add **kwargs to all protocol method signatures and update docstrings
src/astro_image_display_api/image_viewer_logic.py Propagate **kwargs through concrete implementations with # noqa
src/astro_image_display_api/api_test.py New test test_all_methods_accept_additional_kwargs
Comments suppressed due to low confidence (3)

src/astro_image_display_api/interface_definition.py:189

  • The docstring entry for image_label is missing its type annotation (str | None, optional). Please update it to image_label : str | None, optional to match the method signature.
        image_label :

src/astro_image_display_api/interface_definition.py:43

  • In the NumPy-style docstring Parameters section, the added **kwargs entry should include a type annotation and colon (e.g., **kwargs : Any) to clearly document the accepted keyword arguments.
        **kwargs

src/astro_image_display_api/interface_definition.py:161

  • The docstring parameter name kwargs does not match the signature **kwargs and lacks a type. It should be updated to **kwargs : Any to remain consistent and clear.
        kwargs :

@mwcraig mwcraig merged commit 5bb8a8f into astropy:main Jul 8, 2025
7 checks passed
@mwcraig mwcraig deleted the kwargs-kwargs-everywhere branch July 8, 2025 17:17
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