donew


Namedonew JSON
Version 0.1.5 PyPI version JSON
download
home_pageNone
SummaryA Python package for web processing and vision tasks with browser automation capabilities
upload_time2025-01-03 20:01:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords web automation vision browser playwright image processing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DoNew

[![PyPI version](https://badge.fury.io/py/donew.svg)](https://badge.fury.io/py/donew)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/donew)](https://pypi.org/project/donew/)
[![PyPI - License](https://img.shields.io/pypi/l/donew)](https://pypi.org/project/donew/)

A powerful Python package designed for AI agents to perform web processing, document navigation, and autonomous task execution. DoNew provides a high-level, agentic interface that makes it easy for AI systems to interact with web content and documents.

## Quick Install

```bash
pip install donew
donew-install-browsers  # Install required browsers
```

## Why DoNew?

DoNew is built with AI agents in mind, providing intuitive interfaces for:
- Autonomous web navigation and interaction
- Document understanding and processing
- Task execution and decision making
- State management and context awareness

## Features

- Browser automation using Playwright
- Web page processing and interaction
- Vision-related tasks and image processing
- Easy-to-use API for web automation
- Async support for better performance
- AI-friendly interfaces for autonomous operation

## Roadmap

### Current Features
- **DO.Browse**: Agentic web navigation
  - Autonomous webpage interaction
  - Element detection and manipulation
  - State awareness and context management
  - Cookie and storage handling
  - Visual debugging tools

### Coming Soon
- **DO.Read**: Agentic document navigation
  - PDF processing and understanding
  - Document structure analysis
  - Content extraction and processing
  - Cross-document reference handling

- **DO(...).New**: Agentic behavior execution
  - Task planning and execution
  - Decision making based on content
  - Multi-step operation handling
  - Context-aware actions

## Quick Start

```python
import asyncio
from donew import DO

async def main():
    # Configure browser settings (optional)
    DO.Config(headless=True)  # Run in headless mode
    
    # Start agentic web navigation
    browser = await DO.Browse("https://example.com")
    
    try:
        # Analyze page content
        content = await browser.text()
        print("Page content:", content)
        
        # Get all interactive elements with their context
        elements = browser.elements()
        
        # Smart element detection (finds relevant input fields by context)
        input_fields = {
            elem.element_label or elem.attributes.get("name", ""): id
            for id, elem in elements.items()
            if elem.element_type == "input"
            and elem.attributes.get("type") in ["text", "email"]
        }
        
        # Autonomous form interaction
        for label, element_id in input_fields.items():
            await browser.type(element_id, f"test_{label}")
        
        # State management
        cookies = await browser.cookies()
        print("Current browser state (cookies):", cookies)
        
        # Context persistence
        await browser.storage({
            "localStorage": {"agent_context": "form_filling"},
            "sessionStorage": {"task_state": "in_progress"}
        })
        
        # Visual debugging (helps AI understand page state)
        await browser.toggle_annotation(True)
        
        # Get current state for decision making
        state = await browser._get_state_dict()
        print("Current agent state:", state)
        
    finally:
        await browser.close()

if __name__ == "__main__":
    asyncio.run(main())
```

### Example: AI Agent Task Execution

```python
from donew import DO

async def search_and_extract(query: str):
    browser = await DO.Browse("https://example.com/search")
    try:
        # Find and interact with search form
        elements = browser.elements()
        search_input = next(
            (id for id, elem in elements.items() 
             if elem.element_type == "input" and 
             ("search" in elem.element_label.lower() if elem.element_label else False)),
            None
        )
        
        if search_input:
            # Execute search
            await browser.type(search_input, query)
            await browser.press("Enter")
            
            # Wait for and analyze results
            content = await browser.text()
            
            # Extract structured data
            return {
                "query": query,
                "results": content,
                "page_state": await browser._get_state_dict()
            }
    finally:
        await browser.close()
```

## Development Setup

1. Clone the repository
2. Create a virtual environment using `uv`:
```bash
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
```
3. Install development dependencies:
```bash
uv pip install -e ".[dev]"
```
4. Install Playwright browsers:
```bash
donew-install-browsers
```

## Testing

Run the test suite:
```bash
pytest tests/
```

For more detailed testing options, including using local or remote httpbin, see the [Testing Documentation](docs/testing.md).

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "donew",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "web automation, vision, browser, playwright, image processing",
    "author": null,
    "author_email": "Kenan Deniz <kenan@unrealists.com>",
    "download_url": "https://files.pythonhosted.org/packages/be/60/663615e3f08d18974743e0b8750ef817ad678613083c15450d3b35a7bde3/donew-0.1.5.tar.gz",
    "platform": null,
    "description": "# DoNew\n\n[![PyPI version](https://badge.fury.io/py/donew.svg)](https://badge.fury.io/py/donew)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/donew)](https://pypi.org/project/donew/)\n[![PyPI - License](https://img.shields.io/pypi/l/donew)](https://pypi.org/project/donew/)\n\nA powerful Python package designed for AI agents to perform web processing, document navigation, and autonomous task execution. DoNew provides a high-level, agentic interface that makes it easy for AI systems to interact with web content and documents.\n\n## Quick Install\n\n```bash\npip install donew\ndonew-install-browsers  # Install required browsers\n```\n\n## Why DoNew?\n\nDoNew is built with AI agents in mind, providing intuitive interfaces for:\n- Autonomous web navigation and interaction\n- Document understanding and processing\n- Task execution and decision making\n- State management and context awareness\n\n## Features\n\n- Browser automation using Playwright\n- Web page processing and interaction\n- Vision-related tasks and image processing\n- Easy-to-use API for web automation\n- Async support for better performance\n- AI-friendly interfaces for autonomous operation\n\n## Roadmap\n\n### Current Features\n- **DO.Browse**: Agentic web navigation\n  - Autonomous webpage interaction\n  - Element detection and manipulation\n  - State awareness and context management\n  - Cookie and storage handling\n  - Visual debugging tools\n\n### Coming Soon\n- **DO.Read**: Agentic document navigation\n  - PDF processing and understanding\n  - Document structure analysis\n  - Content extraction and processing\n  - Cross-document reference handling\n\n- **DO(...).New**: Agentic behavior execution\n  - Task planning and execution\n  - Decision making based on content\n  - Multi-step operation handling\n  - Context-aware actions\n\n## Quick Start\n\n```python\nimport asyncio\nfrom donew import DO\n\nasync def main():\n    # Configure browser settings (optional)\n    DO.Config(headless=True)  # Run in headless mode\n    \n    # Start agentic web navigation\n    browser = await DO.Browse(\"https://example.com\")\n    \n    try:\n        # Analyze page content\n        content = await browser.text()\n        print(\"Page content:\", content)\n        \n        # Get all interactive elements with their context\n        elements = browser.elements()\n        \n        # Smart element detection (finds relevant input fields by context)\n        input_fields = {\n            elem.element_label or elem.attributes.get(\"name\", \"\"): id\n            for id, elem in elements.items()\n            if elem.element_type == \"input\"\n            and elem.attributes.get(\"type\") in [\"text\", \"email\"]\n        }\n        \n        # Autonomous form interaction\n        for label, element_id in input_fields.items():\n            await browser.type(element_id, f\"test_{label}\")\n        \n        # State management\n        cookies = await browser.cookies()\n        print(\"Current browser state (cookies):\", cookies)\n        \n        # Context persistence\n        await browser.storage({\n            \"localStorage\": {\"agent_context\": \"form_filling\"},\n            \"sessionStorage\": {\"task_state\": \"in_progress\"}\n        })\n        \n        # Visual debugging (helps AI understand page state)\n        await browser.toggle_annotation(True)\n        \n        # Get current state for decision making\n        state = await browser._get_state_dict()\n        print(\"Current agent state:\", state)\n        \n    finally:\n        await browser.close()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Example: AI Agent Task Execution\n\n```python\nfrom donew import DO\n\nasync def search_and_extract(query: str):\n    browser = await DO.Browse(\"https://example.com/search\")\n    try:\n        # Find and interact with search form\n        elements = browser.elements()\n        search_input = next(\n            (id for id, elem in elements.items() \n             if elem.element_type == \"input\" and \n             (\"search\" in elem.element_label.lower() if elem.element_label else False)),\n            None\n        )\n        \n        if search_input:\n            # Execute search\n            await browser.type(search_input, query)\n            await browser.press(\"Enter\")\n            \n            # Wait for and analyze results\n            content = await browser.text()\n            \n            # Extract structured data\n            return {\n                \"query\": query,\n                \"results\": content,\n                \"page_state\": await browser._get_state_dict()\n            }\n    finally:\n        await browser.close()\n```\n\n## Development Setup\n\n1. Clone the repository\n2. Create a virtual environment using `uv`:\n```bash\nuv venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n```\n3. Install development dependencies:\n```bash\nuv pip install -e \".[dev]\"\n```\n4. Install Playwright browsers:\n```bash\ndonew-install-browsers\n```\n\n## Testing\n\nRun the test suite:\n```bash\npytest tests/\n```\n\nFor more detailed testing options, including using local or remote httpbin, see the [Testing Documentation](docs/testing.md).\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python package for web processing and vision tasks with browser automation capabilities",
    "version": "0.1.5",
    "project_urls": null,
    "split_keywords": [
        "web automation",
        " vision",
        " browser",
        " playwright",
        " image processing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42d4f25450d2c5a9462e523d317352b150914669918ee5988505352a17d6d1a7",
                "md5": "85de6271af5cef778f17e3a368aae592",
                "sha256": "dc1721d8c6024d8f3b322a621b87302654834f99ca5414b22ca1a83d86d77b2b"
            },
            "downloads": -1,
            "filename": "donew-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "85de6271af5cef778f17e3a368aae592",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20988,
            "upload_time": "2025-01-03T20:01:21",
            "upload_time_iso_8601": "2025-01-03T20:01:21.671543Z",
            "url": "https://files.pythonhosted.org/packages/42/d4/f25450d2c5a9462e523d317352b150914669918ee5988505352a17d6d1a7/donew-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be60663615e3f08d18974743e0b8750ef817ad678613083c15450d3b35a7bde3",
                "md5": "95f31e0595be6cb68072dc06d81f80ab",
                "sha256": "fa244374501a406936894cbd27b318bbbdc3d89277860d673d0ed1ff8a1671bc"
            },
            "downloads": -1,
            "filename": "donew-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "95f31e0595be6cb68072dc06d81f80ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 23356,
            "upload_time": "2025-01-03T20:01:24",
            "upload_time_iso_8601": "2025-01-03T20:01:24.235027Z",
            "url": "https://files.pythonhosted.org/packages/be/60/663615e3f08d18974743e0b8750ef817ad678613083c15450d3b35a7bde3/donew-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-03 20:01:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "donew"
}
        
Elapsed time: 0.48438s