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

Clarify optionality of type annotations for writing a plugin #367

Merged
merged 13 commits into from
Mar 12, 2024

Conversation

vreuter
Copy link
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 removed their assignment Mar 5, 2024
@lucyleeow
Copy link
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
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
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
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!

docs/plugins/building_a_plugin/_layer_data_guide.md Outdated Show resolved Hide resolved
@vreuter
Copy link
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
Collaborator

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

Copy link
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!

docs/plugins/building_a_plugin/_layer_data_guide.md Outdated Show resolved Hide resolved
Copy link
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 <[email protected]>
@psobolewskiPhD psobolewskiPhD merged commit a840bc5 into napari:main Mar 12, 2024
6 checks passed
DragaDoncila added a commit to napari/npe2 that referenced this pull request Mar 22, 2024
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