Skip to content

Commit 02078b4

Browse files
Merge branch 'main' into fix-guardrails
2 parents dc97989 + a7ef878 commit 02078b4

2 files changed

Lines changed: 271 additions & 17 deletions

File tree

.github/workflows/integration_tests.yml

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: uipath - Integration Tests
22

33
on:
4-
push:
5-
branches: [ main, develop ]
64
pull_request:
75
branches: [ main ]
86

@@ -12,30 +10,71 @@ permissions:
1210
actions: read
1311

1412
jobs:
13+
detect-changed-packages:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
packages: ${{ steps.detect.outputs.packages }}
17+
count: ${{ steps.detect.outputs.count }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.11'
28+
29+
- name: Detect changed packages
30+
id: detect
31+
env:
32+
GITHUB_EVENT_NAME: ${{ github.event_name }}
33+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
34+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
35+
run: python .github/scripts/detect_changed_packages.py
36+
1537
discover-testcases:
38+
needs: [detect-changed-packages]
39+
if: needs.detect-changed-packages.outputs.count > 0
1640
runs-on: ubuntu-latest
1741
outputs:
1842
testcases: ${{ steps.discover.outputs.testcases }}
43+
count: ${{ steps.discover.outputs.count }}
1944
steps:
2045
- name: Checkout code
2146
uses: actions/checkout@v4
2247

2348
- name: Discover testcases
2449
id: discover
25-
working-directory: packages/uipath
50+
env:
51+
PACKAGES: ${{ needs.detect-changed-packages.outputs.packages }}
2652
run: |
27-
# Find all testcase folders (excluding common folders like README, etc.)
28-
testcase_dirs=$(find testcases -maxdepth 1 -type d -name "*-*" | sed 's|testcases/||' | sort)
29-
30-
echo "Found testcase directories:"
31-
echo "$testcase_dirs"
53+
# Discover testcases from all affected packages
54+
all_testcases="[]"
55+
56+
for package in $(echo "$PACKAGES" | jq -r '.[]'); do
57+
testcases_dir="packages/$package/testcases"
58+
if [ -d "$testcases_dir" ]; then
59+
testcase_dirs=$(find "$testcases_dir" -maxdepth 1 -type d -name "*-*" | sed "s|$testcases_dir/||" | sort)
60+
if [ -n "$testcase_dirs" ]; then
61+
echo "Found testcases in $package:"
62+
echo "$testcase_dirs"
63+
# Add as package/testcase entries
64+
package_testcases=$(echo "$testcase_dirs" | jq -R -c --arg pkg "$package" '{package: $pkg, testcase: .}')
65+
all_testcases=$(echo "$all_testcases" | jq -c --argjson new "[$( echo "$package_testcases" | paste -sd, )]" '. + $new')
66+
fi
67+
fi
68+
done
3269
33-
# Convert to JSON array for matrix
34-
testcases_json=$(echo "$testcase_dirs" | jq -R -s -c 'split("\n")[:-1]')
35-
echo "testcases=$testcases_json" >> $GITHUB_OUTPUT
70+
echo "All testcases: $all_testcases"
71+
count=$(echo "$all_testcases" | jq 'length')
72+
echo "testcases=$all_testcases" >> $GITHUB_OUTPUT
73+
echo "count=$count" >> $GITHUB_OUTPUT
3674
3775
integration-tests:
3876
needs: [discover-testcases]
77+
if: needs.discover-testcases.outputs.count > 0
3978
runs-on: ubuntu-latest
4079
container:
4180
image: ghcr.io/astral-sh/uv:python3.12-bookworm
@@ -48,14 +87,14 @@ jobs:
4887
testcase: ${{ fromJson(needs.discover-testcases.outputs.testcases) }}
4988
environment: [alpha, cloud, staging]
5089

51-
name: "${{ matrix.testcase }} / ${{ matrix.environment }}"
90+
name: "${{ matrix.testcase.testcase }} / ${{ matrix.environment }}"
5291

5392
steps:
5493
- name: Checkout code
5594
uses: actions/checkout@v4
5695

5796
- name: Install dependencies
58-
working-directory: packages/uipath
97+
working-directory: packages/${{ matrix.testcase.package }}
5998
run: uv sync
6099

61100
- name: Run testcase
@@ -70,12 +109,13 @@ jobs:
70109
TELEMETRY_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }}
71110
APP_INSIGHTS_APP_ID: ${{ secrets.APP_INSIGHTS_APP_ID }}
72111
APP_INSIGHTS_API_KEY: ${{ secrets.APP_INSIGHTS_API_KEY }}
73-
working-directory: packages/uipath/testcases/${{ matrix.testcase }}
112+
working-directory: packages/${{ matrix.testcase.package }}/testcases/${{ matrix.testcase.testcase }}
74113
run: |
75114
# If any errors occur execution will stop with exit code
76115
set -e
77116
78-
echo "Running testcase: ${{ matrix.testcase }}"
117+
echo "Running testcase: ${{ matrix.testcase.testcase }}"
118+
echo "Package: ${{ matrix.testcase.package }}"
79119
echo "Environment: ${{ matrix.environment }}"
80120
echo "Working directory: $(pwd)"
81121
@@ -84,12 +124,20 @@ jobs:
84124
bash ../common/validate_output.sh
85125
86126
summarize-results:
87-
needs: [integration-tests]
127+
needs: [detect-changed-packages, discover-testcases, integration-tests]
88128
runs-on: ubuntu-latest
89-
if: always() # This ensures the job runs even if the tests fail
129+
if: always()
90130
steps:
91131
- name: Check integration tests status
92132
run: |
133+
if [[ "${{ needs.detect-changed-packages.outputs.count }}" == "0" ]]; then
134+
echo "No packages changed - skipping integration tests"
135+
exit 0
136+
fi
137+
if [[ "${{ needs.discover-testcases.outputs.count }}" == "0" ]]; then
138+
echo "No testcases found for changed packages - skipping"
139+
exit 0
140+
fi
93141
if [[ "${{ needs.integration-tests.result }}" == "success" ]]; then
94142
echo "All integration tests passed"
95143
else

README.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# UiPath Python SDK
2+
3+
[![PyPI downloads](https://img.shields.io/pypi/dm/uipath.svg)](https://pypi.org/project/uipath/)
4+
[![PyPI - Version](https://img.shields.io/pypi/v/uipath)](https://img.shields.io/pypi/v/uipath)
5+
[![Python versions](https://img.shields.io/pypi/pyversions/uipath.svg)](https://pypi.org/project/uipath/)
6+
7+
A Python SDK that enables programmatic interaction with UiPath Cloud Platform services including processes, assets, buckets, context grounding, data services, jobs, and more. The package also features a CLI for creation, packaging, and deployment of automations to UiPath Cloud Platform.
8+
9+
Use the [UiPath LangChain SDK](https://github.com/UiPath/uipath-langchain-python) to pack and publish LangGraph Agents.
10+
11+
Check out other [UiPath Integrations](https://github.com/UiPath/uipath-integrations-python) to pack and publish agents built with LlamaIndex, OpenAI Agents, Google ADK, and more.
12+
13+
This [quickstart guide](https://uipath.github.io/uipath-python/) walks you through deploying your first agent to UiPath Cloud Platform.
14+
15+
## Table of Contents
16+
17+
- [Installation](#installation)
18+
- [Configuration](#configuration)
19+
- [Environment Variables](#environment-variables)
20+
- [Basic Usage](#basic-usage)
21+
- [Available Services](#available-services)
22+
- [Examples](#examples)
23+
- [Buckets Service](#buckets-service)
24+
- [Context Grounding Service](#context-grounding-service)
25+
- [Command Line Interface (CLI)](#command-line-interface-cli)
26+
- [Authentication](#authentication)
27+
- [Initialize a Project](#initialize-a-project)
28+
- [Debug a Project](#debug-a-project)
29+
- [Package a Project](#package-a-project)
30+
- [Publish a Package](#publish-a-package)
31+
- [Project Structure](#project-structure)
32+
- [Development](#development)
33+
- [Setting Up a Development Environment](#setting-up-a-development-environment)
34+
35+
## Installation
36+
37+
```bash
38+
pip install uipath
39+
```
40+
41+
using `uv`:
42+
43+
```bash
44+
uv add uipath
45+
```
46+
47+
## Configuration
48+
49+
### Environment Variables
50+
51+
Create a `.env` file in your project root with the following variables:
52+
53+
```
54+
UIPATH_URL=https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME
55+
UIPATH_ACCESS_TOKEN=YOUR_TOKEN_HERE
56+
```
57+
58+
## Basic Usage
59+
60+
```python
61+
from uipath.platform import UiPath
62+
# Initialize the SDK
63+
sdk = UiPath()
64+
# Execute a process
65+
job = sdk.processes.invoke(
66+
name="MyProcess",
67+
input_arguments={"param1": "value1", "param2": 42}
68+
)
69+
# Work with assets
70+
asset = sdk.assets.retrieve(name="MyAsset")
71+
```
72+
73+
## Available Services
74+
75+
The SDK provides access to various UiPath services:
76+
77+
- `sdk.processes` - Manage and execute UiPath automation processes
78+
79+
- `sdk.assets` - Work with assets (variables, credentials) stored in UiPath
80+
81+
- `sdk.buckets` - Manage cloud storage containers for automation files
82+
83+
- `sdk.connections` - Handle connections to external systems
84+
85+
- `sdk.context_grounding` - Work with semantic contexts for AI-enabled automation
86+
87+
- `sdk.jobs` - Monitor and manage automation jobs
88+
89+
- `sdk.queues` - Work with transaction queues
90+
91+
- `sdk.tasks` - Work with Action Center
92+
93+
- `sdk.api_client` - Direct access to the API client for custom requests
94+
95+
## Examples
96+
97+
### Buckets Service
98+
99+
```python
100+
# Download a file from a bucket
101+
sdk.buckets.download(
102+
bucket_key="my-bucket",
103+
blob_file_path="path/to/file.xlsx",
104+
destination_path="local/path/file.xlsx"
105+
)
106+
```
107+
108+
### Context Grounding Service
109+
110+
```python
111+
# Search for contextual information
112+
results = sdk.context_grounding.search(
113+
name="my-knowledge-index",
114+
query="How do I process an invoice?",
115+
number_of_results=5
116+
)
117+
```
118+
119+
## Command Line Interface (CLI)
120+
121+
The SDK also provides a command-line interface for creating, packaging, and deploying automations:
122+
123+
### Authentication
124+
125+
```bash
126+
uipath auth
127+
```
128+
129+
This command opens a browser for authentication and creates/updates your `.env` file with the proper credentials.
130+
131+
### Initialize a Project
132+
133+
```bash
134+
uipath init
135+
```
136+
137+
The `uipath.json` file should include your entry points in the `functions` section:
138+
```json
139+
{
140+
"functions": {
141+
"main": "main.py:main"
142+
}
143+
}
144+
```
145+
146+
Running `uipath init` will process these function definitions and create the corresponding `entry-points.json` file needed for deployment.
147+
148+
For more details on the configuration format, see the [UiPath configuration specifications](specs/README.md).
149+
150+
### Debug a Project
151+
152+
```bash
153+
uipath run ENTRYPOINT [INPUT]
154+
```
155+
156+
Executes a Python script with the provided JSON input arguments.
157+
158+
### Package a Project
159+
160+
```bash
161+
uipath pack
162+
```
163+
164+
Packages your project into a `.nupkg` file that can be deployed to UiPath.
165+
166+
**Note:** Your `pyproject.toml` must include:
167+
168+
- A description field (avoid characters: &, <, >, ", ', ;)
169+
- Author information
170+
171+
Example:
172+
173+
```toml
174+
description = "Your package description"
175+
authors = [{name = "Your Name", email = "your.email@example.com"}]
176+
```
177+
178+
### Publish a Package
179+
180+
```bash
181+
uipath publish
182+
```
183+
184+
Publishes the most recently created package to your UiPath Orchestrator.
185+
186+
## Project Structure
187+
188+
To properly use the CLI for packaging and publishing, your project should include:
189+
190+
- A `pyproject.toml` file with project metadata
191+
- A `uipath.json` file with your function definitions (e.g., `"functions": {"main": "main.py:main"}`)
192+
- A `entry-points.json` file (generated by `uipath init`)
193+
- A `bindings.json` file (generated by `uipath init`) to configure resource overrides
194+
- Any Python files needed for your automation
195+
196+
197+
## Development
198+
199+
### Tools
200+
201+
Check out [uipath-dev](https://github.com/uipath/uipath-dev-python) - an interactive application for building, testing, and debugging UiPath Python runtimes, agents, and automation scripts.
202+
203+
### Contributions
204+
205+
Please read our [contribution guidelines](https://github.com/UiPath/uipath-integrations-python/blob/main/CONTRIBUTING.md) before submitting a pull request.
206+

0 commit comments

Comments
 (0)