Conversation
zzzeek
left a comment
There was a problem hiding this comment.
oh. wow OK, I had forgotten that we hadn't turned on strict typing for dogpile.
can you do me a favor and let's turn on a little bit of strict - if i do this on the current main, it produces only 19 errors which are likely mostly handled here:
diff --git a/pyproject.toml b/pyproject.toml
index f8a77a2..7e0e293 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -58,6 +58,17 @@ valkey = [
[project.entry-points."mako.cache"]
"dogpile.cache" = "dogpile.cache.plugins.mako_cache:MakoPlugin"
+[tool.mypy]
+show_error_codes = true
+incremental = true
+
+strict = true
+
+disallow_untyped_defs = false
+disallow_untyped_calls = false
+ignore_missing_imports = true
+
+
[tool.setuptools]
zip-safe = false
include-package-data = trueThis requires we remove the old mypy.ini file.
The collections.abc changes here are surprising to me and I dont see mypy errors locally for those, can you provide background on those? I dont see what's wrong with the typing version of those collections.
Will do 👌
They're one of those things (like |
FTR that link is https://docs.python.org/3/library/typing.html#aliases-to-container-abcs-in-collections-abc wow that's going to mess with me |
sqla-tester
left a comment
There was a problem hiding this comment.
OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision c798805 of this pull request into gerrit so we can run tests and reviews and stuff
|
New Gerrit review created for change c798805: https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6182 |
|
CI failures were because I used the new union syntax instead of |
All of these things are unnecessary in Python 3.9 [1]. [1] https://docs.python.org/3/library/typing.html#aliases-to-container-abcs-in-collections-abc Signed-off-by: Stephen Finucane <stephen@that.guru>
sqla-tester
left a comment
There was a problem hiding this comment.
OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision 163b4e9 of this pull request into gerrit so we can run tests and reviews and stuff
|
Patchset 163b4e9 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6182 |
Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Stephen Finucane <stephen@that.guru>
This keeps both mypy and flake8 happy. Win win. Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Stephen Finucane <stephen@that.guru>
We move the configuration to pyproject.toml and enable strict mode (though we disable some settings since we're not fully typed yet). While here we also remove a redundant setting for black: black (and ruff) will automatically infer the target version from '[project.requires-python]' Signed-off-by: Stephen Finucane <stephen@that.guru>
sqla-tester
left a comment
There was a problem hiding this comment.
OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision aa04d4d of this pull request into gerrit so we can run tests and reviews and stuff
|
Patchset aa04d4d added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6182 |
|
i've got some other things moving in dogpile.cache where you'd need a rebase on this, but if this is ready I can just finalize in gerrit and merge |
|
I think this is ready. There's more that'll likely pop up since we're not
fully typed but I won't be back on this for another week or two.
|
|
ok great. |
|
Michael Bayer (zzzeek) wrote: recheck View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6182 |
|
@zzzeek I'm not sure if that error is related to this change? It doesn't appear to be, especially given I'm not making any functional changes. Another |
A Sequence requires the ability to index (__getitem__) and retrieve the length (__len__), amongst other options. An Iterable simply required the ability to iterate (__iter__). This allows us to pass, amongst other things, dict_keys, to the 'get_multi', 'get_serialized_multi', and 'delete_multi' methods, which seems like a rational thing to want and be able to do. Signed-off-by: Stephen Finucane <stephen@that.guru>
I tell a lie: another thing popped up yesterday. I've just pushed it (I want to be able to pass the value of |
This is helpful if the expiration_time callable relies on some global configuration, for example. Signed-off-by: Stephen Finucane <stephen@that.guru>
|
do you have access to push to the gerrit? since you're gerrit enabled. I already put a little changelog into it. the failures are because I'm messing with the CI and added a tox target, so I just rebased the gerrit to hopefully get those. |
| ] | ||
|
|
||
| ExpirationTimeCallable = Callable[[], float] | ||
| ExpirationTimeCallable = Callable[[], Optional[float]] |
There was a problem hiding this comment.
yup looks like the way it's used already expects None
There was a problem hiding this comment.
sure. these are all collections of keys that we only iterate. wonder why I put Sequence there.
| pickle.dumps | ||
| ) | ||
| deserializer: Union[None, Deserializer] = staticmethod( # type: ignore | ||
| ) # type: ignore |
There was a problem hiding this comment.
let me turn on warn_unused_ignores for these
|
Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/dogpile.cache/+/6182 has been merged. Congratulations! :) |
A collection of typing-related changes built while typing oslo.cache.