Getting Started¶
Prerequisites¶
- Python 3.10 or higher
pip
oruv
package manager- A UiPath Cloud Platform account with appropriate permissions
Getting Started with the CLI¶
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
# Activate the virtual environment# For Windows PowerShell: .venv\Scripts\Activate.ps1# For Windows Bash: source .venv/Scripts/activatesource .venv/bin/activate# Install the uipath packageuv add uipath# Verify the uipath installationuipath --versionuipath version 2.0.29
Telemetry¶
To help us improve the developer experience, the CLI collects basic usage data about commands invocation. For more details about UiPathβs privacy practices, please review the privacy statement.
Disabling telemetry data¶
Telemetry is enabled by default, yet it is possible to opt-out by setting to false
the UIPATH_TELEMETRY_ENABLED
environment variable.
Authentication¶
To debug your script locally and publish your project, you need to authenticate with UiPath:
π If a browser window did not open, please open the following URL in your browser: [LINK]
π Select tenant:
0: Tenant1
1: Tenant2
Select tenant number: 0
Selected tenant: Tenant1
β Authentication successful.
This command opens a new browser window for authentication. If you encounter any issues, copy the URL from the terminal and paste it into your browser. After authentication, select your tenant by entering its corresponding number in the terminal.
Upon successful authentication, your project will contain a .env
file with your access token, UiPath URL, and other configuration details.
Writing Your Code¶
Open main.py
in your code editor. You can start with this example code:
from dataclasses import dataclass
from typing import Optional
@dataclass
class EchoIn:
message: str
repeat: Optional[int] = 1
prefix: Optional[str] = None
@dataclass
class EchoOut:
message: str
def main(input: EchoIn) -> EchoOut:
result = []
for _ in range(input.repeat or 1):
line = input.message
if input.prefix:
line = f"{input.prefix}: {line}"
result.append(line)
return EchoOut(message="\n".join(result))
Initializing the UiPath Project¶
To create a UiPath project, run the following command in your terminal:
β Created 'uipath.json' file.
Warning
The uipath init
command executes your main.py
file to analyze its structure and collect information about inputs and outputs.
This command creates a uipath.json
file containing the project metadata.
Packaging and Publishing¶
Before packaging your project, add your details to the pyproject.toml
file. Add the following line below the description
field:
Then, package your project:
Name : test
Version : 0.1.0
Description: Add your description here
Authors : Your Name
β Project successfully packaged.
Finally, publish your package:
π Select package feed:
0: Orchestrator Tenant Processes Feed
1: Orchestrator Personal Workspace Feed
Select feed number: 0
Selected feed: Orchestrator Tenant Processes Feed
β Έ Publishing most recent package: test.0.1.0.nupkg ...
β Package published successfully!
After selecting your publishing destination (tenant or personal workspace), you'll see details about your package and a confirmation message.
Getting Started with the SDK¶
Create a new project following the same steps as above.
Open main.py
in your code editor and add the following code:
from uipath import UiPath
def main():
sdk = UiPath()
sdk.processes.invoke(
"test",
input_arguments={
"message": "Hello, World!",
"repeat": 3,
"prefix": "[Echo]"
}
)
Verifying the Execution¶
Open your browser and navigate to UiPath. Go to the specified folder, where you'll see a new job for test
has been executed. The output will be: