Metadata-Version: 2.4
Name: pythontomaestro
Version: 0.1.1
Summary: A tool to convert Python automation scripts (Selenium/Appium) to Maestro YAML flows.
Author-email: Dhiraj Das <dhirajdas.666@gmail.com>
Project-URL: Homepage, https://github.com/godhiraj-code/pythontomaestro
Project-URL: Bug Tracker, https://github.com/godhiraj-code/pythontomaestro/issues
Project-URL: X, https://x.com/dkkkkd
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyyaml
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Dynamic: license-file

# Python to Maestro Converter

A simple tool to convert existing Python automation scripts (Selenium, Appium) into [Maestro](https://maestro.mobile.dev/) YAML flows.

## Installation

```bash
pip install pythontomaestro
```

## Usage

```bash
pythontomaestro <input_file> <output_dir> [--app-id APP_ID]
```

Example:

```bash
pythontomaestro tests/my_test.py output/ --app-id com.acme.myapp
```

This will read `tests/my_test.py`, convert the automation steps, and save the resulting YAML flows into the `output/` directory (e.g., `output/test_login_success.yaml`).

`--app-id` sets the target application's Maestro `appId`. It defaults to
`com.example.app` for backward compatibility; production flows should pass the
real application ID.

## Features

- Parses Python AST to extract automation steps.
- Maps Selenium/Appium commands (click, input, navigate) to Maestro commands (tapOn, inputText, openLink).
- Generates valid Maestro YAML flows.

## ⚠️ Limitations & Manual Review

**Not everything can be converted automatically.**

Python scripts often contain complex logic (loops, conditionals, custom helper methods) that do not map 1:1 to Maestro's declarative YAML syntax.

When the tool encounters such logic, it will:
1.  **Log a warning** in the console.
2.  **Insert a `TODO_UNSUPPORTED_ACTION`** in the generated YAML file.
3.  **Add a top-level warning comment** to the file.

**Example:**

```yaml
# WARNING: This flow contains unsupported actions (TODOs). Manual review required.
- tapOn:
    text: Login
- TODO_UNSUPPORTED_ACTION: 'Unsupported control flow: If statement (Suggestion: Unroll loops or use runScript for simple logic)'
```

**You must manually review the generated YAML files and address any `TODO` items.**

## Author

[Dhiraj Das](https://www.dhirajdas.dev) · [Follow @dkkkkd on X](https://x.com/dkkkkd)
