Skip to content

Clarify optionality of type annotations for writing a plugin#367

Merged
psobolewskiPhD merged 13 commits intonapari:mainfrom
vreuter:vr/typing-issue365
Mar 12, 2024
Merged

Clarify optionality of type annotations for writing a plugin#367
psobolewskiPhD merged 13 commits intonapari:mainfrom
vreuter:vr/typing-issue365

Conversation

@vreuter
Copy link
Copy Markdown
Contributor

@vreuter vreuter commented Mar 5, 2024

This would close #365 by making more explicit the optionality of type annotations when writing a plugin, and adding a general note about their utility in the doc.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 5, 2024
@vreuter vreuter changed the title Clarify optionality of type annotations Clarify optionality of type annotations for writing a plugin Mar 5, 2024
@psobolewskiPhD psobolewskiPhD added the enhancement New feature or request label Mar 5, 2024
@psobolewskiPhD psobolewskiPhD added this to the 0.5.0 milestone Mar 5, 2024
@vreuter vreuter requested a review from psobolewskiPhD March 5, 2024 14:40
@vreuter vreuter removed their assignment Mar 5, 2024
@lucyleeow
Copy link
Copy Markdown
Collaborator

lucyleeow commented Mar 6, 2024

I would move this up to the 'The LayerData tuple' section even. Something like:

This type shows up often in plugins and is explained here to help plugin developers write
their functions. These annotations are optional except in the case of
[`magicgui` function widgets](magicgui) ...

The syntax at the end adds a link to the relevant widget section of the docs.

I've checked with Draga and there are no other places annotation is required for npe2, and I think it is not ever required for npe1 but I will confirm this! Edit - yeah I think never req for npe1.

@vreuter
Copy link
Copy Markdown
Contributor Author

vreuter commented Mar 7, 2024

The syntax at the end adds a link to the relevant widget section of the docs.

Thanks @lucyleeow , I'd wanted to add this but wasn't quickly sure of exactly the right link reference

@vreuter
Copy link
Copy Markdown
Contributor Author

vreuter commented Mar 7, 2024

@lucyleeow I took (as I understood it -- hopefully correctly) your suggestion about placement within the doc for this new text, and your idea to link to the magicgui section.

Copy link
Copy Markdown
Collaborator

@lucyleeow lucyleeow left a comment

Choose a reason for hiding this comment

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

Could you also add strings (or imports if you feel this is better) to the reader plugin code snippet too? Thank you!

@vreuter
Copy link
Copy Markdown
Contributor Author

vreuter commented Mar 7, 2024

Could you also add strings (or imports if you feel this is better) to the reader plugin code snippet too? Thank you!

Yeah not 100% sure I see the right edit, but I gave a shot here: napari/npe2#340

@vreuter vreuter requested a review from lucyleeow March 7, 2024 02:33
@lucyleeow
Copy link
Copy Markdown
Collaborator

Ah yes I forgot our docs are spread out across 3 repos and are complicated 🤦 . I'll take a look!

Copy link
Copy Markdown
Collaborator

@lucyleeow lucyleeow left a comment

Choose a reason for hiding this comment

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

Thank you!

vreuter and others added 2 commits March 7, 2024 14:37
Co-authored-by: Lucy Liu <jliu176@gmail.com>
Co-authored-by: Lucy Liu <jliu176@gmail.com>
@vreuter vreuter force-pushed the vr/typing-issue365 branch from c8c65df to bf3c391 Compare March 7, 2024 13:37
@vreuter vreuter force-pushed the vr/typing-issue365 branch from 27e7a90 to ae13166 Compare March 8, 2024 07:47
Co-authored-by: Lucy Liu <jliu176@gmail.com>
Copy link
Copy Markdown
Collaborator

@lucyleeow lucyleeow left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
@psobolewskiPhD psobolewskiPhD added the Full docs preview/ready to merge Adding this label will trigger a full docs build for previewing changes. Also @napari-bot make html label Mar 9, 2024
@psobolewskiPhD psobolewskiPhD merged commit a840bc5 into napari:main Mar 12, 2024
@psobolewskiPhD psobolewskiPhD removed the Full docs preview/ready to merge Adding this label will trigger a full docs build for previewing changes. Also @napari-bot make html label Mar 12, 2024
DragaDoncila added a commit to napari/npe2 that referenced this pull request Mar 22, 2024
)

napari/docs#367 (review)
napari/docs#365

---------

Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>
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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin development docs seemingly copy-paste-edit includes type aliases that must be defined (or imported?)

3 participants