-
Notifications
You must be signed in to change notification settings - Fork 62
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
_PickleCore._get_cache_by_key()
returns dict but is used as a dataclass
#246
Comments
@Borda, this seems related to the new types you defined. |
well it seems that our tests are passing: https://github.com/python-cachier/cachier/actions/runs/11455222345/job/31870885544?pr=248#step:5:92 so not sure how to reproduce it... 😖 |
_PickleCore._get_cache_by_key()
returns dict but is used as a dataclass
ok, seems I have another example here: https://github.com/Lightning-AI/torchmetrics/actions/runs/11454171728/job/31867880744?pr=2797
|
After some examination, from my understanding:
EDIT: While locally testing, I found out that |
hmm think that with the refactor to entry we sufficed some hidden issues 🐰 |
I also encountered something similar here: mercator-ocean/copernicus-marine-toolbox#183 |
It seems that this new version uses a dataclass instead of a dict for the
@Borda, I decided to check locally, and found out that during tests, The error So possibly this is just a product of incompatible caches between versions. |
@Leinadiumdo you have minimal example to reproduce which we can add to tests? |
right, this could be a transition issue as your past cache is |
The tests are all fine. The tests expect that
Other developers noticed the same problem here, and yes, caches are now incompatible between versions. |
I see so we shall consider adding some typing check like
going to fix it now, just thinking about how to test it :/ |
That might be a good idea! I opened the project in my local IDE, and some static and type checks starting popping (e. g. multiple "possible None being used" values). It is a good idea!
The pickle object is being returned without any checks. You may add some checks to see if the object is a |
that is fine and simple
I was rather thinking about running examples with several versions installed |
@Leinadium could you test it also on your side with the open PR:
|
Fixed in release |
This library is required by copernicusmarine, and recently one of my data pipelines raised an exception with the following message:
Unfortunaly I couldn't get the full exception, so I had to trace all references to the
._completed
attribute, and found this python module.While checking the code, I found that the
PickleCore
get_entry_by_key()
internally calls_get_cache_by_key()
, expecting a return type ofCacheEntry
. But the_get_cache_by_key()
method has a return type ofDict[str, CacheEntry]]
I would open a PR, but I couldn't understand what is the expected return type of
_get_cache_by_key()
.This bug seems to be triggered whenever
cachier()
is called with the pickle implementation and with theseparate_files
set as True.The text was updated successfully, but these errors were encountered: