HyperionGray / trio-chrome-devtools-protocol

Trio driver for Chrome DevTools Protocol (CDP)
MIT License
60 stars 17 forks source link

New API #9

Closed mehaase closed 4 years ago

mehaase commented 4 years ago

Here is a PR for the new API discussed in #1, and inspired by PR #6 but with a couple changes:

  1. Use context vars instead of a singleton instance.
  2. Use code generation instead of decoration. This improves type inference for tools like MyPy.
  3. Extend the same changes to the connection class.

This is incomplete, but we wanted to make the PR for discussion purposes before we polish it up and release it. The todo list includes:

mehaase commented 4 years ago

Oh, and there is also an issue with the generated modules needing to import their dependencies. This is currently breaking the build. This might be tricky to fix because we might need to qualify some type names with with cdp..