Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit c6dac76

Browse files
committed
feat: add tracing module
0 parents  commit c6dac76

33 files changed

Lines changed: 2958 additions & 0 deletions

.cursorrules

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
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.
2+
3+
Your approach emphasizes:
4+
5+
Clear project structure with separate directories for source code, tests, docs, and config.
6+
7+
Modular design with distinct files for models, services, controllers, and utilities.
8+
9+
Configuration management using environment variables.
10+
11+
Robust error handling and logging, including context capture.
12+
13+
Comprehensive testing with pytest.
14+
15+
Detailed documentation using docstrings and README files.
16+
17+
Dependency management via https://github.com/astral-sh/uv and virtual environments.
18+
19+
Code style consistency using Ruff.
20+
21+
CI/CD implementation with GitHub Actions.
22+
23+
AI-friendly coding practices:
24+
25+
You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development.
26+
27+
This project utilizes the following technologies:
28+
uv
29+
ruff
30+
httpx
31+
tenacity
32+
click
33+
pydantic
34+
35+
36+
Follow the following rules:
37+
38+
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.
39+
40+
Make sure you keep any comments that exist in a file.
41+
42+
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.
43+
44+
All tests should be fully annotated and should contain docstrings. Be sure to import the following if TYPE_CHECKING:
45+
46+
from _pytest.capture import CaptureFixture
47+
from _pytest.fixtures import FixtureRequest
48+
from _pytest.logging import LogCaptureFixture
49+
from _pytest.monkeypatch import MonkeyPatch
50+
from pytest_mock.plugin import MockerFixture

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
end_of_line = lf
11+
charset = utf-8
12+
13+
[*.{json,toml,yml}]
14+
indent_size = 2

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.db filter=lfs diff=lfs merge=lfs -text
2+
**/cached_embeddings/** filter=lfs diff=lfs merge=lfs -text

.github/workflows/cd.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- pyproject.toml
10+
11+
jobs:
12+
lint:
13+
uses: ./.github/workflows/lint.yml
14+
15+
test:
16+
uses: ./.github/workflows/test.yml
17+
18+
build:
19+
name: Build
20+
runs-on: ubuntu-latest
21+
22+
needs:
23+
- lint
24+
- test
25+
26+
if: ${{ github.repository == 'UiPath/uipath-core-python' }}
27+
permissions:
28+
contents: read
29+
actions: write
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Setup uv
36+
uses: astral-sh/setup-uv@v5
37+
with:
38+
enable-cache: true
39+
40+
- name: Setup Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version-file: ".python-version"
44+
45+
- name: Install dependencies
46+
run: uv sync --all-extras
47+
48+
- name: Build
49+
run: uv build
50+
51+
- name: Upload artifacts
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: release-dists
55+
path: dist/
56+
57+
pypi-publish:
58+
name: Upload release to PyPI
59+
runs-on: ubuntu-latest
60+
environment: pypi
61+
62+
needs:
63+
- build
64+
permissions:
65+
contents: read
66+
id-token: write
67+
68+
steps:
69+
- name: Retrieve release distributions
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: release-dists
73+
path: dist/
74+
75+
- name: Publish package distributions to PyPI
76+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- pyproject.toml
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
commit-lint:
15+
if: ${{ github.event_name == 'pull_request' }}
16+
uses: ./.github/workflows/commitlint.yml
17+
18+
lint:
19+
uses: ./.github/workflows/lint.yml
20+
21+
test:
22+
uses: ./.github/workflows/test.yml

.github/workflows/commitlint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Commit Lint
2+
3+
on:
4+
workflow_call
5+
6+
jobs:
7+
commitlint:
8+
name: Commit Lint
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 22
23+
24+
- name: Install Git
25+
run: |
26+
if ! command -v git &> /dev/null; then
27+
echo "Git is not installed. Installing..."
28+
sudo apt-get update
29+
sudo apt-get install -y git
30+
else
31+
echo "Git is already installed."
32+
fi
33+
34+
- name: Install commitlint
35+
run: |
36+
npm install conventional-changelog-conventionalcommits
37+
npm install commitlint@latest
38+
npm install @commitlint/config-conventional
39+
40+
- name: Configure
41+
run: |
42+
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
43+
44+
- name: Validate PR commits with commitlint
45+
run: |
46+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
47+
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to pr_branch --verbose

.github/workflows/lint.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup uv
18+
uses: astral-sh/setup-uv@v5
19+
with:
20+
enable-cache: true
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version-file: ".python-version"
26+
27+
- name: Install dependencies
28+
run: uv sync --all-extras
29+
30+
- name: Check static types
31+
run: uv run mypy --config-file pyproject.toml .
32+
33+
- name: Check linting
34+
run: uv run ruff check .
35+
36+
- name: Check formatting
37+
run: uv run ruff format --check .
38+
39+

.github/workflows/publish-dev.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Publish Dev Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, labeled]
6+
7+
jobs:
8+
publish-dev:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
# Only run if PR has the build:dev label
15+
if: contains(github.event.pull_request.labels.*.name, 'build:dev')
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup uv
22+
uses: astral-sh/setup-uv@v5
23+
with:
24+
enable-cache: true
25+
26+
- name: Setup Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version-file: ".python-version"
30+
31+
- name: Install dependencies
32+
run: uv sync --all-extras
33+
34+
- name: Set development version
35+
shell: pwsh
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: |
39+
$pyprojcontent = Get-Content pyproject.toml -Raw
40+
41+
$PROJECT_NAME = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?name\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value
42+
$CURRENT_VERSION = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?version\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value
43+
44+
45+
# Get PR number and run number with proper padding
46+
$PR_NUM = [int]"${{ github.event.pull_request.number }}"
47+
$PADDED_PR = "{0:D5}" -f [int]"${{ github.event.pull_request.number }}"
48+
$PADDED_RUN = "{0:D4}" -f [int]"${{ github.run_number }}"
49+
$PADDED_NEXT_PR = "{0:D5}" -f ($PR_NUM + 1)
50+
51+
# Create version range strings for PR
52+
$MIN_VERSION = "$CURRENT_VERSION.dev1$PADDED_PR" + "0000"
53+
$MAX_VERSION = "$CURRENT_VERSION.dev1$PADDED_NEXT_PR" + "0000"
54+
55+
# Create unique dev version with PR number and run ID
56+
$DEV_VERSION = "$CURRENT_VERSION.dev1$PADDED_PR$PADDED_RUN"
57+
58+
# Update version in pyproject.toml
59+
(Get-Content pyproject.toml) -replace "version = `"$CURRENT_VERSION`"", "version = `"$DEV_VERSION`"" | Set-Content pyproject.toml
60+
61+
Write-Output "Package version set to $DEV_VERSION"
62+
63+
$dependencyMessage = @"
64+
## Development Package
65+
66+
- Add this package as a dependency in your pyproject.toml:
67+
68+
``````toml
69+
[project]
70+
dependencies = [
71+
# Exact version:
72+
"$PROJECT_NAME==$DEV_VERSION",
73+
74+
# Any version from PR
75+
"$PROJECT_NAME>=$MIN_VERSION,<$MAX_VERSION"
76+
]
77+
78+
[[tool.uv.index]]
79+
name = "testpypi"
80+
url = "https://test.pypi.org/simple/"
81+
publish-url = "https://test.pypi.org/legacy/"
82+
explicit = true
83+
84+
[tool.uv.sources]
85+
$PROJECT_NAME = { index = "testpypi" }
86+
``````
87+
"@
88+
89+
# Get the owner and repo from the GitHub repository
90+
$owner = "${{ github.repository_owner }}"
91+
$repo = "${{ github.repository }}".Split('/')[1]
92+
$prNumber = $PR_NUM
93+
94+
# Get the current PR description
95+
$prUri = "https://api.github.com/repos/$owner/$repo/pulls/$prNumber"
96+
$headers = @{
97+
Authorization = "token $env:GITHUB_TOKEN"
98+
Accept = "application/vnd.github.v3+json"
99+
}
100+
101+
$pr = Invoke-RestMethod -Uri $prUri -Method Get -Headers $headers
102+
$currentBody = $pr.body
103+
104+
# Check if there's already a development package section
105+
if ($currentBody -match '## Development Package') {
106+
# Replace the existing section with the new dependency message
107+
$newBody = $currentBody -replace '## Development Package(\r?\n|.)*?(?=##|$)', $dependencyMessage
108+
} else {
109+
# Append the dependency message to the end of the description
110+
$newBody = if ($currentBody) { "$currentBody`n`n$dependencyMessage" } else { $dependencyMessage }
111+
}
112+
113+
# Update the PR description
114+
$updateBody = @{
115+
body = $newBody
116+
} | ConvertTo-Json
117+
118+
Invoke-RestMethod -Uri $prUri -Method Patch -Headers $headers -Body $updateBody -ContentType "application/json"
119+
120+
Write-Output "Updated PR description with development package information"
121+
122+
- name: Build package
123+
run: uv build
124+
125+
- name: Publish
126+
run: uv publish --index testpypi
127+
env:
128+
UV_PUBLISH_TOKEN: ${{ secrets.TESTPYPI_TOKEN }}
129+

0 commit comments

Comments
 (0)