File-Upload-RPA 🚀
Automated, vision-based file upload package and CLI tool for desktop RPA using PyAutoGUI, PyGetWindow, and Computer Vision.
This tool brings Microsoft Edge to the foreground, locates upload button templates on the screen using computer vision (confidence-based template matching), clicks through an arbitrary sequence of buttons (such as dialog triggers, file choose buttons, etc.), and automatically types in the file path to complete the file manager upload flow.
📑 Table of Contents
- Features
- Architecture & Workflow
- 👤 1. User Guide
- 🛠️ 2. Developer & Contributor Guide
- 🚀 3. Package Publisher & DevOps Guide
- License
Features
- CLI Tool: Runs directly from your terminal as
file-upload-rpaafter installation. - Window Management: Automatically detects, un-minimizes, and focuses Microsoft Edge.
- Vision-Based Template Matching: Locates buttons on screen with 80% confidence (
confidence=0.8). - Arbitrary Button Sequences: Supports 1, 2, or any number of sequential button clicks for complex upload wizards.
- Bundled Assets: Default button templates are packaged inside the wheel so defaults work anywhere on your machine.
- Flexible Argument Parsing: Accepts paths as positional arguments or named flags (
-f/--file,-b/--buttons). - OS File Dialogue Automation: Automatically types absolute file paths into the native dialog and confirms.
- Continuous Integration & Auto-Publishing: Full GitHub Actions suite with automatic PyPI deployment on version increment.
Architecture & Workflow
flowchart TD
A[Start: file-upload-rpa] --> B[Parse CLI Arguments or Defaults]
B --> C[Focus / Un-minimize Edge Window]
C --> D[Validate Target File Exists on Disk]
D -->|Not Found| E[Exit with error code 1]
D -->|Found| F[Iterate over Button Templates in Sequence]
F --> G[Locate Button on Screen with PyAutoGUI confidence=0.8]
G -->|Found| H[Click Button Center & Wait 4s]
G -->|Not Found| I[Print Error & Abort Flow]
H -->|More Buttons| F
H -->|All Buttons Clicked| J[Wait 4s for File Dialog]
J --> K[Type Absolute File Path into Dialog]
K --> L[Press Enter to Confirm Upload]
L --> M[Flow Completed Successfully]
👤 1. User Guide
This section is for users who want to install and use file-upload-rpa to automate file uploads on their Windows desktop.
Installation
Install the latest release directly from PyPI:
pip install file-upload-rpa
Or install the latest development branch directly from GitHub:
pip install git+https://github.com/ishandutta2007/file-upload-rpa.git
Requirements: Windows 10/11, Python 3.8+, and Microsoft Edge. Recommended Windows Display Scaling set to 100%.
CLI Reference
You can invoke the CLI tool in three equivalent ways:
# 1. Direct CLI command (recommended)
file-upload-rpa [options] [file_path] [buttons ...]
# 2. Python module runner
python -m file_upload_rpa [options] [file_path] [buttons ...]
# 3. Source script runner
python file-upload-RPA.py [options] [file_path] [buttons ...]
Arguments & Options
| Option / Argument | Type | Default | Description |
|---|---|---|---|
file_path |
Positional | <cwd>\assets\social-preview.gif |
Path to the file to upload. |
buttons |
Positional | Bundled upload_button1.png, upload_button2.png |
One or more button template image paths to click in sequence. |
-f, --file |
Flag | None | Explicit flag for the file to upload. |
-b, --buttons |
Flag | None | Explicit flag for one or more button template paths. |
-v, --version |
Flag | None | Display installed package version and exit. |
-h, --help |
Flag | None | Display command-line options and help manual. |
Usage Examples
Example 1: Run with Defaults (Zero Arguments)
Uses the default target file (<cwd>\assets\social-preview.gif) and default button templates:
file-upload-rpa
Example 2: Custom Upload File with Default Buttons
Specify the file path as the first positional argument:
file-upload-rpa "C:\Users\username\Pictures\avatar.png"
Example 3: Custom File and Custom Button Sequence (Positional)
Pass the upload file first, followed by any number of button image paths:
file-upload-rpa "C:\documents\report.pdf" "assets\step1.png" "assets\step2.png"
Example 4: Custom Buttons with Default File (Named Flag)
Keep the default upload file, but supply custom button templates using -b:
file-upload-rpa --buttons "assets\click_upload.png" "assets\confirm_upload.png"
Example 5: Full Named Flags (-f and -b)
Explicitly label both the file path and button templates:
file-upload-rpa -f "C:\data\table.xlsx" -b "templates\btn1.png" "templates\btn2.png"
Example 6: Single-Button Flow
For dialogs requiring only a single click before the file chooser opens:
file-upload-rpa "C:\images\banner.jpg" "single_button.png"
Example 7: Multi-Step Button Wizard (3+ Buttons)
For multi-step flows navigating through multiple screens:
file-upload-rpa "C:\archive.zip" "step1.png" "step2.png" "step3.png" "step4.png"
Example 8: Check Version and Help
file-upload-rpa --version
file-upload-rpa --help
Python Library API
You can also integrate file-upload-rpa into your own Python applications:
from file_upload_rpa import vision_upload_flow, focus_edge_window
# 1. Bring Microsoft Edge to the foreground
focus_edge_window()
# 2. Run with defaults
vision_upload_flow()
# 3. Run with custom file and buttons
vision_upload_flow(
file_path=r"C:\Users\username\Documents\presentation.pptx",
buttons=["step1.png", "step2.png"],
focus_window=True
)
Tips for Vision Matching
- Display Scaling: Set Windows display scaling to 100% (Settings > Display > Scale) for maximum template recognition accuracy.
- Crop Tight: Crop button templates tightly around unique button borders or text, omitting large plain backgrounds.
- Keep Target Window Unobscured: Ensure the target window is completely visible and not covered by other windows during automation.
- Theme Consistency: If template screenshots were captured in dark mode, the browser must be in dark mode during execution (and vice versa).
Troubleshooting
Error: Target file not found at <path>: The path provided does not exist on disk. Check for typos or verify the file path.Error: Could not find the button <index>.<name> image on the screen.:- Verify Microsoft Edge is open and visible on screen.
- Re-crop your button template image at your current monitor resolution.
- Verify
opencv-pythonis installed (pip install opencv-python).
- Edge window not focusing: Ensure Microsoft Edge is running with "Edge" in its window title before running the script.
🛠️ 2. Developer & Contributor Guide
This section is for developers who want to set up the codebase locally, run tests, lint, and contribute changes.
Prerequisites
- Python 3.8 or higher (Python 3.11+ recommended).
- Git.
- Windows environment (required for PyGetWindow and PyAutoGUI GUI automation).
Setting Up Local Development
-
Clone the repository:
git clone https://github.com/ishandutta2007/file-upload-rpa.git cd file-upload-rpa
-
Create and activate a virtual environment:
python -m venv .venv .\.venv\Scripts\Activate.ps1
-
Install the package in editable mode along with development tools:
python -m pip install --upgrade pip pip install -e . pip install ruff build twine
Project Layout
file-upload-rpa/
├── .github/
│ └── workflows/
│ ├── ci.yml # CI: Linting & multi-version build matrix
│ └── publish.yml # Auto-publish: PyPI publishing on version increment
├── src/
│ └── file_upload_rpa/
│ ├── __init__.py # Public package exports
│ ├── __main__.py # CLI module entry point (`python -m file_upload_rpa`)
│ ├── __version__.py # Dynamic version resolver
│ ├── cli.py # Argument parsing and CLI dispatch
│ ├── uploader.py # Vision automation engine
│ ├── py.typed # PEP 561 typing marker
│ └── assets/ # Bundled default template images
│ ├── upload_button1.png
│ └── upload_button2.png
├── file-upload-RPA.py # Root backward-compatibility wrapper
├── pyproject.toml # Package metadata, dependencies, entry points
├── setup.py # Setuptools compatibility shim
├── requirements.txt # Pinned dependencies
├── LICENSE # MIT License
└── README.md # Documentation
Code Quality & Linting
This project uses Ruff for linting and code formatting:
# Run the linter
ruff check src/ file-upload-RPA.py
# Automatically fix linting issues where possible
ruff check --fix src/ file-upload-RPA.py
# Check code formatting
ruff format --check src/ file-upload-RPA.py
# Format code
ruff format src/ file-upload-RPA.py
Testing Locally
-
Verify CLI binary in editable mode:
file-upload-rpa --help file-upload-rpa --version
-
Verify Python module execution:
python -m file_upload_rpa --version
-
Verify distribution packaging:
python -m build twine check --strict dist/*
Contributing Flow
- Fork the repository and create your feature branch:
git checkout -b feature/my-new-feature
- Make your changes and ensure
ruff checkandruff formatpass. - Build and validate distributions locally using
python -m build && twine check --strict dist/*. - Commit your changes with descriptive messages:
git commit -m "Add feature X"
- Push to your branch and submit a Pull Request to
main. - GitHub Actions CI will automatically run the lint and build validation matrix across Python 3.8 - 3.12.
🚀 3. Package Publisher & DevOps Guide
This section is for maintainers and DevOps engineers managing PyPI publishing and version releases.
Automated PyPI Publishing Overview
The repository is configured with an automated GitHub Actions pipeline in .github/workflows/publish.yml.
Whenever changes are pushed to main, the workflow automatically:
- Reads the version defined in
pyproject.toml. - Queries the PyPI JSON API to check if that exact version is already published on PyPI.
- If the version is NEW (incremented):
- Automatically builds the Source Distribution (
.tar.gz) and Universal Wheel (.whl). - Validates package integrity using
twine check --strict. - Publishes the package to PyPI.
- Generates a Git tag (e.g.
v0.1.1) and creates an official GitHub Release with distribution assets attached.
- Automatically builds the Source Distribution (
- If the version is ALREADY on PyPI:
- The workflow logs a notice and safely skips publishing without failing the workflow.
flowchart TD
A[Push to main branch] --> B[Workflow: publish.yml]
B --> C[Extract version from pyproject.toml]
C --> D{Check PyPI API: is version on PyPI?}
D -->|Yes: Already Published| E[Log notice & Skip Publishing]
D -->|No: New Version!| F[Install build & twine]
F --> G[Build sdist & wheel]
G --> H[Validate artifacts with twine check]
H --> I[Publish to PyPI]
I --> J[Create Git Tag vX.Y.Z]
J --> K[Create GitHub Release with dist artifacts]
How Automated Version Publishing Works
Single Source of Truth: The version in pyproject.toml controls releases:
[project]
name = "file-upload-rpa"
version = "0.1.1" # <-- Increment this value to trigger publication
Because src/file_upload_rpa/__version__.py dynamically references package metadata, you only need to increment the version in pyproject.toml!
Configuring PyPI Authentication
You can authenticate with PyPI using either Trusted Publishing (OIDC) (recommended by PyPA) or a PyPI API Token.
Option A: Trusted Publishing via OIDC (Recommended)
PyPI Trusted Publishing allows GitHub Actions to publish without storing long-lived API tokens or passwords:
- Log in to pypi.org and go to your account settings.
- If the project already exists on PyPI:
- Navigate to Your Projects > file-upload-rpa > Publishing.
- Under Add a publisher, choose GitHub.
- If this is the first publication (project not yet created on PyPI):
- Go to PyPI Account Settings > Publishing.
- Under Add a pending publisher, specify:
- PyPI Project Name:
file-upload-rpa - Owner:
ishandutta2007 - Repository name:
File-Upload-RPA(match exact GitHub casing) - Workflow name:
publish.yml - Environment name: (leave completely blank)
- PyPI Project Name:
- Click Add publisher. No GitHub Secrets are needed! The workflow automatically uses GitHub's OpenID Connect (
id-token: write).
Option B: PyPI API Token via GitHub Secrets
If you prefer traditional API tokens:
- Log in to pypi.org and go to Account settings > API tokens.
- Click Add API token, give it a name (e.g.,
file-upload-rpa-github-actions), and set the scope to Entire account (for first release) or Project: file-upload-rpa (for existing releases). - Copy the token (starts with
pypi-...). - Go to your GitHub repository: Settings > Secrets and variables > Actions.
- Click New repository secret:
- Name:
PYPI_API_TOKEN - Value: Paste your PyPI token.
- Name:
- Click Add secret. The workflow detects
PYPI_API_TOKENand uses it automatically.
Step-by-Step Release Process
To release a new version of file-upload-rpa:
-
Increment the version in
pyproject.toml:[project] name = "file-upload-rpa" version = "0.1.1" # Change from 0.1.0 to 0.1.1
-
Commit and push to
main:git add pyproject.toml git commit -m "Bump version to 0.1.1" git push origin main
-
Monitor the workflow:
- Go to the Actions tab in your GitHub repository.
- Click the Publish to PyPI workflow run.
- The workflow detects the new version, builds the wheel and sdist, uploads to PyPI, tags
v0.1.1, and creates a GitHub Release!
-
Verify on PyPI:
- Visit https://pypi.org/project/file-upload-rpa/ to see the newly published version.
Manual Workflow Dispatch
You can also trigger a build manually from the GitHub UI:
- Navigate to Actions > Publish to PyPI.
- Click Run workflow.
- (Optional) Check Force publish even if version already exists on PyPI if you want to bypass the duplicate version check.
- Click Run workflow.
Manual Local Publishing
If you ever need to publish manually from your local machine:
-
Install build tools:
pip install build twine
-
Clean previous artifacts and build:
Remove-Item -Recurse -Force dist, build python -m build
-
Validate distributions:
twine check --strict dist/*
-
Upload to TestPyPI (optional verification):
twine upload --repository testpypi dist/*
-
Upload to PyPI:
twine upload dist/*
License
This project is licensed under the MIT License.
Metadata
Release files for file-upload-rpa 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| file_upload_rpa-0.1.0.tar.gz | 22.1 kB | With provenance | Details for file_upload_rpa-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| file_upload_rpa-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for file_upload_rpa-0.1.0-py3-none-any.whl |
Total release size: 38.4 kB
Release files / file_upload_rpa-0.1.0.tar.gz
| Download URL | file_upload_rpa-0.1.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7bed34e8a0a46c03c6c44ee1ce47ce89ac610e796a962252650f5265354fad6
|
|
BLAKE2b-256 checksum How to use checksums |
a4f3cf60e6ff918a2f6736ea9ceadb41a46925254e5cc0c6289447445497b8bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logRelease files / file_upload_rpa-0.1.0-py3-none-any.whl
| Download URL | file_upload_rpa-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55e3c8369cb23825d5d53ec78bae7024d78f1a4721ffb1872b64129d703b4b53
|
|
BLAKE2b-256 checksum How to use checksums |
ba46b56eee349855b0b7fc8b56a8cb07659a837eef46fece659d5bcc30c92e20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logSecurity for file-upload-rpa 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for file_upload_rpa-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.