Skip to content

Conversation

@Czaki
Copy link
Contributor

@Czaki Czaki commented Oct 30, 2025

References and relevant issues

Description

We should not suggest using List when all supported Python versions support list[].

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 30, 2025
@brisvag brisvag added this to the 0.7.0 milestone Nov 10, 2025
Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

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

Agree. Thanks @Czaki


```python
def napari_get_reader(path: Union[str, List[str]]) -> Optional[ReaderFunction]
def napari_get_reader(path: Union[str, list[str]]) -> Optional[ReaderFunction]
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to change this? it's from the hook_spec, so that would be older napari and older python, right? So maybe we should leave them to match the original code?
I'm not sure anyone is still migrating anything, so it might be moot...

```python
def napari_get_writer(
path: str, layer_types: List[str]
path: str, layer_types: list[str]
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above, maybe we should leave this since it's from an era when List was the correct type hint.

def writer(
path: str, layer_data: List[Tuple[Any, Dict, str]]
) -> List[str]
path: str, layer_data: list[tuple[Any, dict, str]]
Copy link
Member

Choose a reason for hiding this comment

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

same as above.

@psobolewskiPhD
Copy link
Member

Not a blocker at all, but maybe we shouldn't change the hook_spec code? It's from a different era and was correct at the time. Someone migrating -- though I doubt anyone is doing that now? -- would encounter that code.

@willingc
Copy link
Contributor

@psobolewskiPhD If you are at all concerned, perhaps the best thing would be to add a note to the doc that this applies to Python 3.9 and later. If someone wants to use 3.8 or earlier, they would need the older typing format.

@psobolewskiPhD
Copy link
Member

psobolewskiPhD commented Nov 14, 2025

Eh.
I'm not concerned really, I don't think anyone is using this documentation anymore. I just find it odd to change something retroactively. I do wonder if it was an intentional change or search-n-replace 😜

@willingc willingc merged commit f3cbbd2 into napari:main Nov 15, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants