aiidateam / plumpy

A python workflows library that supports writing Processes with a well defined set of inputs and outputs that can be strung together.
https://plumpy.readthedocs.io
Other
8 stars 17 forks source link

🔧 FIX auto_persist decorator typing #239

Closed chrisjsewell closed 2 years ago

chrisjsewell commented 2 years ago

This is used in aiida-core, to decorate the WorkChain class. The problem currently is that, because of the decorator typing, no methods defined on subclasses of Savable are available for static analysers (such as IDE auto-completions). This change ensures the output of the decorator is the same as the input.

codecov[bot] commented 2 years ago

Codecov Report

Base: 90.46% // Head: 90.46% // Increases project coverage by +0.01% :tada:

Coverage data is based on head (e4efc9e) compared to base (8c7640b). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #239 +/- ## ========================================== + Coverage 90.46% 90.46% +0.01% ========================================== Files 21 21 Lines 2953 2954 +1 ========================================== + Hits 2671 2672 +1 Misses 282 282 ``` | [Impacted Files](https://codecov.io/gh/aiidateam/plumpy/pull/239?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | Coverage Δ | | |---|---|---| | [src/plumpy/persistence.py](https://codecov.io/gh/aiidateam/plumpy/pull/239/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam#diff-c3JjL3BsdW1weS9wZXJzaXN0ZW5jZS5weQ==) | `93.93% <100.00%> (+0.02%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

chrisjsewell commented 2 years ago

and obviously I tested this fix works, in the context of VS Code:

image

(this does not work currently)

sphuber commented 2 years ago

and obviously I tested this fix works, in the context of VS Code:

How does this show that it is working? The to_context method is not decorated with auto_persist is it?

chrisjsewell commented 2 years ago

The to_context method is not decorated with auto_persist is it?

No, the whole WorkChain class is decorated with auto_persist

How does this show that it is working?

This is it without the change, all it knows is that wc is a Savable

image image