-
-
Notifications
You must be signed in to change notification settings - Fork 544
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
chore: remove eol python 3.7 #2907
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2907 +/- ##
==========================================
- Coverage 96.53% 96.49% -0.04%
==========================================
Files 467 467
Lines 28910 28905 -5
Branches 3548 3545 -3
==========================================
- Hits 27908 27892 -16
- Misses 821 827 +6
- Partials 181 186 +5 |
Thanks for adding the Here's a preview of the changelog: This release removes support for Python 3.7 as its end of life This will allow us to reduce the number of CI jobs we have, Here's the preview release card for twitter: Here's the tweet text:
|
this PR also updates the dependencies (required because of python update) |
If 3.7 is dropped, then the special handling of |
as far as I can see, asyncio.CancelledError are not special handled (only for cleanup they are suppressed but for a good reason) |
Code like this: try:
...
except asyncio.CancelledError:
raise
except Exception as error:
await self.handle_task_exception(error) # pragma: no cover
is written for 3.7 compatibility, where It's fine to leave it in, just that we should remember to remove it at some later point since it is redundant for 3.8 and above. |
is something like --- a/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py
+++ b/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py
@@ -108,8 +108,6 @@ class BaseGraphQLTransportWSHandler(ABC):
self.connection_timed_out = True
reason = "Connection initialisation timeout"
await self.close(code=4408, reason=reason)
- except asyncio.CancelledError:
- raise
except Exception as error:
await self.handle_task_exception(error) # pragma: no cover
finally:
@@ -118,7 +116,10 @@ class BaseGraphQLTransportWSHandler(ABC):
self.completed_tasks.append(task)
async def handle_task_exception(self, error: Exception) -> None:
- self.task_logger.exception("Exception in worker task", exc_info=error)
+ if isinstance(error, asyncio.CancelledError):
+ self.task_logger.exception("Worker task cancelled", exc_info=error)
+ else
+ self.task_logger.exception("Exception in worker task", exc_info=error)
async def handle_message(self, message: dict) -> None:
handler: Callable
right? |
Just the first part. In 3.8 CancelledError won't be caught by "except Exception" because it isn't an "Exception" |
strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py
Outdated
Show resolved
Hide resolved
strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py
Outdated
Show resolved
Hide resolved
strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py
Outdated
Show resolved
Hide resolved
I think I may have confused you with my talk about "CancelledError". Basically, we never want to catch it. So, the only thing required, is to simply drop the |
in some new python versions asyncio.CancelledError inherits from Exception, so we need it |
b3b7ab8
to
78ad0b3
Compare
cleaned up and rebased. Also add the updated dependencies in the release.md |
I think you will find that this is incorrect. The documentation clearly states: "Changed in version 3.8: CancelledError is now a subclass of BaseException." This special handling of CancelledError is not required in 3.8 and beyond, indeed, this is the reason it was changed in 3.8 because people were accidentally catching it and code like this was needed all over the place. No more. |
technically this stanca would be also right, if they inherit from Exception, so it is implementation specific |
No it isn't. Yes, you could deliberately mis-interpret it, but it indicates a change from the 3.7 behaviour. It is not implementation specific. I don't quite understand why you are being so stubborn about this, it is a well known fact of Python asyncio programming. If you like, I can have it fixed in the documentation. This is from the 3.8 release notes:
and from the "what's new" part:
|
Thing is: vscode says something different. Maybe the stubs are wrong. If you say it works, then I give it a try. I just don't want to break anything as I have not so much time with two children. I just wanted to make a short PR, updating the code and now it takes much more time than anticipated. Optimizing code is something which can be done afterwards so please forgive my stubbornness |
this too? except asyncio.CancelledError:
# CancelledErrors are expected during task cleanup.
pass EDIT: in case it is superfluous, can please someone else test it and make another PR. I have currently not the time. |
It is fine, I can clean this all up later, I just wanted to mention this in the PR since this was about deprecating 3.7 and I have been wanting to get this out of the way for a long time. Fwiw, I made a change to the docs, and here you have it from the horse's mouth: |
thank you. |
Also uvicorn can be updated with editing this PR |
@devkral can you rebase this? 😊 |
done |
I hope it is ok to add an editorconfig as my defaults always wreck the yaml formatting. |
CodSpeed Performance ReportMerging #2907 will not alter performanceComparing Summary
|
there were some new refs to python 3.7 which had to be removed (tests/pyright). Hope we can end the never ending PR soon ;) |
my only concern with this is that we support a version of django that still supports 3.7, I'm probably overthinking this though :D I'll put this on my list of things to review this week :) |
0ed7e04
to
44b2cdc
Compare
fix: add python 3.11 to test matrices chore: update dependencies
fix: add python 3.11 to test matrices chore: update dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this 😊
* chore: remove eol python 3.7 (and some quirks) fix: add python 3.11 to test matrices chore: update dependencies * add release.md * fix: remove superfluous special handling of asyncio.CancelledError * chore: remove eol python 3.7 (and some quirks) fix: add python 3.11 to test matrices chore: update dependencies * Update release notes --------- Co-authored-by: Patrick Arminio <[email protected]>
Remove python 3.7 and add python 3.11 to remaining test matrices
This PR also updates the testrunner docker image to python 3.8 and fully qualifies the source
Types of Changes
Checklist