diff --git a/.cursorrules b/.cursorrules deleted file mode 100644 index 8447a7ae..00000000 --- a/.cursorrules +++ /dev/null @@ -1,55 +0,0 @@ -You are an AI assistant specialized in Python development, especially in a developing SDK and CLI for enterprise companies. Your strong background in debugging complex issues and optimizing code performance makes you an invaluable asset to this project. - -Your approach emphasizes: - -Clear project structure with separate directories for source code, tests, docs, and config. - -Modular design with distinct files for models, services, controllers, and utilities. - -Configuration management using environment variables. - -Robust error handling and logging, including context capture. - -Comprehensive testing with pytest. - -Detailed documentation using docstrings and README files. - -Dependency management via https://github.com/astral-sh/uv and virtual environments. - -Code style consistency using Ruff. - -CI/CD implementation with GitHub Actions. - -AI-friendly coding practices: - -You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development. - -This project utilizes the following technologies: -uv -ruff -httpx -tenacity -click -pydantic - - -Follow the following rules: - -For any python file, be sure to ALWAYS add typing annotations to each function or class. Be sure to include return types when necessary. Add descriptive docstrings to all python functions and classes as well that are public. Please use Google-style convention. Update existing docstrings if need be. When defining concepts, reference https://docs.uipath.com as the authoritative source. - -For core SDK function naming conventions: -- Use `retrieve` when getting a single resource by key (e.g., in UserService use `retrieve` not `retrieve_user`) -- Use `retrieve_by_[field]` when getting a resource by a field other than key -- Use `list` for getting multiple resources (e.g., in UserService use `list` not `list_users`) - -Make sure you keep any comments that exist in a file. - -When writing tests, make sure that you ONLY use pytest or pytest plugins, do NOT use the unittest module. All tests should have typing annotations as well. All tests should be in ./tests. Be sure to create all necessary files and folders. If you are creating files inside of ./tests or ./src/goob_ai, be sure to make a init.py file if one does not exist. - -All tests should be fully annotated and should contain docstrings. Be sure to import the following if TYPE_CHECKING: - -from _pytest.capture import CaptureFixture -from _pytest.fixtures import FixtureRequest -from _pytest.logging import LogCaptureFixture -from _pytest.monkeypatch import MonkeyPatch -from pytest_mock.plugin import MockerFixture diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 1d82ddff..00000000 --- a/.editorconfig +++ /dev/null @@ -1,14 +0,0 @@ -; https://editorconfig.org/ - -root = true - -[*] -indent_style = space -indent_size = 4 -insert_final_newline = true -trim_trailing_whitespace = true -end_of_line = lf -charset = utf-8 - -[*.{json,toml,yml}] -indent_size = 2 diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index c8f9eb86..00000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.db filter=lfs diff=lfs merge=lfs -text -**/cached_embeddings/** filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index cbe4c448..00000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: CD - -on: - workflow_dispatch: - push: - branches: - - main - paths: - - pyproject.toml - -jobs: - lint: - uses: ./.github/workflows/lint.yml - - test: - uses: ./.github/workflows/test.yml - - build: - name: Build - runs-on: ubuntu-latest - - needs: - - lint - - test - - if: ${{ github.repository == 'UiPath/uipath-python' }} - permissions: - contents: read - actions: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup uv - uses: astral-sh/setup-uv@v5 - with: - enable-cache: true - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version-file: ".python-version" - - - name: Install dependencies - run: uv sync --all-extras - - - name: Replace connection string placeholder - run: | - originalfile="src/uipath/telemetry/_constants.py" - tmpfile=$(mktemp) - trap 'rm -f "$tmpfile"' EXIT - - rsync -a --no-whole-file --ignore-existing "$originalfile" "$tmpfile" - envsubst '$CONNECTION_STRING' < "$originalfile" > "$tmpfile" && mv "$tmpfile" "$originalfile" - env: - CONNECTION_STRING: ${{ secrets.APPINS_CONNECTION_STRING }} - - - name: Build - run: uv build - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: release-dists - path: dist/ - - pypi-publish: - name: Upload release to PyPI - runs-on: ubuntu-latest - environment: pypi - - needs: - - build - permissions: - contents: read - id-token: write - - steps: - - name: Retrieve release distributions - uses: actions/download-artifact@v4 - with: - name: release-dists - path: dist/ - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 10192fb7..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: CI - -on: - push: - branches: - - main - paths-ignore: - - pyproject.toml - pull_request: - branches: - - main - -jobs: - commit-lint: - if: ${{ github.event_name == 'pull_request' }} - uses: ./.github/workflows/commitlint.yml - - lint: - uses: ./.github/workflows/lint.yml - - test: - uses: ./.github/workflows/test.yml diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml deleted file mode 100644 index 8562e455..00000000 --- a/.github/workflows/commitlint.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Commit Lint - -on: - workflow_call - -jobs: - commitlint: - name: Commit Lint - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 22 - - - name: Install Git - run: | - if ! command -v git &> /dev/null; then - echo "Git is not installed. Installing..." - sudo apt-get update - sudo apt-get install -y git - else - echo "Git is already installed." - fi - - - name: Install commitlint - run: | - npm install conventional-changelog-conventionalcommits - npm install commitlint@latest - npm install @commitlint/config-conventional - - - name: Configure - run: | - echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js - - - name: Validate PR commits with commitlint - run: | - git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch - npx commitlint --from ${{ github.event.pull_request.base.sha }} --to pr_branch --verbose diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index c37daeba..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Lint - -on: - workflow_call - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup uv - uses: astral-sh/setup-uv@v5 - with: - enable-cache: true - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version-file: ".python-version" - - - name: Install dependencies - run: uv sync --all-extras - - - name: Check static types - run: uv run mypy --config-file pyproject.toml . - - - name: Check linting - run: uv run ruff check . - - - name: Check formatting - run: uv run ruff format --check . - diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml deleted file mode 100644 index bbc95dbd..00000000 --- a/.github/workflows/publish-dev.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Publish Dev Build - -on: - pull_request: - types: [opened, synchronize, reopened, labeled] - -jobs: - publish-dev: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - - # Only run if PR has the build:dev label - if: contains(github.event.pull_request.labels.*.name, 'build:dev') - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup uv - uses: astral-sh/setup-uv@v5 - with: - enable-cache: true - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version-file: ".python-version" - - - name: Install dependencies - run: uv sync --all-extras - - - name: Replace connection string placeholder - run: | - originalfile="src/uipath/telemetry/_constants.py" - tmpfile=$(mktemp) - trap 'rm -f "$tmpfile"' EXIT - - rsync -a --no-whole-file --ignore-existing "$originalfile" "$tmpfile" - envsubst '$CONNECTION_STRING' < "$originalfile" > "$tmpfile" && mv "$tmpfile" "$originalfile" - env: - CONNECTION_STRING: ${{ secrets.APPINS_CONNECTION_STRING }} - - - name: Set development version - shell: pwsh - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - $pyprojcontent = Get-Content pyproject.toml -Raw - - $PROJECT_NAME = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?name\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value - $CURRENT_VERSION = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?version\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value - - - # Get PR number and run number with proper padding - $PR_NUM = [int]"${{ github.event.pull_request.number }}" - $PADDED_PR = "{0:D5}" -f [int]"${{ github.event.pull_request.number }}" - $PADDED_RUN = "{0:D4}" -f [int]"${{ github.run_number }}" - $PADDED_NEXT_PR = "{0:D5}" -f ($PR_NUM + 1) - - # Create version range strings for PR - $MIN_VERSION = "$CURRENT_VERSION.dev1$PADDED_PR" + "0000" - $MAX_VERSION = "$CURRENT_VERSION.dev1$PADDED_NEXT_PR" + "0000" - - # Create unique dev version with PR number and run ID - $DEV_VERSION = "$CURRENT_VERSION.dev1$PADDED_PR$PADDED_RUN" - - # Update version in pyproject.toml - (Get-Content pyproject.toml) -replace "version = `"$CURRENT_VERSION`"", "version = `"$DEV_VERSION`"" | Set-Content pyproject.toml - - Write-Output "Package version set to $DEV_VERSION" - - $dependencyMessage = @" - ## Development Package - - - Add this package as a dependency in your pyproject.toml: - - ``````toml - [project] - dependencies = [ - # Exact version: - "$PROJECT_NAME==$DEV_VERSION", - - # Any version from PR - "$PROJECT_NAME>=$MIN_VERSION,<$MAX_VERSION" - ] - - [[tool.uv.index]] - name = "testpypi" - url = "https://test.pypi.org/simple/" - publish-url = "https://test.pypi.org/legacy/" - explicit = true - - [tool.uv.sources] - $PROJECT_NAME = { index = "testpypi" } - `````` - "@ - - # Get the owner and repo from the GitHub repository - $owner = "${{ github.repository_owner }}" - $repo = "${{ github.repository }}".Split('/')[1] - $prNumber = $PR_NUM - - # Get the current PR description - $prUri = "https://api.github.com/repos/$owner/$repo/pulls/$prNumber" - $headers = @{ - Authorization = "token $env:GITHUB_TOKEN" - Accept = "application/vnd.github.v3+json" - } - - $pr = Invoke-RestMethod -Uri $prUri -Method Get -Headers $headers - $currentBody = $pr.body - - # Check if there's already a development package section - if ($currentBody -match '## Development Package') { - # Replace the existing section with the new dependency message - $newBody = $currentBody -replace '## Development Package(\r?\n|.)*?(?=##|$)', $dependencyMessage - } else { - # Append the dependency message to the end of the description - $newBody = if ($currentBody) { "$currentBody`n`n$dependencyMessage" } else { $dependencyMessage } - } - - # Update the PR description - $updateBody = @{ - body = $newBody - } | ConvertTo-Json - - Invoke-RestMethod -Uri $prUri -Method Patch -Headers $headers -Body $updateBody -ContentType "application/json" - - Write-Output "Updated PR description with development package information" - - - name: Build package - run: uv build - - - name: Publish - run: uv publish --index testpypi - env: - UV_PUBLISH_TOKEN: ${{ secrets.TESTPYPI_TOKEN }} - diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml deleted file mode 100644 index cf18e8cd..00000000 --- a/.github/workflows/publish-docs.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Publish Docs - -on: - workflow_dispatch: - push: - branches: - - main - paths: - - "docs/**" - - "mkdocs.yml" - - "pyproject.toml" - repository_dispatch: - types: [publish-docs] - -jobs: - publish-docs: - runs-on: ubuntu-latest - if: ${{ github.repository == 'UiPath/uipath-python' }} - permissions: - contents: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup uv - uses: astral-sh/setup-uv@v5 - with: - enable-cache: true - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version-file: ".python-version" - - - name: Install dependencies - run: uv sync --all-extras - - - name: Clone plugins - run: | - git clone https://x-access-token:${{ secrets.REPO_ACCESS }}@github.com/UiPath/uipath-langchain-python plugins/uipath-langchain-python - - - name: Symlink plugin docs - run: | - mkdir -p docs/plugins - ln -s ../../plugins/uipath-langchain-python docs/plugins/uipath-langchain-python - - - name: Publish Docs - run: uv run mkdocs gh-deploy --force diff --git a/.github/workflows/slack.yml b/.github/workflows/slack.yml deleted file mode 100644 index 493d43a2..00000000 --- a/.github/workflows/slack.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: GitHub Reviewer Slack Agent - -on: - pull_request: - types: [opened] - -jobs: - trigger-uipath-agent: - runs-on: ubuntu-latest - steps: - - name: Install Python dependencies - run: pip install requests - - - name: Trigger UiPath Agent - env: - PR_NUMBER: ${{ github.event.number }} - REPO_NAME: ${{ github.repository }} - OWNER_NAME: ${{ github.repository_owner }} - run: | - python -c "import requests; import json; import os; comment = {'messages': [{'role': 'user', 'content': f'You are reviewing PR #{os.environ['PR_NUMBER']}, repo: {os.environ['REPO_NAME']}, owner: {os.environ['OWNER_NAME']}'}]}; payload = json.dumps(comment); resp = requests.post('${{ secrets.UIPATH_SLACK_URL }}/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs', headers={'Authorization': 'Bearer ${{ secrets.UIPATH_SLACK_PAT }}', 'Content-Type': 'application/json', 'X-UiPath-FolderPath': 'MCP Folder'}, json={'startInfo': {'releaseName': 'github-slack-agent', 'inputArguments': payload}}); print(f'Status code: {resp.status_code}'); print(f'Response: {resp.text}')" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 5c2881e0..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Test - -on: - workflow_call - -jobs: - test: - name: Test - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] - os: [ubuntu-latest, windows-latest] - - permissions: - contents: read - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup uv - uses: astral-sh/setup-uv@v5 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version-file: ".python-version" - - - name: Install dependencies - run: uv sync --all-extras - - - name: Run tests - run: uv run pytest - - continue-on-error: true - diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8fa9087e..00000000 --- a/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -# Python-generated files -__pycache__/ -*.py[oc] -build/ -dist/ -wheels/ -*.egg-info - -.coverage -.coverage/ -.coverage/* - -# Virtual environments -.venv -**/.env -**/uipath.db -**/.uipath -**/**.nupkg -**/uipath.json -**/__uipath/ - -**/playground.py -**/.idea - -**/docs/index.md -**/docs/plugins/* -**/docs/plugins/.* -**/docs/quick_start_images/* -**/docs/quick_start_images/.* - -.cache/* -.cache \ No newline at end of file diff --git a/py.typed b/.nojekyll similarity index 100% rename from py.typed rename to .nojekyll diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 7043ff86..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,7 +0,0 @@ -repos: -- repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.6 - hooks: - - id: ruff - args: [ --fix ] - - id: ruff-format diff --git a/.python-version b/.python-version deleted file mode 100644 index c8cfe395..00000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.10 diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 7f3d57bc..00000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "recommendations": [ - "EditorConfig.editorconfig", // default - "ms-python.python", // intellisense - "charliermarsh.ruff" // linting & formatting - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 24a9e342..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "window.title": "${rootName}${separator}${activeEditorMedium}", - "files.exclude": { - "**/*.pyc": true, - "**/__pycache__": true, - ".pytest_cache": true, - ".mypy_cache": true, - ".ruff_cache": true, - ".venv": true - }, - // Formatting - "editor.formatOnSave": true, - "[python]": { - "editor.defaultFormatter": "charliermarsh.ruff", - "editor.codeActionsOnSave": { - "source.organizeImports": "explicit" - } - }, - "workbench.colorCustomizations": { - "titleBar.activeBackground": "#0099cc", - "titleBar.inactiveBackground": "#0099cc" - }, - "python.testing.pytestArgs": [ - "tests" - ], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true -} \ No newline at end of file diff --git a/404.html b/404.html new file mode 100644 index 00000000..d11dd0cc --- /dev/null +++ b/404.html @@ -0,0 +1,933 @@ + + + +
+ + + + + + + + + + + + + + +Install Python ≥ 3.10:
+Alternative: mise
+Install uv: + Follow the official installation instructions for your operating system.
+Create a virtual environment in the current working directory: +
+Install dependencies: +
+For additional commands related to linting, formatting, and building, run just --list
.
Create a project directory: +
+Initialize the Python project: +
+Set the SDK path: +
+Install the SDK in editable mode: +
+++Note: Instead of cloning the project into
+.venv/lib/python3.10/site-packages/uipath
, this mode creates a file named_uipath.pth
inside.venv/lib/python3.10/site-packages
. This file contains the value ofPATH_TO_SDK
, which is added tosys.path
—the list of directories where Python searches for packages. To view the entries, runpython -c 'import sys; print(sys.path)'
.
key
instead of id
for resource identifiersretrieve
key
instead of id
)retrieve_by_[field_name]
(for fields other than key
)list
create
update
{
+ "Code": "Serverless.PythonCodedAgent.PrepareEnvironmentError",
+ "Title": "Failed to prepare environment",
+ "Detail": "An error occurred while installing the package dependencies. Please try again. If the error persists, please contact support.",
+ "Category": "System",
+ "Status": null
+}
+
+
Example of the error as it appears in UiPath Cloud Platform
+This error might occur when deploying coded-agents to UiPath Cloud Platform, even though the same project might work correctly in your local environment. The issue is often related to how Python packages are discovered and distributed during the cloud deployment process.
+src
layout)project_root/
+├── src/
+│ └── your_package/
+│ ├── __init__.py
+│ └── your_modules.py
+├── pyproject.toml
+└── setup.cfg/setup.py
+
If you need to maintain your current project structure, you can configure custom package discovery in your pyproject.toml
:
requirements.txt
or pyproject.toml
For more detailed information about package discovery and configuration, refer to the official setuptools documentation.
+Note: This FAQ will be updated as new information becomes available. If you continue experiencing issues after following these solutions, please contact UiPath support.
+ + + + + + + + + + + + + + + + +