Repository navigation
Ship type stubs and allow installing on Python 3.9 - #29
Merged
Merged
Conversation
avgvi
force-pushed
the
feat/types-and-python-3.9
branch
from
October 19, 2026 01:53
13ec27f to
b6dcafe
Compare
…, Any] from Index.fromcache in the stubs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two packaging changes that unblock libraries switching to the fork.
Type stubs. The package now ships
py.typedand.pyistubs, so mypy and pyright check code that usesdiskcache_communitywithout a separate stubs package. Libraries that type-check strictly against the diskcache-stubs package (pySigma, for example) fail with "missing library stubs or py.typed marker" on 5.8.0.SafeDiskandwith_types,Disk.with_optionsandon_error,configure,default_disk,ReadOnlyError,Cache(read_only=...)and theread_onlyproperty,store_timeonget,iterkeys(tag=...),disk=Nonedefaults, anddiskonDeque,Index,FanoutCache.dequeandFanoutCache.index.__delitem__andresetmove from the shared protocol toCache, andFanoutCachedeclares its own, matching the runtime.Cache._conandCache._sqlare declared, since subclasses such as dvc-data'sHashesCacherun SQL through them, andIndex.fromcachereturnsIndex[Any, Any]so callers need no annotation..pylintrcskips.pyifiles; blue and isort format them.Python 3.9.
requires-pythonis now>=3.9. The code already runs there: the full suite passes on CPython 3.9.25 (517 passed, 98.79 % coverage). Until now pip refused to install the fork on 3.9, which blocks projects that still support it, such as dvc-data.Checked:
python -m mypy.stubtest diskcache_communityreports no differences from the runtime, with Django installed (allowlisted: the stub-only_typesmodule, andDjangoCachein__init__, which exists only when Django is installed).diskcache_communityand diskcache-stubs removed; against 5.8.0 it fails with the missing-stubs error.Cachesubclass is fixed (atype[...]annotation,store_timeon itsgetoverride and onetype: ignore), and its 219 tests pass on Python 3.12 and 3.9.py.typedand all seven.pyifiles.