-
Notifications
You must be signed in to change notification settings - Fork 15
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
Types #93
Types #93
Conversation
Woops, I wanted to do a PR on my own repo, but mixed it up and did the PR here, sorry for that. It is not ready for merging, but I guess as it is here now, feel free to comment. (WIP for #84) |
Sure. As I mentioned in the issue, I'd really like to see the types within the code and not in separate files. Also please you |
I'll also squash the commits, it is a mess for no good reason right now. |
Now a note that is possibly a bit of a problem: That's the reason the tests are failing there : https://github.com/Rafiot/valkey-py/actions/runs/10808666835/job/29982264205?pr=1#step:6:300 But also, the test suite is very much not helping as it casts the list to a set when len > 1 (again, see test suite above). Question: Should we cast the response of smembers to a set? Or change the type hints? |
We should change the type hints. There is some difference between RESP3 sets and Python's sets and it is not possible to represents all RESP3 sets as sets in Python, so the functions has to return a list. Its up to the user to cast it to set when/if they know that is is safe to do so. Previous versions of the code returned a set, this is probably why the type hints are wrong. |
smsmbers is now marked as returning a list |
@Rafiot I noticed the last commit changes some test code as well. That's a bit odd. Is your branch based on some old commit in In my understanding, this PR should not change any behaviour of the library, it only adds the type hints. |
@mkmkme I'm using the test suite as a way to validate the type hints, so to do that, I need to add type hints to the test suite, which explains the changes. I'll review it, but it should not change the logic of the tests just add the hints in a way mypy is happy. It seemed to me to be the best way to make sure the type hints are in-line with the current codebase. |
Oh, true. So I'm confused how the tests as they are now can pass, because the response is definitely a list, not a set:
|
I just want to quickly update you on that one: I haven't forgotten, and will get back to it asap. This month got busy but I should be able to get back to this PR in a few days. |
Related valkey-io#84 Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: amirreza <amir.rsf1380@gmail.com> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: ArtemIsmagilov <artem.ismagilov.2000@mail.ru> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v3...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.41.0 to 0.42.0. - [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases) - [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md) - [Commits](rojopolis/spellcheck-github-actions@0.41.0...0.42.0) --- updated-dependencies: - dependency-name: rojopolis/spellcheck-github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
…d doc Signed-off-by: ArtemIsmagilov <artem.ismagilov.2000@mail.ru> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Close valkey-io#111 Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
This reverts commit 318019a. Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
This reverts commit 318019a. Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.42.0 to 0.44.0. - [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases) - [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md) - [Commits](rojopolis/spellcheck-github-actions@0.42.0...0.44.0) --- updated-dependencies: - dependency-name: rojopolis/spellcheck-github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Fixes valkey-io#119 Signed-off-by: Saverio Proto <saverioproto@microsoft.com> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Behaviour of READONLY was changed in valkey-io/valkey#325 which became a part of 8.0.0. This caused test_readonly_invalid_cluster_state to fail. This commit takes into account this change. Signed-off-by: Mikhail Koviazin <mikhail.koviazin@aiven.io>
Hash commands are part of proprietary module that Valkey does not implement for now. Mark them for skipping just like JSON and search. Signed-off-by: Mikhail Koviazin <mikhail.koviazin@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Previously the test relied on the amount of clients that are currently connected to the server. This is not robust as this can be affected by the outside or a bad timing. This caused quite a lot of test case failures. The proper way to handle this is: * Create a client and assign a distinguishable name to it * Verify it's in `CLIENT LIST` * Sleep for enough time for it to be killed by maxage we provide * Verify it's not anymore in `CLIENT LIST` This commit does exactly that. Signed-off-by: Mikhail Koviazin <mikhail.koviazin@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Mikhail Koviazin <mikhail.koviazin@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
In Python 3.13, `ssl.create_default_context()` added `VERIFY_X509_STRICT` to the flags by default which caused the tests to fail due to missing key usage. This commit adds it to the certificate configuration and replaces the certificates with reconfigured ones. Signed-off-by: Mikhail Koviazin <mikhail.koviazin@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
This commit adds support for minimum_ssl_version and maximum_ssl_version to `_ValkeyTCPServer` in tests. Previously it was written with `ssl.wrap_socket` in mind which only supported `ssl_version`. `SSLContext` OTOH supports passing both minimum and maximum supported TLS versions. This commit utilizes that. Additionally, TLS version in test_tcp_ssl_version_mismatch was fixed. It was broken since 7783e0b. This change was added there by mistake and in fact didn't change anything for Python 3.12. Instead, it seems to have hidden a bug that revealed itself with Python 3.13. Signed-off-by: Mikhail Koviazin <mikhail.koviazin@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Support for this commands may come in the future[1]. But it will take some time, so for now it's better to drop them. This is a breaking change for 6.1. Close valkey-io#78 [1]: valkey-io/valkey#640 Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.44.0 to 0.45.0. - [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases) - [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md) - [Commits](rojopolis/spellcheck-github-actions@0.44.0...0.45.0) --- updated-dependencies: - dependency-name: rojopolis/spellcheck-github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Raphaël Vinot <raphael@vinot.info>
I did terrible things to this branch. New PR: #134 |
Pull Request check-list
Description of change