Skip to content

CDDL 2 Python generator#16914

Merged
AutomatedTester merged 37 commits intotrunkfrom
cddl2py
Apr 13, 2026
Merged

CDDL 2 Python generator#16914
AutomatedTester merged 37 commits intotrunkfrom
cddl2py

Conversation

@AutomatedTester
Copy link
Copy Markdown
Member

@AutomatedTester AutomatedTester commented Jan 16, 2026

This generates bidi code based off of the CDDL that we can update from the specification. I expect over time the generation will need other features added.

@selenium-ci selenium-ci added the C-py Python Bindings label Jan 16, 2026
@AutomatedTester AutomatedTester marked this pull request as draft January 16, 2026 10:14
Copilot AI review requested due to automatic review settings February 16, 2026 11:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a CDDL (Concise Data Definition Language) to Python generator for WebDriver BiDi modules. It generates 9 BiDi protocol modules from the W3C specification, replacing hand-written implementations with auto-generated code.

Changes:

  • Adds py/generate_bidi.py - CDDL parser and Python code generator (623 lines)
  • Adds Bazel build integration for code generation
  • Generates 9 BiDi modules (browser, browsing_context, emulation, input, network, script, session, storage, webextension) with 146 type definitions and 52 commands
  • Adds validation tooling and documentation

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
py/generate_bidi.py Core CDDL parser and Python code generator
py/private/generate_bidi.bzl Bazel rule for BiDi code generation
py/BUILD.bazel Integration of generation target
py/requirements.txt Added pycddl dependency
py/selenium/webdriver/common/bidi/*.py Generated BiDi module replacements
py/validate_bidi_modules.py Validation tooling for comparing generated vs hand-written code
common/bidi/spec/local.cddl CDDL specification (1331 lines)
Various .md files Documentation and findings

Comment thread py/selenium/webdriver/common/bidi/script.py Outdated
Comment thread py/selenium/webdriver/common/bidi/script.py Outdated
Comment thread py/requirements.txt Outdated
Comment thread py/selenium/webdriver/common/bidi/webextension.py Outdated
Comment thread py/requirements_lock.txt
Comment thread py/selenium/webdriver/common/bidi/storage.py Outdated
Comment thread py/selenium/webdriver/common/bidi/webextension.py Outdated
Comment thread py/selenium/webdriver/common/bidi/webextension.py Outdated
Comment thread py/selenium/webdriver/common/bidi/storage.py Outdated
Comment thread py/selenium/webdriver/common/bidi/storage.py Outdated
Copilot AI review requested due to automatic review settings February 17, 2026 10:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

py/validate_bidi_modules.py:1

  • Corrected spelling of 'Analyze' to match class name convention.
#!/usr/bin/env python3

Comment thread py/generate_bidi.py Outdated
Comment thread py/requirements.txt Outdated
Comment thread common/bidi/spec/local.cddl
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 34 changed files in this pull request and generated 10 comments.

Comment thread py/selenium/webdriver/common/bidi/network.py Outdated
Comment thread py/selenium/common/exceptions.py
Comment thread py/selenium/webdriver/common/bidi/network.py Outdated
Comment thread py/selenium/webdriver/remote/webdriver.py
Comment thread py/selenium/webdriver/common/bidi/emulation.py Outdated
Comment thread py/generate_bidi.py
Comment thread py/selenium/webdriver/remote/webdriver.py
Comment thread py/selenium/webdriver/common/bidi/session.py Outdated
Comment thread py/selenium/webdriver/common/bidi/input.py Outdated
Comment thread py/selenium/webdriver/common/bidi/network.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 35 out of 36 changed files in this pull request and generated 10 comments.

Comment thread py/selenium/webdriver/common/bidi/emulation.py Outdated
Comment thread py/validate_bidi_modules.py Outdated
Comment thread py/selenium/webdriver/common/bidi/storage.py Outdated
Comment thread py/selenium/webdriver/common/bidi/emulation.py Outdated
Comment thread py/selenium/webdriver/common/bidi/network.py Outdated
Comment thread py/selenium/common/exceptions.py Outdated
Comment thread py/selenium/webdriver/common/bidi/browser.py
Comment thread py/selenium/webdriver/common/bidi/storage.py Outdated
Comment thread py/selenium/webdriver/common/bidi/storage.py Outdated
Comment thread py/selenium/webdriver/common/bidi/browser.py Outdated
Copilot AI review requested due to automatic review settings February 25, 2026 13:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

py/selenium/webdriver/remote/webdriver.py:1107

  • start_devtools()/bidi_connection() call import_cdp() which imports selenium.webdriver.common.bidi.cdp, but this PR deletes py/selenium/webdriver/common/bidi/cdp.py. That will cause a ModuleNotFoundError the first time devtools/BiDi connection code runs. Either keep/replace the cdp module (and update import_cdp() accordingly) or remove these code paths.

Comment thread py/selenium/webdriver/common/bidi/storage.py
Comment thread py/selenium/webdriver/common/bidi/network.py Outdated
Comment thread py/selenium/webdriver/common/bidi/log.py Outdated
Comment thread py/selenium/webdriver/common/bidi/browser.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 32 out of 34 changed files in this pull request and generated 8 comments.

Comment thread py/test/selenium/webdriver/common/bidi_browser_tests.py
Comment thread py/selenium/webdriver/common/bidi/log.py Outdated
Comment thread py/selenium/webdriver/common/bidi/network.py Outdated
Comment thread py/selenium/webdriver/common/bidi/input.py Outdated
Comment thread py/selenium/webdriver/remote/websocket_connection.py
Comment thread py/selenium/webdriver/common/bidi/common.py Outdated
Comment thread py/selenium/webdriver/common/bidi/emulation.py Outdated
Comment thread py/selenium/webdriver/common/bidi/log.py Outdated
Copilot AI review requested due to automatic review settings March 2, 2026 11:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 34 changed files in this pull request and generated 1 comment.

Comment thread py/selenium/webdriver/remote/webdriver.py Outdated
Copilot AI review requested due to automatic review settings March 7, 2026 11:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 37 out of 38 changed files in this pull request and generated no new comments.

@AutomatedTester AutomatedTester merged commit 0023381 into trunk Apr 13, 2026
60 checks passed
@AutomatedTester AutomatedTester deleted the cddl2py branch April 13, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants