-
Notifications
You must be signed in to change notification settings - Fork 59
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
Added handling of hashing of types with args and typing special forms #684
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #684 +/- ##
==========================================
+ Coverage 78.71% 82.99% +4.28%
==========================================
Files 22 22
Lines 4873 4894 +21
Branches 1401 0 -1401
==========================================
+ Hits 3836 4062 +226
- Misses 831 832 +1
+ Partials 206 0 -206
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here. |
1d6f69a
to
557f7f3
Compare
557f7f3
to
637f43c
Compare
ac32ba9
to
2abf6fe
Compare
@djarecka SLURM passed here. It might be worth digging into the runner setup info to see if some details of the machine this is run on differ between successes and crashes/timeouts. e.g., |
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
… for nested types
What happens if someone uses |
That's a good question. I strongly suspect it would break things. However, we should be able to detect them and evaluate the class strings to proper classes when we create interfaces. Happy to look into this if we end up refactoring the task/interface syntax |
Actually, looking at the code I think that |
Just checked with the following, and attrs doesn't help us from __future__ import annotations
import attrs
@attrs.define
class A:
x: int = 0
y: float = 1.0
print(repr(attrs.fields(A).x.type)) |
Okay. I think it's fair to call that a limitation but not agonize over it. It might cause some cache misses based on changes in Python version or the package that defines a task, but we should be consistent across runs of the same code on the same Python version. Under what circumstances are we actually hashing types? We're hashing values, so it seems like this should be moot for most cases. |
As I mentioned, I expect it to be pretty specific to my code, but in Arcana, the file-format class that input data files are stored in and output data files should be stored in is passed as an input to the "source" and "sink" nodes |
String annotations will break the type-checking though... |
Maybe we just treat strings as |
We could do that, or attempt to evaluate them, and if that fails fallback to Any. |
I reckon this is ready to merge now as the string annotations are probably best addressed in a separate PR |
Summary
Handles the case of hashing a class with type args, typing special forms (e.g. Union, ty.Type) and classes that inherit from ty.Generic
Checklist