Skip to content

Commit b2b3608

Browse files
authored
docs: add SETUP.MD (#1682)
1 parent ed5e509 commit b2b3608

1 file changed

Lines changed: 133 additions & 0 deletions

File tree

SETUP.MD

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# SETUP.MD
2+
3+
This file documents how to provision a clean development environment for the three packages in this repo (`uipath-core`, `uipath-platform`, `uipath`), run the build, execute the tests, and validate a sample code change end-to-end. It is intended both as a quick reference for human contributors and as a structured guide for automated environment-setup tooling.
4+
5+
## Prerequisites
6+
7+
- Python 3.11+
8+
- [uv](https://docs.astral.sh/uv/) 0.5+
9+
10+
### Supported platforms
11+
12+
`uv` is shell- and OS-agnostic, so the commands below run unchanged on every supported platform:
13+
14+
- [x] Linux
15+
- [x] Windows
16+
- [x] macOS
17+
18+
## Environment Variables
19+
20+
None required for environment setup, build, or unit tests. The suites under the `Test` section run fully offline and require no external authentication.
21+
22+
> **All commands below must be run from the repository root.** The `uv --directory packages/<name>` invocations resolve each subpackage relative to the current working directory. The first line of `## Setup` enforces this by `cd`-ing to the git root.
23+
24+
## Setup
25+
26+
```bash
27+
cd "$(git rev-parse --show-toplevel)"
28+
python3 -m pip install --upgrade uv
29+
30+
# Sync all three packages (dependency order: core → platform → main)
31+
uv --directory packages/uipath-core sync --all-extras
32+
uv --directory packages/uipath-platform sync --all-extras
33+
uv --directory packages/uipath sync --all-extras
34+
```
35+
36+
## Verify Setup
37+
38+
```bash
39+
uv --version
40+
uv --directory packages/uipath-core run python --version
41+
uv --directory packages/uipath-core run python -c "import uipath.core; print('uipath-core ok')"
42+
uv --directory packages/uipath-platform run python -c "import uipath.platform; print('uipath-platform ok')"
43+
uv --directory packages/uipath run python -c "import uipath; print('uipath ok')"
44+
```
45+
46+
## Build
47+
48+
N/A
49+
50+
## Test
51+
52+
```bash
53+
uv --directory packages/uipath-core run pytest
54+
uv --directory packages/uipath-platform run pytest
55+
uv --directory packages/uipath run pytest
56+
```
57+
58+
> Note: `uipath-platform`'s `pyproject.toml` already excludes its E2E tests via `addopts = "... -m 'not e2e'"`. `uipath-core` and `uipath` do not register an `e2e` marker.
59+
60+
## Sample Code Change
61+
62+
### The change
63+
64+
Add a new `size` property to `SpanRegistry` in `packages/uipath-core/src/uipath/core/tracing/span_utils.py`, immediately after the `clear` method and before the `# Global span registry instance` comment:
65+
66+
```python
67+
@property
68+
def size(self) -> int:
69+
"""Return the number of currently registered spans."""
70+
return len(self._spans)
71+
```
72+
73+
Then create `packages/uipath-core/tests/tracing/test_span_registry_size.py` with two pytest tests:
74+
75+
```python
76+
from unittest.mock import MagicMock
77+
78+
from uipath.core.tracing.span_utils import SpanRegistry
79+
80+
81+
def _make_span(span_id: int) -> MagicMock:
82+
span = MagicMock()
83+
span.get_span_context.return_value.span_id = span_id
84+
span.parent = None # registered as a root span (no parent)
85+
return span
86+
87+
88+
def test_size_empty_registry() -> None:
89+
registry = SpanRegistry()
90+
assert registry.size == 0
91+
92+
93+
def test_size_after_registrations() -> None:
94+
registry = SpanRegistry()
95+
registry.register_span(_make_span(1))
96+
registry.register_span(_make_span(2))
97+
assert registry.size == 2
98+
```
99+
100+
### Verification
101+
102+
```bash
103+
uv --directory packages/uipath-core run pytest tests/tracing/test_span_registry_size.py -v
104+
```
105+
106+
## Test with a real UiPath Coded Agent
107+
108+
> This section is for human contributors who want to validate changes end-to-end against the real cloud platform. It is **not executed by the Agentic Inner Loop validation pipeline** — that pipeline only runs the sections above (Setup → Verify → Build → Test → Sample Code Change).
109+
110+
The unit tests above are necessary but not sufficient — they don't exercise the package end-to-end through a real agent. The flow below validates changes against a live runtime:
111+
112+
1. Apply the code changes locally.
113+
2. Run the unit tests (see the `Sample Code Change` section above).
114+
3. Scaffold a coded UiPath agent that exercises the changed code path.
115+
4. In the downstream project's `pyproject.toml`, add this local library as an editable dependency (substitute `uipath`, `uipath-platform`, or `uipath-core` depending on which package you changed):
116+
117+
```toml
118+
[tool.uv.sources]
119+
uipath = { path = "../path/to/uipath-python/packages/uipath", editable = true }
120+
```
121+
122+
5. Exercise the new behavior end-to-end:
123+
124+
```bash
125+
uv run uipath run <agent-name> --input '{...}'
126+
```
127+
128+
6. (Optional) Open a PR and apply the `build:dev` label — this publishes the development version to Test PyPI.
129+
7. The PR description is updated automatically with instructions for pointing the downstream agent at the Test PyPI dev version.
130+
8. Validate the new behavior against the real platform — use either or both of the deploy targets below (Studio Web and Orchestrator are not mutually exclusive):
131+
- **Studio Web**: export the `UIPATH_PROJECT_ID` environment variable pointing to an existing Coded Agent project in your solution, then run [`uipath push`](https://uipath.github.io/uipath-python/cli/#push) to push the dev version to that project. Open it in Studio Web and exercise the changed code path.
132+
- **Orchestrator**: run [`uipath deploy`](https://uipath.github.io/uipath-python/cli/#deploy) to deploy the dev version as a package, then start a job in Orchestrator and exercise the changed code path.
133+
9. Once validation is done, close the dev PR — these PRs are not meant to be merged; their only purpose was to publish a Test PyPI build for end-to-end validation.

0 commit comments

Comments
 (0)