|
| 1 | +# SETUP.md |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +- Python 3.11+ |
| 6 | +- [uv](https://docs.astral.sh/uv/) 0.5+ |
| 7 | + |
| 8 | +### Supported platforms |
| 9 | + |
| 10 | +This checklist controls the Agentic Inner Loop KPI pipeline targets (clean Linux VM). The repo's own GitHub Actions CI additionally tests on `windows-latest`, but that is not measured by this KPI. |
| 11 | + |
| 12 | +- [x] Linux |
| 13 | +- [ ] Windows |
| 14 | +- [ ] macOS |
| 15 | + |
| 16 | +## Environment Variables |
| 17 | + |
| 18 | +### Standard (injected by pipeline) |
| 19 | + |
| 20 | +None of the standard pipeline variables are required for environment setup, build, or unit tests. |
| 21 | + |
| 22 | +### Project-specific |
| 23 | + |
| 24 | +None. The unit-test suites under the `Test` section below run fully offline and require no external authentication. The repo's optional E2E tests (`pytest -m e2e`) are excluded from this KPI; their credentials (`UIPATH_URL`, `UIPATH_CLIENT_ID`, `UIPATH_CLIENT_SECRET`, `UIPATH_FOLDER_KEY`) are wired only in the dedicated GitHub Actions `e2e-uipath-platform` job and are out of scope here. |
| 25 | + |
| 26 | +## Setup |
| 27 | + |
| 28 | +```bash |
| 29 | +# Install uv if not present |
| 30 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 31 | +export PATH="$HOME/.local/bin:$PATH" |
| 32 | + |
| 33 | +# Sync all three packages with dev dependencies (dependency order: core → platform → main) |
| 34 | +uv --directory packages/uipath-core sync --all-extras |
| 35 | +uv --directory packages/uipath-platform sync --all-extras |
| 36 | +uv --directory packages/uipath sync --all-extras |
| 37 | +``` |
| 38 | + |
| 39 | +## Verify Setup |
| 40 | + |
| 41 | +```bash |
| 42 | +python3 --version |
| 43 | +uv --version |
| 44 | +uv --directory packages/uipath-core run python -c "import uipath.core; print('uipath-core ok')" |
| 45 | +uv --directory packages/uipath-platform run python -c "import uipath.platform; print('uipath-platform ok')" |
| 46 | +uv --directory packages/uipath run python -c "import uipath; print('uipath ok')" |
| 47 | +``` |
| 48 | + |
| 49 | +## Build |
| 50 | + |
| 51 | +```bash |
| 52 | +uv --directory packages/uipath-core build |
| 53 | +uv --directory packages/uipath-platform build |
| 54 | +uv --directory packages/uipath build |
| 55 | +``` |
| 56 | + |
| 57 | +## Test |
| 58 | + |
| 59 | +```bash |
| 60 | +uv --directory packages/uipath-core run pytest -m "not e2e" |
| 61 | +uv --directory packages/uipath-platform run pytest -m "not e2e" |
| 62 | +uv --directory packages/uipath run pytest -m "not e2e" |
| 63 | +``` |
| 64 | + |
| 65 | +## Sample Code Change |
| 66 | + |
| 67 | +### The change |
| 68 | + |
| 69 | +Add a new `size` property to `SpanRegistry` in `packages/uipath-core/src/uipath/core/tracing/span_utils.py`, immediately after the `clear` method (around line 130) and before the `# Global span registry instance` comment: |
| 70 | + |
| 71 | +```python |
| 72 | +@property |
| 73 | +def size(self) -> int: |
| 74 | + """Return the number of currently registered spans.""" |
| 75 | + return len(self._spans) |
| 76 | +``` |
| 77 | + |
| 78 | +Then create `packages/uipath-core/tests/tracing/test_span_registry_size.py` with two pytest tests: |
| 79 | + |
| 80 | +```python |
| 81 | +from unittest.mock import MagicMock |
| 82 | + |
| 83 | +from uipath.core.tracing.span_utils import SpanRegistry |
| 84 | + |
| 85 | + |
| 86 | +def _make_span(span_id: int) -> MagicMock: |
| 87 | + span = MagicMock() |
| 88 | + span.get_span_context.return_value.span_id = span_id |
| 89 | + span.parent = None # registered as a root span (no parent) |
| 90 | + return span |
| 91 | + |
| 92 | + |
| 93 | +def test_size_empty_registry() -> None: |
| 94 | + registry = SpanRegistry() |
| 95 | + assert registry.size == 0 |
| 96 | + |
| 97 | + |
| 98 | +def test_size_after_registrations() -> None: |
| 99 | + registry = SpanRegistry() |
| 100 | + registry.register_span(_make_span(1)) |
| 101 | + registry.register_span(_make_span(2)) |
| 102 | + assert registry.size == 2 |
| 103 | +``` |
| 104 | + |
| 105 | +### Verification |
| 106 | + |
| 107 | +```bash |
| 108 | +uv --directory packages/uipath-core run pytest tests/tracing/test_span_registry_size.py -v |
| 109 | +``` |
0 commit comments