Release v4.0 – Full Rewrite with Async Support, Pydantic v2, and Modern Architecture#72
Merged
alperensert merged 5 commits intomasterfrom Apr 30, 2025
Merged
Release v4.0 – Full Rewrite with Async Support, Pydantic v2, and Modern Architecture#72alperensert merged 5 commits intomasterfrom
alperensert merged 5 commits intomasterfrom
Conversation
…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.
There was a problem hiding this comment.
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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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