Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,21 @@ build
dist
docs/_build
venv
*.pyc
*.pyo
*.pyd
.Python
env/
ENV/
.env
.venv
pip-log.txt
pip-delete-this-directory.txt
.coverage
htmlcov/
.tox/
.hypothesis/
*.egg
.eggs/
*.log
.DS_Store
79 changes: 79 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.0] - 2024-12-XX

### Added
- **I/O Mode**: New `cdp.connection` module providing WebSocket I/O, JSON-RPC framing, and command multiplexing
- **8 New Domains**: Extensions, FedCm, DeviceAccess, FileSystem, Autofill, BluetoothEmulation, PWA, Preload
- **Privacy Sandbox APIs**: Comprehensive support for Attribution Reporting, Shared Storage, Interest Groups/FLEDGE
- Security-focused APIs for testing federated authentication, device permissions, and extension boundaries
- Bounce tracking mitigation testing capabilities
- IP protection proxy status and control
- Related Website Sets (First-Party Sets) support
- Form security issue detection via Audits domain
- Privacy Sandbox enrollment override for testing
- Enhanced cookie controls for third-party cookie testing

### Changed
- Updated to Chrome DevTools Protocol version 1.3 (latest)
- Fixed same-domain type reference bug in code generator (e.g., `Network.TimeSinceEpoch` now correctly resolves)
- Improved code generator to protect manually-written files (connection.py, util.py)
- `page.navigate()` now returns 4 values instead of 3 (added `is_download` parameter)

### Removed
- **Breaking Change**: Removed deprecated Database domain (use IndexedDB, Storage, or Cache Storage APIs instead)

### Security
- Added comprehensive security testing capabilities for Privacy Sandbox
- Enhanced storage domain with privacy-preserving measurement APIs
- Added attribution reporting and shared storage tracking
- Improved form security auditing

## [0.4.0] - Previous Release

### Added
- Initial sans-I/O implementation
- Type wrappers for Chrome DevTools Protocol
- Automatic code generation from CDP specification
- Support for Python 3.7+

## Migration Guide

### From 0.4.x to 0.5.0

#### Database Domain Removed
```python
# Old (no longer works)
from cdp import database
await conn.execute(database.some_command())

# New - Use IndexedDB instead
from cdp import indexed_db
await conn.execute(indexed_db.request_database_names(security_origin="https://example.com"))
```

#### page.navigate() Return Signature Changed
```python
# Old (3 values)
frame_id, loader_id, error_text = await conn.execute(page.navigate(url="..."))

# New (4 values - added is_download)
frame_id, loader_id, error_text, is_download = await conn.execute(page.navigate(url="..."))
```

## Links

- [Repository](https://github.com/HyperionGray/python-chrome-devtools-protocol)
- [Documentation](https://py-cdp.readthedocs.io)
- [PyPI](https://pypi.org/project/chrome-devtools-protocol/)
- [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/)

---

For detailed security-relevant updates, see [SECURITY.md](SECURITY.md).
For implementation details, see [IMPLEMENTATION.md](IMPLEMENTATION.md).
127 changes: 127 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at the project
repository. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
143 changes: 143 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Contributing to PyCDP

Thank you for your interest in contributing to Python Chrome DevTools Protocol (PyCDP)! This document provides guidelines for contributing to the project.

## Getting Started

### Prerequisites

- Python 3.7 or higher
- [Poetry](https://python-poetry.org/) for dependency management

### Setting Up Your Development Environment

1. Fork the repository on GitHub
2. Clone your fork locally:
```bash
git clone https://github.com/YOUR_USERNAME/python-chrome-devtools-protocol.git
cd python-chrome-devtools-protocol
```
3. Install dependencies:
```bash
poetry install
```

## Development Workflow

### Code Generation

This project automatically generates Python wrappers from the Chrome DevTools Protocol specification. Most code in the `cdp/` directory (except `connection.py` and `util.py`) is auto-generated.

To regenerate the protocol wrappers:
```bash
poetry run make generate
```

### Running Tests

Run the test suite:
```bash
poetry run make test-cdp
poetry run make test-generate
```

Or run all checks:
```bash
poetry run make
```

### Type Checking

We use mypy for static type checking:
```bash
poetry run make mypy-cdp
poetry run make mypy-generate
```

### Building Documentation

To build the documentation:
```bash
poetry run make docs
```

## Making Changes

### Code Style

- Follow PEP 8 style guidelines
- Use type hints for all function signatures
- Keep code clear and well-documented

### Commit Messages

- Use clear and descriptive commit messages
- Reference issue numbers when applicable
- Keep commits focused on a single change

### Pull Requests

1. Create a new branch for your changes:
```bash
git checkout -b feature/your-feature-name
```
2. Make your changes and commit them
3. Push to your fork and submit a pull request
4. Ensure all tests pass and type checking succeeds
5. Provide a clear description of your changes

## What to Contribute

### Areas for Contribution

- **Bug fixes**: Fix issues in the connection module or utility functions
- **Documentation**: Improve examples, tutorials, or API documentation
- **Tests**: Add test coverage for existing functionality
- **Examples**: Add new usage examples in the `examples/` directory

### Code Generation Changes

If you need to modify code generation:
- Edit files in the `generator/` directory
- Run the generator and verify the output
- Ensure all tests still pass
- Add tests for your generator changes

### Protocol Updates

The protocol definitions are automatically fetched from the Chrome DevTools Protocol repository. If you need to update to a newer protocol version, please open an issue first to discuss the change.

## Reporting Issues

### Bug Reports

When reporting bugs, please include:
- Python version
- PyCDP version
- Steps to reproduce
- Expected vs. actual behavior
- Error messages or stack traces

### Feature Requests

For feature requests:
- Clearly describe the feature
- Explain the use case
- Consider if it fits the project's scope

## Code of Conduct

Please be respectful and constructive in all interactions. We are committed to providing a welcoming and inclusive environment for all contributors.

## Questions?

If you have questions about contributing, please:
- Check existing issues and pull requests
- Open a new issue with your question
- Tag it appropriately for visibility

## License

By contributing to PyCDP, you agree that your contributions will be licensed under the MIT License.

Thank you for contributing to PyCDP!
Loading