Skip to content

Release v4.0 – Full Rewrite with Async Support, Pydantic v2, and Modern Architecture#72

Merged
alperensert merged 5 commits intomasterfrom
v4.x
Apr 30, 2025
Merged

Release v4.0 – Full Rewrite with Async Support, Pydantic v2, and Modern Architecture#72
alperensert merged 5 commits intomasterfrom
v4.x

Conversation

@alperensert
Copy link
Copy Markdown
Owner

This release introduces a full rewrite of the Capmonster Python library, marking a major version upgrade to v4.0 with breaking changes. Key improvements include:

  • ✅ Modern async-first architecture for non-blocking IO

  • 🧱 Modular task system with clean separation (recaptcha, datadome, image_to_text, etc.)

  • ⚙️ Typed interfaces and dataclasses for better readability and IDE support

  • 📦 Pydantic v2 adopted for all request models (v1 fallback not supported)

  • 🔐 Robust error handling, validation, and retry logic across all endpoints

  • 🧪 Improved testability and structure, paving the way for full unit test coverage

  • 📄 Fully documented public API with Google-style docstrings

…hon features

- Replaced legacy procedural structure with fully typed class-based design
- Introduced Pydantic v2 models with field validation, serialization, and aliasing
- Implemented sync and async Capmonster clients using httpx
- Added extensible BaseTaskPayload structure with abstract to_request()
- Included validator and field_serializer usage for dynamic task behavior
- Flattened proxy structure via smart task serialization
- Applied frozen and immutable model config where applicable
- Full support for Literal, Optional etc.
- Some test cases prepared with pytest + pytest-asyncio
- Ready for mkdocs documentation generation

BREAKING CHANGE: API usage has completely changed from v3.2 to v4.0. All task creation methods now rely on structured payloads and typed clients.
…roject

- Replaced setup.py and setup.cfg with pyproject.toml for a modern build system. Updated project structure to align with the src directory convention. Adjusted imports, examples, and documentation for the updated layout and dependency changes.
Removed outdated CODE-OF-CONDUCT.md and README.md files. Introduced a detailed, structured API reference and examples using MkDocs format. Includes documentation for tasks, exceptions, error codes, and usage examples in both synchronous and asynchronous modes.
@alperensert alperensert added the enhancement New feature or request label Apr 30, 2025
@alperensert alperensert requested a review from Copilot April 30, 2025 21:43
Copy link
Copy Markdown

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 represents a major version upgrade (v4.0) with a complete rewrite of the Capmonster Python library, introducing an async-first architecture, modern Pydantic v2 models, and a modular design.

  • Removal of legacy task module files (e.g. RecaptchaV2Task, GeeTestTask, etc.).
  • Updates to CI/CD workflows and documentation to support the new architecture.
  • Changes in dependency configurations and deployment setups to align with the new project structure.

Reviewed Changes

Copilot reviewed 119 out of 121 changed files in this pull request and generated no comments.

File Description
capmonster_python/*.py (multiple files) Legacy module files removed to prepare for a full rewrite.
README.md Updated documentation highlighting breaking changes and new features.
.github/workflows/* Adjustments to test, publish, and deployment workflows.
.github/dependabot.yml Dependency monitoring configuration updated to new code directory.
Files not reviewed (2)
  • .editorconfig: Language not supported
  • Makefile: Language not supported
Comments suppressed due to low confidence (3)

capmonster_python/init.py:1

  • The complete removal of legacy imports from init.py requires verification that the new public API is correctly exported. Make sure the init.py file is updated to reflect the new modules and interfaces.
from .recaptcha_v2 import RecaptchaV2Task

.github/workflows/ghpages.yml:11

  • Confirm that the change from 'contents: read' to 'contents: write' is intentional, ensuring that the deployment has the necessary permissions without unnecessarily broadening access.
contents: write

.github/dependabot.yml:4

  • Ensure that the new directory location '/src/capmonster_python' matches the updated project structure and that all dependency update checks are running as expected.
directory: "/src/capmonster_python"

@alperensert alperensert merged commit bd9e40d into master Apr 30, 2025
1 of 2 checks passed
@alperensert alperensert deleted the v4.x branch April 30, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants