This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
[246] Prepare for aiohttp v4, but stay with v3 #277
Merged
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.
aiohttp
v4 would bring few changes incompatible with Kopf and would break both the CI/CD pipelines and the Kopf-based operators. Some of these issues can be proactively fixed now. Others can be prevented by non-upgrading to v4.Description
The main incompatibility is that it is now impossible to inherit from
aiohttp.ClientSession
— explicitly restrictred inaiohttp
.This PR converts our
APISession
from inheritingaiohttp.ClientSession
to containingaiohttp.ClientSession
(i.e. a composition instead of inheritance).Since it is not a session anymore, it is also renamed to a context — the closest semantic equivalent I could find. Nevertheless, it is not part of the public interface, so we are free to change and rename it as needed.
Beside of that, it also resolves the design flaw with few private/protected fields injected into the conceptually irrelevant 3rd-party session objects.
This PR, however, does NOT make Kopf fully compatible with
aiohttp
v4. Beside of the ClientSession,aresponses
(used in tests) has some issues with the newaiohttp
, andaiohttp
v4 itself has incompatibilities withasync-timeout
v4.It is not wise to dive that deep into the dependencies. Instead, we restrict
aiohttp
to major v3, and wait until v4 is released and stabilised (now, it is all in alpha).Types of Changes