-
Notifications
You must be signed in to change notification settings - Fork 348
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
Implements Request class in Python SDK. #3689
base: main
Are you sure you want to change the base?
Conversation
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.
Without running web-platform tests (where @npaun can help), I don't think we should land this, as it is. It would be extremely hard to review how compliant we are to the spec.
Tests can be found at: https://github.com/web-platform-tests/wpt/tree/983adc74e3c0a2faa1f3e3275f45c05aa5419c53/fetch/api/request
@anonrig ... given that this is a Python implementation of the class, conformance with the wpt is a bit secondary. |
Even if it's a Python implementation we might introduce a major behavior difference between the spec and our implementation that I'm afraid we might have to live with for a really long time. |
Admittedly I don't have a lot of context on WPT, but my understanding is that they are all JS tests for the browser (or other web platform), so I don't think they can be run on a Python worker easily. But the Python code is mostly wrapping the JS anyway, so behaviour should be spec compliant in those cases, where we don't simply wrap we try to make the API more idiomatic to Python which WPT wouldn't have test coverage for. In the long-term we'll probably want to create standards for Python on the web platform and create a test suite specifically for it, maybe that can even become part of WPT, but for now I don't think we should worry about it. |
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.
I made some comments but it generally looks good to me.
4ee8945
to
be5f56f
Compare
We can at least port the tests from WPT to Python to ensure we are compliant. |
We can do so, but I don't think that will give us much signal. We should focus on testing where we diverge from the JS and let the existing JS tests verify that the underlying platform that we wrap is compliant. |
be5f56f
to
f8bd542
Compare
For correction: I'm not blocking, but I still think we should have some of test (preferably from WPT) to validate the Request class API surface is same as the web spec dictates. It is fine if we do it later, but I strongly believe we should do it. It is also fine not to do it, and don't be spec compliant even though we implement a web spec. I approved the PR because it is in a good state that I'm comfortable with approving. |
I think we might be better off conforming to Python standards instead, how about https://requests.readthedocs.io/en/latest/api/#requests.Request ? |
@danlapid thats a really good solution and a path forward in my honest opinion. |
Implements a Python native
Request
class based on https://developer.mozilla.org/en-US/docs/Web/API/Request/Request.The API tries to match the
Response
API as closely as possible.Test Plan