Skip to content

Conversation

@douglasdcm
Copy link

Hi, how are you? I'm following the example from Quick Start, but I'm not able to import cdp.connection. It seems the root cause is that it is not present in the file cpd.__init__.py. This MR exposes the module.

Issue Details
I installed the tool according to the documentation and tried to run the example code, but I was not able to access the connection module.

Module not accessible
image

After the change
I executed the tests and all of them are passing. I used Python 3.7

python -m pytest --lf
/home/douglas/repo/python-chrome-devtools-protocol/venv/lib/python3.8/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
===================================================== test session starts ======================================================
platform linux -- Python 3.8.20, pytest-8.3.5, pluggy-1.5.0
rootdir: /home/douglas/repo/python-chrome-devtools-protocol
configfile: pyproject.toml
plugins: asyncio-0.24.0
asyncio: mode=strict, default_loop_scope=None
collected 39 items                                                                                                             
run-last-failure: no previously failed tests, not deselecting items.

generator/test_generate.py ....................                                                                          [ 51%]
test/test_cdp.py ......                                                                                                  [ 66%]
test/test_connection.py .............                                                                                    [100%]

====================================================== 39 passed in 1.24s ======================================================

pip freeze

pip freeze
chrome-devtools-protocol @ file:///home/douglas/repo/python-chrome-devtools-protocol
Deprecated==1.3.1
exceptiongroup==1.3.1
inflection==0.5.1
iniconfig==2.1.0
packaging==25.0
pluggy==1.5.0
pytest==8.3.5
pytest-asyncio==0.24.0
tomli==2.3.0
typing_extensions==4.13.2
websockets==13.1
wrapt==2.0.1

@gemini-code-assist
Copy link

Summary of Changes

Hello @douglasdcm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical importability issue within the cdp package, where the connection module was not accessible as demonstrated in the Quick Start documentation. By adding a single import statement to the package's __init__.py file, this change ensures that the connection module is properly exposed. This directly improves the usability of the library by allowing developers to utilize its functionalities without encountering import errors, thereby aligning the package's behavior with its documented examples.

Highlights

  • Importability Fix: Resolves an issue where the cdp.connection module could not be imported by users, specifically those following the Quick Start guide, due to it not being exposed in the package's __init__.py.
  • Module Exposure: The connection module is now explicitly imported within cdp/__init__.py, making it directly accessible when the cdp package is imported.
  • Test Verification: All existing tests have been confirmed to pass after the change, ensuring no regressions were introduced.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Hi, thank you for this contribution. Your change correctly identifies and fixes the issue of the cdp.connection module not being exposed. However, the change is made to an auto-generated file (cdp/__init__.py), which is discouraged as mentioned in the file's header. My review comment provides more detail on this. The fix should be applied to the generator script (generator/generate.py) to make it permanent. Once you've updated the generator, this will be a great addition to the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant